diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/optimizer_spec.rb | 25 | ||||
| -rw-r--r-- | spec/reference/optimizer-bw.pdf | bin | 0 -> 30194 bytes | |||
| -rw-r--r-- | spec/reference/optimizer-gray.pdf | bin | 0 -> 30240 bytes |
3 files changed, 25 insertions, 0 deletions
diff --git a/spec/optimizer_spec.rb b/spec/optimizer_spec.rb index 3ac9c0ba..caaa7ee7 100644 --- a/spec/optimizer_spec.rb +++ b/spec/optimizer_spec.rb @@ -88,6 +88,31 @@ describe 'Asciidoctor::PDF::Optimizer', if: (RSpec::ExampleGroupHelpers.gem_avai end).to not_raise_exception end + it 'should apply grayscale color mode modifier on quality when optimizing output file', visual: true do + %w(gray grayscale).each do |mode| + input_file = Pathname.new fixture_file 'with-color.adoc' + to_file = to_pdf_file input_file, 'optimizer-gray.pdf', attribute_overrides: { 'optimize' => %(screen:#{mode}) } + (expect to_file).to visually_match 'optimizer-gray.pdf' + end + end + + #it 'should apply bw color mode modifier on quality when optimizing output file', visual: true do + # input_file = Pathname.new fixture_file 'with-color.adoc' + # to_file = to_pdf_file input_file, 'optimizer-bw.pdf', attribute_overrides: { 'optimize' => ':bw' } + # (expect to_file).to visually_match 'optimizer-bw.pdf' + #end + + it 'should apply bw color mode modifier on quality when optimizing output file', visual: true do + input_file = Pathname.new fixture_file 'with-color.adoc' + attribute_overrides = { 'optimize' => ':bw' } + pdf = to_pdf input_file, attribute_overrides: attribute_overrides, analyze: true + (expect pdf.text.map {|it| it[:font_color] }.uniq).to eql [nil] + pdf = to_pdf input_file, attribute_overrides: attribute_overrides, analyze: :rect + rects = pdf.rectangles + (expect rects).to have_size 1 + (expect rects[0][:fill_color]).to eql '818181' + end + it 'should generate PDF that conforms to specified compliance' do input_file = Pathname.new example_file 'basic-example.adoc' to_file = to_pdf_file input_file, 'optimizer-screen-pdf-a.pdf', attribute_overrides: { 'optimize' => 'PDF/A' } diff --git a/spec/reference/optimizer-bw.pdf b/spec/reference/optimizer-bw.pdf Binary files differnew file mode 100644 index 00000000..2b5cde75 --- /dev/null +++ b/spec/reference/optimizer-bw.pdf diff --git a/spec/reference/optimizer-gray.pdf b/spec/reference/optimizer-gray.pdf Binary files differnew file mode 100644 index 00000000..32d19c67 --- /dev/null +++ b/spec/reference/optimizer-gray.pdf |
