pptx: Remove excessive layout tests

When I added the tests for moved layouts and deleted layouts, I added
them to all tests. However, this doesn’t really give a lot more info
than having single tests, and the extra tests take up time and disk
space.

This commit removes the moved-layouts and deleted-layouts tests, in
favour of a single test for each of those scenarios.
This commit is contained in:
Emily Bourke 2021-10-07 15:25:15 +01:00 committed by John MacFarlane
parent 5a1bd52677
commit aa78765bf9
82 changed files with 38 additions and 20 deletions

View file

@ -7,7 +7,6 @@ import System.FilePath
import Text.DocTemplates (ToContext(toVal), Context(..))
import qualified Data.Map as M
import Data.Text (pack)
import Data.List (unzip4)
-- templating is important enough, and can break enough things, that
-- we want to run all our tests with both default formatting and a
@ -17,11 +16,9 @@ modifyPptxName :: FilePath -> String -> FilePath
modifyPptxName fp suffix =
addExtension (takeDirectory fp ++ suffix) "pptx"
pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree, TestTree, TestTree)
pptxTests :: String -> WriterOptions -> FilePath -> FilePath -> (TestTree, TestTree)
pptxTests name opts native pptx =
let referenceDoc = "pptx/reference-depth.pptx"
movedLayoutsReferenceDoc = "pptx/reference-moved-layouts.pptx"
deletedLayoutsReferenceDoc = "pptx/reference-deleted-layouts.pptx"
in
( ooxmlTest
writePowerpoint
@ -35,28 +32,14 @@ pptxTests name opts native pptx =
opts{writerReferenceDoc=Just referenceDoc}
native
(modifyPptxName pptx "/templated")
, ooxmlTest
writePowerpoint
name
opts{writerReferenceDoc=Just movedLayoutsReferenceDoc}
native
(modifyPptxName pptx "/moved-layouts")
, ooxmlTest
writePowerpoint
name
opts{writerReferenceDoc=Just deletedLayoutsReferenceDoc}
native
(modifyPptxName pptx "/deleted-layouts")
)
groupPptxTests :: [(TestTree, TestTree, TestTree, TestTree)] -> [TestTree]
groupPptxTests :: [(TestTree, TestTree)] -> [TestTree]
groupPptxTests pairs =
let (noRefs, refs, movedLayouts, deletedLayouts) = unzip4 pairs
let (noRefs, refs) = unzip pairs
in
[ testGroup "Default slide formatting" noRefs
, testGroup "With `--reference-doc` pptx file" refs
, testGroup "With layouts in reference doc moved" movedLayouts
, testGroup "With layouts in reference doc deleted" deletedLayouts
]
@ -272,5 +255,17 @@ tests = let
def { writerReferenceDoc = Just "pptx/footer/higher-slide-number/reference.pptx"}
"pptx/footer/input.native"
"pptx/footer/higher-slide-number/output.pptx"
, ooxmlTest
writePowerpoint
"Layouts can be moved around in reference doc"
def {writerReferenceDoc = Just "pptx/reference-moved-layouts.pptx"}
"pptx/layouts/input.native"
"pptx/layouts/moved.pptx"
, ooxmlTest
writePowerpoint
"Layouts can be missing from the reference doc"
def {writerReferenceDoc = Just "pptx/reference-deleted-layouts.pptx"}
"pptx/layouts/input.native"
"pptx/layouts/deleted.pptx"
]
in regularTests <> referenceSpecificTests

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,23 @@
Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "Testing",Space,Str "Layouts"])]})
[Header 2 ("slide-1",[],[]) [Str "Slide",Space,Str "1"]
,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "title",Space,Str "and",Space,Str "content",Space,Str "slide"]
,Header 2 ("slide-2",[],[]) [Str "Slide",Space,Str "2"]
,Div ("",["columns"],[])
[Div ("",["column"],[])
[Para [Str "This"]]
,Div ("",["column"],[])
[Para [Str "\8230is",Space,Str "a",Space,Str "two-column",Space,Str "slide"]]]
,Header 2 ("slide-3",[],[]) [Str "Slide",Space,Str "3"]
,Para [Str "This",Space,Str "slide",Space,Str "is",Space,Str "a",Space,Str "Content",Space,Str "with",Space,Str "Caption",Space,Str "slide"]
,Para [Image ("",[],[]) [Str "Content"] ("lalune.jpg","fig:")]
,Header 2 ("slide-4",[],[]) [Str "Slide",Space,Str "4"]
,Div ("",["columns"],[])
[Div ("",["column"],[])
[Para [Str "This",Space,Str "slide",Space,Str "is",Space,Str "a",Space,Str "Comparison",Space,Str "slide:"]
,Para [Image ("",[],[]) [Str "Content"] ("lalune.jpg","fig:")]]
,Div ("",["column"],[])
[Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "other",Space,Str "text"]]]
,Header 1 ("section-header",[],[]) [Str "Section",Space,Str "header"]
,Header 2 ("section",[],[]) []
,Div ("",["notes"],[])
[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "blank",Space,Str "slide"]]]

Binary file not shown.

Binary file not shown.

Binary file not shown.