aboutsummaryrefslogtreecommitdiff
path: root/test/Tests
diff options
context:
space:
mode:
authorEmily Bourke <undergroundquizscene@protonmail.com>2021-08-19 15:53:21 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2021-09-01 07:16:17 -0700
commitb82a01b6883c1f6a9ce5d3edd80d5a2453ecef9e (patch)
tree223aaee72e5f53c5abc8b3a04e31b18577dec5a5 /test/Tests
parent8dbea4909211ef7b2acc677288be7c5f10cbb40e (diff)
downloadpandoc-b82a01b6883c1f6a9ce5d3edd80d5a2453ecef9e.tar.gz
pptx: Add support for more layouts
Until now, the pptx writer only supported four slide layouts: “Title Slide” (used for the automatically generated metadata slide), “Section Header” (used for headings above the slide level), “Two Column” (used when there’s a columns div containing at least two column divs), and “Title and Content” (used for all other slides). This commit adds support for three more layouts: Comparison, Content with Caption, and Blank. - Support “Comparison” slide layout This layout is used when a slide contains at least two columns, at least one of which contains some text followed by some non-text (e.g. an image or table). The text in each column is inserted into the “body” placeholder for that column, and the non-text is inserted into the ObjType placeholder. Any extra content after the non-text is overlaid on top of the preceding content, rather than dropping it completely (as currently happens for the two-column layout). + Accept straightforward test changes Adding the new layout means the “-deleted-layouts” tests have an additional layout added to the master and master rels. + Add new tests for the comparison layout + Add new tests to pandoc.cabal - Support “Content with Caption” slide layout This layout is used when a slide’s body contains some text, followed by non-text (e.g. and image or a table). Before now, in this case the image or table would break onto a new slide: to get that output again, users can add a horizontal rule before the image or table. + Accept straightforward tests The “-deleted-layouts” tests all have an extra layout and relationship in the master for the Content with Caption layout. + Accept remove-empty-slides test Empty slides are still removed, but the Content with Caption layout is now used. + Change slide-level-0/h1-h2-with-text description This test now triggers the content with caption layout, giving a different (but still correct) result. + Add new tests for the new layout + Add new tests to the cabal file - Support “Blank” slide layout This layout is used when a slide contains only blank content (e.g. non-breaking spaces). No content is inserted into any placeholders in the layout. Fixes #5097. + Accept straightforward test changes Blank layout now copied over from reference doc as well, when layouts have been deleted. + Add some new tests A slide should use the blank layout if: - It contains only speaker notes - It contains only an empty heading with a body of nbsps - It contains only a heading containing only nbsps - Change ContentType -> Placeholder This type was starting to have a constructor for each placeholder on each slide (e.g. `ComparisonUpperLeftContent`). I’ve changed it instead to identify a placeholder by type and index, as I think that’s clearer and less redundant. - Describe layout-choosing logic in manual
Diffstat (limited to 'test/Tests')
-rw-r--r--test/Tests/Writers/Powerpoint.hs61
1 files changed, 59 insertions, 2 deletions
diff --git a/test/Tests/Writers/Powerpoint.hs b/test/Tests/Writers/Powerpoint.hs
index fd9871659..256ee1f7f 100644
--- a/test/Tests/Writers/Powerpoint.hs
+++ b/test/Tests/Writers/Powerpoint.hs
@@ -166,9 +166,66 @@ tests = groupPptxTests [ pptxTests "Inline formatting"
"pptx/slide-level-0/h1-with-table/output.pptx"
, pptxTests ("Using slide level 0, if the first thing on "
<> "a slide is a heading it's used as the "
- <> "slide title (two headings forces a "
- <> "slide break though)")
+ <> "slide title (content with caption layout)")
def { writerSlideLevel = Just 0 }
"pptx/slide-level-0/h1-h2-with-table/input.native"
"pptx/slide-level-0/h1-h2-with-table/output.pptx"
+ , pptxTests ("comparison layout used when two columns "
+ <> "contain text plus non-text")
+ def
+ "pptx/comparison/both-columns/input.native"
+ "pptx/comparison/both-columns/output.pptx"
+ , pptxTests ("comparison layout used even when only one "
+ <> "column contains text plus non-text")
+ def
+ "pptx/comparison/one-column/input.native"
+ "pptx/comparison/one-column/output.pptx"
+ , pptxTests ("extra text in one column in comparison "
+ <> "layout gets overlaid")
+ def
+ "pptx/comparison/extra-text/input.native"
+ "pptx/comparison/extra-text/output.pptx"
+ , pptxTests ("extra image in one column in comparison "
+ <> "layout gets overlaid")
+ def
+ "pptx/comparison/extra-image/input.native"
+ "pptx/comparison/extra-image/output.pptx"
+ , pptxTests "comparison not used if the non-text comes first"
+ def
+ "pptx/comparison/non-text-first/input.native"
+ "pptx/comparison/non-text-first/output.pptx"
+ , pptxTests ("Heading, text and an image on the same "
+ <> "slide uses the Content with Caption "
+ <> "layout")
+ def
+ "pptx/content-with-caption/heading-text-image/input.native"
+ "pptx/content-with-caption/heading-text-image/output.pptx"
+ , pptxTests ("Text and an image on the same "
+ <> "slide uses the Content with Caption "
+ <> "layout")
+ def
+ "pptx/content-with-caption/text-image/input.native"
+ "pptx/content-with-caption/text-image/output.pptx"
+ , pptxTests ("If the image comes first, Content with "
+ <> "Caption is not used")
+ def
+ "pptx/content-with-caption/image-text/input.native"
+ "pptx/content-with-caption/image-text/output.pptx"
+ , pptxTests ("If a slide contains only speaker notes, the "
+ <> "Blank layout is used")
+ def
+ "pptx/blanks/just-speaker-notes/input.native"
+ "pptx/blanks/just-speaker-notes/output.pptx"
+ , pptxTests ("If a slide contains only an empty heading "
+ <> "with a body of only non-breaking spaces"
+ <> ", the Blank layout is used")
+ def
+ "pptx/blanks/nbsp-in-body/input.native"
+ "pptx/blanks/nbsp-in-body/output.pptx"
+ , pptxTests ("If a slide contains only a heading "
+ <> "containing only non-breaking spaces, "
+ <> "the Blank layout is used")
+ def
+ "pptx/blanks/nbsp-in-heading/input.native"
+ "pptx/blanks/nbsp-in-heading/output.pptx"
]