@@ -3,54 +3,78 @@ module Tests.Writers.Powerpoint (tests) where
3import Tests.Writers.OOXML (ooxmlTest)
3import Tests.Writers.OOXML (ooxmlTest)
4import Text.Pandoc
4import Text.Pandoc
5import Test.Tasty
5import Test.Tasty
8+-- templating is important enough, and can break enough things, that
9+-- we want to run all our tests with both default formatting and a
12+modifyPptxName :: FilePath -> FilePath
14+ addExtension (dropExtension fp ++ "_templated") "pptx"
16+pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree)
17+pptxTests name opts native pptx =
18+ let referenceDoc = "pptx/reference_depth.pptx"
23+ opts{writerReferenceDoc=Nothing}
29+ opts{writerReferenceDoc=Just referenceDoc}
31+ (modifyPptxName pptx)
34+groupPptxTests :: [(TestTree, TestTree)] -> [TestTree]
35+groupPptxTests pairs =
36+ let (noRefs, refs) = unzip pairs
38+ [ testGroup "Default slide formatting" noRefs
39+ , testGroup "With `--reference-doc` pptx file" refs
7−pptxTest :: String -> WriterOptions -> FilePath -> FilePath -> TestTree
8−pptxTest = ooxmlTest writePowerpoint
10tests :: [TestTree]
43tests :: [TestTree]
12− "Inline formatting"
44+tests = groupPptxTests [ pptxTests "Inline formatting"
14− "pptx/inline_formatting.native"
46+ "pptx/inline_formatting.native"
15− "pptx/inline_formatting.pptx"
47+ "pptx/inline_formatting.pptx"
17− "Slide breaks (default slide-level)"
48+ , pptxTests "Slide breaks (default slide-level)"
19− "pptx/slide_breaks.native"
50+ "pptx/slide_breaks.native"
20− "pptx/slide_breaks.pptx"
51+ "pptx/slide_breaks.pptx"
22− "slide breaks (slide-level set to 1)"
52+ , pptxTests "slide breaks (slide-level set to 1)"
23− def{ writerSlideLevel = Just 1 }
53+ def{ writerSlideLevel = Just 1 }
24− "pptx/slide_breaks.native"
54+ "pptx/slide_breaks.native"
25− "pptx/slide_breaks_slide_level_1.pptx"
55+ "pptx/slide_breaks_slide_level_1.pptx"
27− "table of contents"
56+ , pptxTests "table of contents"
28− def{ writerTableOfContents = True }
57+ def{ writerTableOfContents = True }
29− "pptx/slide_breaks.native"
58+ "pptx/slide_breaks.native"
30− "pptx/slide_breaks_toc.pptx"
59+ "pptx/slide_breaks_toc.pptx"
32− "end notes"
60+ , pptxTests "end notes"
34− "pptx/endnotes.native"
62+ "pptx/endnotes.native"
35− "pptx/endnotes.pptx"
63+ "pptx/endnotes.pptx"
37− "end notes, with table of contents"
64+ , pptxTests "end notes, with table of contents"
38− def { writerTableOfContents = True }
65+ def { writerTableOfContents = True }
39− "pptx/endnotes.native"
66+ "pptx/endnotes.native"
40− "pptx/endnotes_toc.pptx"
67+ "pptx/endnotes_toc.pptx"
42− "images"
68+ , pptxTests "images"
44− "pptx/images.native"
70+ "pptx/images.native"
45− "pptx/images.pptx"
71+ "pptx/images.pptx"
47− "two-column layout"
72+ , pptxTests "two-column layout"
49− "pptx/two_column.native"
74+ "pptx/two_column.native"
50− "pptx/two_column.pptx"
75+ "pptx/two_column.pptx"
52− "speaker notes"
76+ , pptxTests "speaker notes"
54− "pptx/speaker_notes.native"
78+ "pptx/speaker_notes.native"
55− "pptx/speaker_notes.pptx"
79+ "pptx/speaker_notes.pptx"