diff --git a/scripts/generate_test_epub.py b/scripts/generate_test_epub.py index 39d2dad3..6f8594d8 100644 --- a/scripts/generate_test_epub.py +++ b/scripts/generate_test_epub.py @@ -1007,37 +1007,6 @@ def main(): ) print("Creating layout regression test EPUB...") - layout_css = """ - -""" layout_chapters = [ ( @@ -1046,7 +1015,8 @@ p { margin-top: 0.7em; margin-bottom: 0.7em; } "Layout Regression Tests", """
This EPUB exercises recent parser edge cases around nested block styles and image wrappers.
-Recommended settings: Embedded Style ON, Paragraph Alignment set to Book Style or Justify.
+Recommended settings: Paragraph Alignment set to Book Style or Justify.
+This regression EPUB uses inline style attributes rather than a head <style> block so it works even if chapter-local embedded CSS is not loaded.
This chapter mirrors the c1/c2/c3/c4 example behind PR 1582.
-Expected: the first paragraph is visibly more indented than the second, but both still inherit the outer wrapper indentation.
-C3 paragraph. This text should have the largest left indent because it inherits c1, c2, and c3. Repeat text to make the paragraph wrap across multiple lines and make the effective left inset obvious while reading.
+This chapter mirrors the c1/c2/c3/c4 example behind PR 1582.
+Expected: C3 is indented the most. C4 is indented less than C3, but still more than the baseline paragraph outside the wrapper.
+Expected order of indentation: C3 > C4 > baseline paragraph.
+C3 paragraph. This text should have the largest left indent because it inherits the outer wrapper, the inner wrapper, and its own left margin. Repeat text to make the paragraph wrap across multiple lines and make the effective left inset obvious while reading.
C4 paragraph. This text should still inherit the outer c1 indent, but not the inner c2 indent. It should therefore appear less indented than the paragraph above, not flush with the body text.
+C4 paragraph. This text should still inherit the outer wrapper indent, but not the inner wrapper indent. It should therefore appear less indented than the paragraph above, not flush with the body text.
+Outer-wrapper-only control paragraph. This paragraph should still be indented relative to the page body because it inherits the outer wrapper margin, even though it has no paragraph-level margin-left of its own.
Reference paragraph outside the wrappers. This paragraph should align with the normal body text and helps compare the wrapper indentation against the baseline.
+Baseline paragraph outside the wrappers. This paragraph should align with the normal body text and should be the least indented paragraph on this page.
""", - head_content=layout_css, ), [], ), @@ -1081,16 +1052,15 @@ p { margin-top: 0.7em; margin-bottom: 0.7em; } make_chapter( "Nested Vertical Margin Sanity", """ -Expected: wrapper nesting should not create an oversized blank vertical gulf between these paragraphs.
-Nested vertical spacing paragraph. There should be some breathing room above and below, but not dramatically more than a normal section break.
+Expected: wrapper nesting should not create an oversized blank vertical gulf between these paragraphs.
+Nested vertical spacing paragraph. There should be some breathing room above and below, but not dramatically more than a normal section break.
Sibling paragraph after the nested block. Spacing before this paragraph should feel normal and should not keep growing with every ancestor wrapper.
+Sibling paragraph after the nested block. Spacing before this paragraph should feel normal and should not keep growing with every ancestor wrapper.
Baseline paragraph after the wrapper section. This should not be pushed far down the page.
+Baseline paragraph after the wrapper section. This should not be pushed far down the page.
""", - head_content=layout_css, ), [], ), @@ -1099,15 +1069,14 @@ p { margin-top: 0.7em; margin-bottom: 0.7em; } make_chapter( "Image Wrapper Spacing", """ -Expected: the wrapper's margins should create space around the image, and the paragraph after the image should start with normal spacing rather than inheriting a second copy of that gap.
-
Expected: the wrapper's margins should create space around the image, and the paragraph after the image should start with normal spacing rather than inheriting a second copy of that gap.
+
Paragraph after wrapped image. If the wrapper spacing leaks, this paragraph will begin too far down the page. If container width is ignored, the image may also appear too wide for the wrapper.
+Paragraph after wrapped image. If the wrapper spacing leaks, this paragraph will begin too far down the page. If container width is ignored, the image may also appear too wide for the wrapper.
""", - head_content=layout_css, ), [("centering_test.jpg", images["centering_test.jpg"])], ), @@ -1116,13 +1085,12 @@ p { margin-top: 0.7em; margin-bottom: 0.7em; } make_chapter( "Hidden Image Spacing Reset", """ -Expected: the hidden image wrapper should not leave a large blank gap before the following paragraph.
-
Expected: the hidden image wrapper should not leave a large blank gap before the following paragraph.
+
Paragraph after hidden image. This should follow with near-normal spacing, not the large gap that would be appropriate for a visible wrapped image.
+Paragraph after hidden image. This should follow with near-normal spacing, not the large gap that would be appropriate for a visible wrapped image.
""", - head_content=layout_css, ), [("centering_test.jpg", images["centering_test.jpg"])], ), diff --git a/test/epubs/test_jpeg_images.epub b/test/epubs/test_jpeg_images.epub index 5077801f..2bfc04c7 100644 Binary files a/test/epubs/test_jpeg_images.epub and b/test/epubs/test_jpeg_images.epub differ diff --git a/test/epubs/test_layout_regressions.epub b/test/epubs/test_layout_regressions.epub index b145dd67..ee54e93c 100644 Binary files a/test/epubs/test_layout_regressions.epub and b/test/epubs/test_layout_regressions.epub differ diff --git a/test/epubs/test_mixed_images.epub b/test/epubs/test_mixed_images.epub index 008a16bd..d6f9a0f9 100644 Binary files a/test/epubs/test_mixed_images.epub and b/test/epubs/test_mixed_images.epub differ diff --git a/test/epubs/test_png_images.epub b/test/epubs/test_png_images.epub index 32412027..c3301787 100644 Binary files a/test/epubs/test_png_images.epub and b/test/epubs/test_png_images.epub differ diff --git a/test/epubs/test_text_rendering.epub b/test/epubs/test_text_rendering.epub index 7cf7d479..ecbe399f 100644 Binary files a/test/epubs/test_text_rendering.epub and b/test/epubs/test_text_rendering.epub differ