pptx: Restructure tests

- Use dashes consistently rather than underscores
- Make a folder for each set of tests
- List test files explicitly (Cabal doesn’t support ** until version
  2.4)
This commit is contained in:
Emily Bourke 2021-08-25 14:35:19 +01:00 committed by John MacFarlane
parent 0617d3a88b
commit 8dbea49092
126 changed files with 111 additions and 58 deletions

View file

@ -380,7 +380,60 @@ extra-source-files:
test/rtf/*.native test/rtf/*.native
test/rtf/*.rtf test/rtf/*.rtf
test/pptx/*.pptx test/pptx/*.pptx
test/pptx/*.native test/pptx/code-custom/*.pptx
test/pptx/code/input.native
test/pptx/code/*.pptx
test/pptx/comparison-both-columns/input.native
test/pptx/comparison-both-columns/*.pptx
test/pptx/comparison-extra-text/input.native
test/pptx/comparison-extra-text/*.pptx
test/pptx/comparison-non-text-first/input.native
test/pptx/comparison-non-text-first/*.pptx
test/pptx/comparison-one-column/input.native
test/pptx/comparison-one-column/*.pptx
test/pptx/document-properties-short-desc/input.native
test/pptx/document-properties-short-desc/*.pptx
test/pptx/document-properties/input.native
test/pptx/document-properties/*.pptx
test/pptx/endnotes-toc/*.pptx
test/pptx/endnotes/input.native
test/pptx/endnotes/*.pptx
test/pptx/images/input.native
test/pptx/images/*.pptx
test/pptx/inline-formatting/input.native
test/pptx/inline-formatting/*.pptx
test/pptx/lists/input.native
test/pptx/lists/*.pptx
test/pptx/raw-ooxml/input.native
test/pptx/raw-ooxml/*.pptx
test/pptx/remove-empty-slides/input.native
test/pptx/remove-empty-slides/*.pptx
test/pptx/slide-breaks-slide-level-1/*.pptx
test/pptx/slide-breaks-toc/*.pptx
test/pptx/slide-breaks/input.native
test/pptx/slide-breaks/*.pptx
test/pptx/slide-level-0/h1-h2-with-table/input.native
test/pptx/slide-level-0/h1-h2-with-table/*.pptx
test/pptx/slide-level-0/h1-with-image/input.native
test/pptx/slide-level-0/h1-with-image/*.pptx
test/pptx/slide-level-0/h1-with-table/input.native
test/pptx/slide-level-0/h1-with-table/*.pptx
test/pptx/slide-level-0/h2-with-image/input.native
test/pptx/slide-level-0/h2-with-image/*.pptx
test/pptx/speaker-notes-after-metadata/input.native
test/pptx/speaker-notes-after-metadata/*.pptx
test/pptx/speaker-notes-afterheader/input.native
test/pptx/speaker-notes-afterheader/*.pptx
test/pptx/speaker-notes-afterseps/input.native
test/pptx/speaker-notes-afterseps/*.pptx
test/pptx/speaker-notes/input.native
test/pptx/speaker-notes/*.pptx
test/pptx/start-numbering-at/input.native
test/pptx/start-numbering-at/*.pptx
test/pptx/tables/input.native
test/pptx/tables/*.pptx
test/pptx/two-column/input.native
test/pptx/two-column/*.pptx
test/ipynb/*.in.native test/ipynb/*.in.native
test/ipynb/*.out.native test/ipynb/*.out.native
test/ipynb/*.ipynb test/ipynb/*.ipynb

View file

@ -15,13 +15,13 @@ import Data.List (unzip4)
modifyPptxName :: FilePath -> String -> FilePath modifyPptxName :: FilePath -> String -> FilePath
modifyPptxName fp suffix = modifyPptxName fp suffix =
addExtension (dropExtension fp ++ suffix) "pptx" addExtension (takeDirectory fp ++ suffix) "pptx"
pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree, TestTree, TestTree) pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree, TestTree, TestTree)
pptxTests name opts native pptx = pptxTests name opts native pptx =
let referenceDoc = "pptx/reference_depth.pptx" let referenceDoc = "pptx/reference-depth.pptx"
movedLayoutsReferenceDoc = "pptx/reference_moved_layouts.pptx" movedLayoutsReferenceDoc = "pptx/reference-moved-layouts.pptx"
deletedLayoutsReferenceDoc = "pptx/reference_deleted_layouts.pptx" deletedLayoutsReferenceDoc = "pptx/reference-deleted-layouts.pptx"
in in
( ooxmlTest ( ooxmlTest
writePowerpoint writePowerpoint
@ -34,19 +34,19 @@ pptxTests name opts native pptx =
name name
opts{writerReferenceDoc=Just referenceDoc} opts{writerReferenceDoc=Just referenceDoc}
native native
(modifyPptxName pptx "_templated") (modifyPptxName pptx "/templated")
, ooxmlTest , ooxmlTest
writePowerpoint writePowerpoint
name name
opts{writerReferenceDoc=Just movedLayoutsReferenceDoc} opts{writerReferenceDoc=Just movedLayoutsReferenceDoc}
native native
(modifyPptxName pptx "_moved_layouts") (modifyPptxName pptx "/moved-layouts")
, ooxmlTest , ooxmlTest
writePowerpoint writePowerpoint
name name
opts{writerReferenceDoc=Just deletedLayoutsReferenceDoc} opts{writerReferenceDoc=Just deletedLayoutsReferenceDoc}
native native
(modifyPptxName pptx "_deleted_layouts") (modifyPptxName pptx "/deleted-layouts")
) )
groupPptxTests :: [(TestTree, TestTree, TestTree, TestTree)] -> [TestTree] groupPptxTests :: [(TestTree, TestTree, TestTree, TestTree)] -> [TestTree]
@ -63,112 +63,112 @@ groupPptxTests pairs =
tests :: [TestTree] tests :: [TestTree]
tests = groupPptxTests [ pptxTests "Inline formatting" tests = groupPptxTests [ pptxTests "Inline formatting"
def def
"pptx/inline_formatting.native" "pptx/inline-formatting/input.native"
"pptx/inline_formatting.pptx" "pptx/inline-formatting/output.pptx"
, pptxTests "Slide breaks (default slide-level)" , pptxTests "Slide breaks (default slide-level)"
def def
"pptx/slide_breaks.native" "pptx/slide-breaks/input.native"
"pptx/slide_breaks.pptx" "pptx/slide-breaks/output.pptx"
, pptxTests "slide breaks (slide-level set to 1)" , pptxTests "slide breaks (slide-level set to 1)"
def{ writerSlideLevel = Just 1 } def{ writerSlideLevel = Just 1 }
"pptx/slide_breaks.native" "pptx/slide-breaks/input.native"
"pptx/slide_breaks_slide_level_1.pptx" "pptx/slide-breaks-slide-level-1/output.pptx"
, pptxTests "lists" , pptxTests "lists"
def def
"pptx/lists.native" "pptx/lists/input.native"
"pptx/lists.pptx" "pptx/lists/output.pptx"
, pptxTests "start ordered list at specified num" , pptxTests "start ordered list at specified num"
def def
"pptx/start_numbering_at.native" "pptx/start-numbering-at/input.native"
"pptx/start_numbering_at.pptx" "pptx/start-numbering-at/output.pptx"
, pptxTests "tables" , pptxTests "tables"
def def
"pptx/tables.native" "pptx/tables/input.native"
"pptx/tables.pptx" "pptx/tables/output.pptx"
, pptxTests "table of contents" , pptxTests "table of contents"
def{ writerTableOfContents = True } def{ writerTableOfContents = True }
"pptx/slide_breaks.native" "pptx/slide-breaks/input.native"
"pptx/slide_breaks_toc.pptx" "pptx/slide-breaks-toc/output.pptx"
, pptxTests "end notes" , pptxTests "end notes"
def def
"pptx/endnotes.native" "pptx/endnotes/input.native"
"pptx/endnotes.pptx" "pptx/endnotes/output.pptx"
, pptxTests "end notes, with table of contents" , pptxTests "end notes, with table of contents"
def { writerTableOfContents = True } def { writerTableOfContents = True }
"pptx/endnotes.native" "pptx/endnotes/input.native"
"pptx/endnotes_toc.pptx" "pptx/endnotes-toc/output.pptx"
, pptxTests "images" , pptxTests "images"
def def
"pptx/images.native" "pptx/images/input.native"
"pptx/images.pptx" "pptx/images/output.pptx"
, pptxTests "two-column layout" , pptxTests "two-column layout"
def def
"pptx/two_column.native" "pptx/two-column/input.native"
"pptx/two_column.pptx" "pptx/two-column/output.pptx"
, pptxTests "speaker notes" , pptxTests "speaker notes"
def def
"pptx/speaker_notes.native" "pptx/speaker-notes/input.native"
"pptx/speaker_notes.pptx" "pptx/speaker-notes/output.pptx"
, pptxTests "speaker notes after a separating block" , pptxTests "speaker notes after a separating block"
def def
"pptx/speaker_notes_afterseps.native" "pptx/speaker-notes-afterseps/input.native"
"pptx/speaker_notes_afterseps.pptx" "pptx/speaker-notes-afterseps/output.pptx"
, pptxTests "speaker notes after a separating header" , pptxTests "speaker notes after a separating header"
def def
"pptx/speaker_notes_afterheader.native" "pptx/speaker-notes-afterheader/input.native"
"pptx/speaker_notes_afterheader.pptx" "pptx/speaker-notes-afterheader/output.pptx"
, pptxTests "speaker notes after metadata" , pptxTests "speaker notes after metadata"
def def
"pptx/speaker_notes_after_metadata.native" "pptx/speaker-notes-after-metadata/input.native"
"pptx/speaker_notes_after_metadata.pptx" "pptx/speaker-notes-after-metadata/output.pptx"
, pptxTests "remove empty slides" , pptxTests "remove empty slides"
def def
"pptx/remove_empty_slides.native" "pptx/remove-empty-slides/input.native"
"pptx/remove_empty_slides.pptx" "pptx/remove-empty-slides/output.pptx"
, pptxTests "raw ooxml" , pptxTests "raw ooxml"
def def
"pptx/raw_ooxml.native" "pptx/raw-ooxml/input.native"
"pptx/raw_ooxml.pptx" "pptx/raw-ooxml/output.pptx"
, pptxTests "metadata, custom properties" , pptxTests "metadata, custom properties"
def def
"pptx/document-properties.native" "pptx/document-properties/input.native"
"pptx/document-properties.pptx" "pptx/document-properties/output.pptx"
, pptxTests "metadata, short description" , pptxTests "metadata, short description"
def def
"pptx/document-properties-short-desc.native" "pptx/document-properties-short-desc/input.native"
"pptx/document-properties-short-desc.pptx" "pptx/document-properties-short-desc/output.pptx"
, pptxTests "inline code and code blocks" , pptxTests "inline code and code blocks"
def def
"pptx/code.native" "pptx/code/input.native"
"pptx/code.pptx" "pptx/code/output.pptx"
, pptxTests "inline code and code blocks, custom formatting" , pptxTests "inline code and code blocks, custom formatting"
def { writerVariables = Context $ M.fromList def { writerVariables = Context $ M.fromList
[(pack "monofont", toVal $ pack "Consolas")] } [(pack "monofont", toVal $ pack "Consolas")] }
"pptx/code.native" "pptx/code/input.native"
"pptx/code-custom.pptx" "pptx/code-custom/output.pptx"
, pptxTests ("Using slide level 0, if the first thing on " , pptxTests ("Using slide level 0, if the first thing on "
<> "a slide is a h1 it's used as the " <> "a slide is a h1 it's used as the "
<> "slide title") <> "slide title")
def { writerSlideLevel = Just 0 } def { writerSlideLevel = Just 0 }
"pptx/slide-level-0-h1-with-image.native" "pptx/slide-level-0/h1-with-image/input.native"
"pptx/slide-level-0-h1-with-image.pptx" "pptx/slide-level-0/h1-with-image/output.pptx"
, pptxTests ("Using slide level 0, if the first thing on " , pptxTests ("Using slide level 0, if the first thing on "
<> "a slide is a h2 it's used as the " <> "a slide is a h2 it's used as the "
<> "slide title") <> "slide title")
def { writerSlideLevel = Just 0 } def { writerSlideLevel = Just 0 }
"pptx/slide-level-0-h2-with-image.native" "pptx/slide-level-0/h2-with-image/input.native"
"pptx/slide-level-0-h2-with-image.pptx" "pptx/slide-level-0/h2-with-image/output.pptx"
, pptxTests ("Using slide level 0, if the first thing on " , pptxTests ("Using slide level 0, if the first thing on "
<> "a slide is a heading it's used as the " <> "a slide is a heading it's used as the "
<> "slide title (works with a table)") <> "slide title (works with a table)")
def { writerSlideLevel = Just 0 } def { writerSlideLevel = Just 0 }
"pptx/slide-level-0-h1-with-table.native" "pptx/slide-level-0/h1-with-table/input.native"
"pptx/slide-level-0-h1-with-table.pptx" "pptx/slide-level-0/h1-with-table/output.pptx"
, pptxTests ("Using slide level 0, if the first thing on " , pptxTests ("Using slide level 0, if the first thing on "
<> "a slide is a heading it's used as the " <> "a slide is a heading it's used as the "
<> "slide title (two headings forces a " <> "slide title (two headings forces a "
<> "slide break though)") <> "slide break though)")
def { writerSlideLevel = Just 0 } def { writerSlideLevel = Just 0 }
"pptx/slide-level-0-h1-h2-with-table.native" "pptx/slide-level-0/h1-h2-with-table/input.native"
"pptx/slide-level-0-h1-h2-with-table.pptx" "pptx/slide-level-0/h1-h2-with-table/output.pptx"
] ]

Some files were not shown because too many files have changed in this diff Show more