summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-08-02 23:28:30 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-08-04 00:28:51 -0600
commitf836073d95bd909bfe40b0eb089d18f52540e9d8 (patch)
tree22b79a204d37a8ae5d1d801b16c129a765842802
parenteb8290c76dffd876b9397736b6482fddceeb0fe6 (diff)
begin replacing tall.svg with generated spacer SVG in tests
-rw-r--r--spec/page_spec.rb24
-rw-r--r--spec/reference/page-background-image-svg-fit-scale-down-height.pdf90
2 files changed, 60 insertions, 54 deletions
diff --git a/spec/page_spec.rb b/spec/page_spec.rb
index c48526cf..19ad6693 100644
--- a/spec/page_spec.rb
+++ b/spec/page_spec.rb
@@ -1354,21 +1354,25 @@ describe 'Asciidoctor::PDF::Converter - Page' do
end
it 'should scale down background SVG to fit boundaries of page if computed height is greater than page height', visual: true do
- to_file = to_pdf_file <<~'END', 'page-background-image-svg-fit-scale-down-computed-height.pdf'
- :pdf-page-size: A6
- :page-background-image: image:tall.svg[pdfwidth=200,fit=scale-down]
- END
+ with_content_spacer 200, 600 do |spacer_path|
+ to_file = to_pdf_file <<~END, 'page-background-image-svg-fit-scale-down-computed-height.pdf'
+ :pdf-page-size: A6
+ :page-background-image: image:#{spacer_path}[pdfwidth=200,fit=scale-down]
+ END
- (expect to_file).to visually_match 'page-background-image-svg-fit-scale-down-height.pdf'
+ (expect to_file).to visually_match 'page-background-image-svg-fit-scale-down-height.pdf'
+ end
end
it 'should scale down background SVG to fit boundaries of page if intrinsic height is greater than page height', visual: true do
- to_file = to_pdf_file <<~'END', 'page-background-image-svg-fit-scale-down-intrinsic-height.pdf'
- :pdf-page-size: A6
- :page-background-image: image:tall.svg[fit=scale-down]
- END
+ with_content_spacer 200, 600 do |spacer_path|
+ to_file = to_pdf_file <<~END, 'page-background-image-svg-fit-scale-down-intrinsic-height.pdf'
+ :pdf-page-size: A6
+ :page-background-image: image:#{spacer_path}[fit=scale-down]
+ END
- (expect to_file).to visually_match 'page-background-image-svg-fit-scale-down-height.pdf'
+ (expect to_file).to visually_match 'page-background-image-svg-fit-scale-down-height.pdf'
+ end
end
it 'should not scale background SVG with explicit width to fit boundaries of page if fit is scale-down and image fits', visual: true do
diff --git a/spec/reference/page-background-image-svg-fit-scale-down-height.pdf b/spec/reference/page-background-image-svg-fit-scale-down-height.pdf
index fca21ab2..d80094e5 100644
--- a/spec/reference/page-background-image-svg-fit-scale-down-height.pdf
+++ b/spec/reference/page-background-image-svg-fit-scale-down-height.pdf
@@ -2,22 +2,22 @@
%ÿÿÿÿ
1 0 obj
<< /Title (Untitled)
-/Creator (Asciidoctor PDF 2.0.0.dev, based on Prawn 2.2.2)
-/Producer (Asciidoctor PDF 2.0.0.dev, based on Prawn 2.2.2)
-/ModDate (D:20200708082559+00'00')
-/CreationDate (D:20200708082559+00'00')
+/Creator (Asciidoctor PDF 3.0.0.alpha.0, based on Prawn 2.4.0)
+/Producer (Asciidoctor PDF 3.0.0.alpha.0, based on Prawn 2.4.0)
+/ModDate (D:20230804002636-06'00')
+/CreationDate (D:20230804002636-06'00')
>>
endobj
2 0 obj
<< /Type /Catalog
/Pages 3 0 R
-/Names 9 0 R
-/Outlines 11 0 R
-/PageLabels 13 0 R
+/Outlines 8 0 R
+/PageLabels 10 0 R
/PageMode /UseOutlines
/OpenAction [7 0 R /FitH 419.53]
/ViewerPreferences << /DisplayDocTitle true
>>
+/Names 12 0 R
>>
endobj
3 0 obj
@@ -48,28 +48,30 @@ endobj
>>
endobj
6 0 obj
-<< /Length 268
+<< /Length 242
>>
stream
q
q
-78.8983 0.0 m
-218.7417 0.0 l
-218.7417 419.53 l
-78.8983 419.53 l
+78.89833 0.0 m
+218.74167 0.0 l
+218.74167 419.53 l
+78.89833 419.53 l
h
W n
/DeviceRGB cs
0.0 0.0 0.0 scn
-0.69922 0.00000 0.00000 0.69922 23.73130 126.18763 cm
-1.00000 0.00000 0.00000 1.00000 0.00000 0.00000 cm
+0.69922 0.0 0.0 0.69922 23.7313 126.18763 cm
+1.0 0.0 0.0 1.0 0.0 0.0 cm
q
-0.0 0.502 0.0 scn
-78.8983 -180.47 200.0 600.0 re
+q
+0.6 0.6 0.6 scn
+78.89833 -180.47 200.0 600.0 re
f
Q
Q
Q
+Q
endstream
endobj
@@ -88,57 +90,57 @@ endobj
>>
endobj
8 0 obj
-[7 0 R /XYZ 0 419.53 null]
+<< /Type /Outlines
+/Count 1
+/First 9 0 R
+/Last 9 0 R
+>>
endobj
9 0 obj
-<< /Type /Names
-/Dests 10 0 R
+<< /Title <feff0055006e007400690074006c00650064>
+/Parent 8 0 R
+/Count 0
+/Dest [7 0 R /XYZ 0 419.53 null]
>>
endobj
10 0 obj
-<< /Names [(__anchor-top) 8 0 R]
+<< /Nums [0 << /P (1)
+>>]
>>
endobj
11 0 obj
-<< /Type /Outlines
-/Count 1
-/First 12 0 R
-/Last 12 0 R
->>
+[7 0 R /XYZ 0 419.53 null]
endobj
12 0 obj
-<< /Title <feff0055006e007400690074006c00650064>
-/Parent 11 0 R
-/Count 0
-/Dest [7 0 R /XYZ 0 419.53 null]
+<< /Type /Names
+/Dests 13 0 R
>>
endobj
13 0 obj
-<< /Nums [0 << /P (1)
->>]
+<< /Names [(__anchor-top) 11 0 R]
>>
endobj
xref
0 14
0000000000 65535 f
0000000015 00000 n
-0000000248 00000 n
-0000000449 00000 n
-0000000506 00000 n
-0000000557 00000 n
-0000000829 00000 n
-0000001148 00000 n
-0000001432 00000 n
-0000001474 00000 n
-0000001522 00000 n
-0000001574 00000 n
-0000001648 00000 n
-0000001773 00000 n
+0000000256 00000 n
+0000000457 00000 n
+0000000514 00000 n
+0000000565 00000 n
+0000000837 00000 n
+0000001130 00000 n
+0000001414 00000 n
+0000001485 00000 n
+0000001608 00000 n
+0000001653 00000 n
+0000001696 00000 n
+0000001745 00000 n
trailer
<< /Size 14
/Root 2 0 R
/Info 1 0 R
>>
startxref
-1818
+1798
%%EOF