summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Tests/Writers/Powerpoint.hs120
-rw-r--r--test/pptx/endnotes_templated.pptxbin0 -> 394003 bytes
-rw-r--r--test/pptx/endnotes_toc_templated.pptxbin0 -> 394926 bytes
-rw-r--r--test/pptx/images_templated.pptxbin0 -> 411657 bytes
-rw-r--r--test/pptx/inline_formatting_templated.pptxbin0 -> 393163 bytes
-rw-r--r--test/pptx/reference_depth.pptxbin0 -> 397502 bytes
-rw-r--r--test/pptx/slide_breaks_slide_level_1_templated.pptxbin0 -> 394785 bytes
-rw-r--r--test/pptx/slide_breaks_templated.pptxbin0 -> 395614 bytes
-rw-r--r--test/pptx/slide_breaks_toc_templated.pptxbin0 -> 396572 bytes
-rw-r--r--test/pptx/speaker_notes_templated.pptxbin0 -> 402475 bytes
-rw-r--r--test/pptx/two_column_templated.pptxbin0 -> 393106 bytes
11 files changed, 72 insertions, 48 deletions
diff --git a/test/Tests/Writers/Powerpoint.hs b/test/Tests/Writers/Powerpoint.hs
index 621b4fe2f..fc5f9accc 100644
--- a/test/Tests/Writers/Powerpoint.hs
+++ b/test/Tests/Writers/Powerpoint.hs
@@ -3,54 +3,78 @@ module Tests.Writers.Powerpoint (tests) where
import Tests.Writers.OOXML (ooxmlTest)
import Text.Pandoc
import Test.Tasty
+import System.FilePath
+
+-- templating is important enough, and can break enough things, that
+-- we want to run all our tests with both default formatting and a
+-- template.
+
+modifyPptxName :: FilePath -> FilePath
+modifyPptxName fp =
+ addExtension (dropExtension fp ++ "_templated") "pptx"
+
+pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree)
+pptxTests name opts native pptx =
+ let referenceDoc = "pptx/reference_depth.pptx"
+ in
+ ( ooxmlTest
+ writePowerpoint
+ name
+ opts{writerReferenceDoc=Nothing}
+ native
+ pptx
+ , ooxmlTest
+ writePowerpoint
+ name
+ opts{writerReferenceDoc=Just referenceDoc}
+ native
+ (modifyPptxName pptx)
+ )
+
+groupPptxTests :: [(TestTree, TestTree)] -> [TestTree]
+groupPptxTests pairs =
+ let (noRefs, refs) = unzip pairs
+ in
+ [ testGroup "Default slide formatting" noRefs
+ , testGroup "With `--reference-doc` pptx file" refs
+ ]
-pptxTest :: String -> WriterOptions -> FilePath -> FilePath -> TestTree
-pptxTest = ooxmlTest writePowerpoint
tests :: [TestTree]
-tests = [ pptxTest
- "Inline formatting"
- def
- "pptx/inline_formatting.native"
- "pptx/inline_formatting.pptx"
- , pptxTest
- "Slide breaks (default slide-level)"
- def
- "pptx/slide_breaks.native"
- "pptx/slide_breaks.pptx"
- , pptxTest
- "slide breaks (slide-level set to 1)"
- def{ writerSlideLevel = Just 1 }
- "pptx/slide_breaks.native"
- "pptx/slide_breaks_slide_level_1.pptx"
- , pptxTest
- "table of contents"
- def{ writerTableOfContents = True }
- "pptx/slide_breaks.native"
- "pptx/slide_breaks_toc.pptx"
- , pptxTest
- "end notes"
- def
- "pptx/endnotes.native"
- "pptx/endnotes.pptx"
- , pptxTest
- "end notes, with table of contents"
- def { writerTableOfContents = True }
- "pptx/endnotes.native"
- "pptx/endnotes_toc.pptx"
- , pptxTest
- "images"
- def
- "pptx/images.native"
- "pptx/images.pptx"
- , pptxTest
- "two-column layout"
- def
- "pptx/two_column.native"
- "pptx/two_column.pptx"
- , pptxTest
- "speaker notes"
- def
- "pptx/speaker_notes.native"
- "pptx/speaker_notes.pptx"
- ]
+tests = groupPptxTests [ pptxTests "Inline formatting"
+ def
+ "pptx/inline_formatting.native"
+ "pptx/inline_formatting.pptx"
+ , pptxTests "Slide breaks (default slide-level)"
+ def
+ "pptx/slide_breaks.native"
+ "pptx/slide_breaks.pptx"
+ , pptxTests "slide breaks (slide-level set to 1)"
+ def{ writerSlideLevel = Just 1 }
+ "pptx/slide_breaks.native"
+ "pptx/slide_breaks_slide_level_1.pptx"
+ , pptxTests "table of contents"
+ def{ writerTableOfContents = True }
+ "pptx/slide_breaks.native"
+ "pptx/slide_breaks_toc.pptx"
+ , pptxTests "end notes"
+ def
+ "pptx/endnotes.native"
+ "pptx/endnotes.pptx"
+ , pptxTests "end notes, with table of contents"
+ def { writerTableOfContents = True }
+ "pptx/endnotes.native"
+ "pptx/endnotes_toc.pptx"
+ , pptxTests "images"
+ def
+ "pptx/images.native"
+ "pptx/images.pptx"
+ , pptxTests "two-column layout"
+ def
+ "pptx/two_column.native"
+ "pptx/two_column.pptx"
+ , pptxTests "speaker notes"
+ def
+ "pptx/speaker_notes.native"
+ "pptx/speaker_notes.pptx"
+ ]
diff --git a/test/pptx/endnotes_templated.pptx b/test/pptx/endnotes_templated.pptx
new file mode 100644
index 000000000..51501ec8c
--- /dev/null
+++ b/test/pptx/endnotes_templated.pptx
Binary files differ
diff --git a/test/pptx/endnotes_toc_templated.pptx b/test/pptx/endnotes_toc_templated.pptx
new file mode 100644
index 000000000..77cd3ba58
--- /dev/null
+++ b/test/pptx/endnotes_toc_templated.pptx
Binary files differ
diff --git a/test/pptx/images_templated.pptx b/test/pptx/images_templated.pptx
new file mode 100644
index 000000000..76825e891
--- /dev/null
+++ b/test/pptx/images_templated.pptx
Binary files differ
diff --git a/test/pptx/inline_formatting_templated.pptx b/test/pptx/inline_formatting_templated.pptx
new file mode 100644
index 000000000..ca44d82e6
--- /dev/null
+++ b/test/pptx/inline_formatting_templated.pptx
Binary files differ
diff --git a/test/pptx/reference_depth.pptx b/test/pptx/reference_depth.pptx
new file mode 100644
index 000000000..6906cf49d
--- /dev/null
+++ b/test/pptx/reference_depth.pptx
Binary files differ
diff --git a/test/pptx/slide_breaks_slide_level_1_templated.pptx b/test/pptx/slide_breaks_slide_level_1_templated.pptx
new file mode 100644
index 000000000..3e0009c76
--- /dev/null
+++ b/test/pptx/slide_breaks_slide_level_1_templated.pptx
Binary files differ
diff --git a/test/pptx/slide_breaks_templated.pptx b/test/pptx/slide_breaks_templated.pptx
new file mode 100644
index 000000000..6df99735d
--- /dev/null
+++ b/test/pptx/slide_breaks_templated.pptx
Binary files differ
diff --git a/test/pptx/slide_breaks_toc_templated.pptx b/test/pptx/slide_breaks_toc_templated.pptx
new file mode 100644
index 000000000..472f41cf4
--- /dev/null
+++ b/test/pptx/slide_breaks_toc_templated.pptx
Binary files differ
diff --git a/test/pptx/speaker_notes_templated.pptx b/test/pptx/speaker_notes_templated.pptx
new file mode 100644
index 000000000..9ae8ea1db
--- /dev/null
+++ b/test/pptx/speaker_notes_templated.pptx
Binary files differ
diff --git a/test/pptx/two_column_templated.pptx b/test/pptx/two_column_templated.pptx
new file mode 100644
index 000000000..f74be1956
--- /dev/null
+++ b/test/pptx/two_column_templated.pptx
Binary files differ