diff options
| author | Tuong Nguyen Manh <[email protected]> | 2025-11-30 13:17:34 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-30 13:17:34 +0100 |
| commit | 6592dfb0821b5674df2851ab031ed6eaca7d4c8f (patch) | |
| tree | 55a95bfa517557983082236da72489fa24ae1495 /test | |
| parent | 176d9be0f3248eba25779b60edc5d01db25dc084 (diff) | |
pptx writer: Handle reference doc without slides (#11310)
An empty `sldIdLst` is now added if the reference doc is missing one so that
`modifySldIdLst` can replace it. To ensure PowerPoint doesn't say that the file
will need fixing, the `sldIdLst` has to be placed after the `sldMasterIdLst`.
I also added a test to ensure that if there are notes, they will be placed between
the `sldMasterIdLst` and `sldIdLst`. Otherwise PowerPoint wouldn't show the
slide of a note when viewing Notes Pages.
Closes #7536.
Diffstat (limited to 'test')
| -rw-r--r-- | test/Tests/Writers/Powerpoint.hs | 12 | ||||
| -rw-r--r-- | test/pptx/reference-no-slides.pptx | bin | 0 -> 30988 bytes | |||
| -rw-r--r-- | test/pptx/reference-no-slides/add-slides/input.native | 14 | ||||
| -rw-r--r-- | test/pptx/reference-no-slides/add-slides/output.pptx | bin | 0 -> 28888 bytes | |||
| -rw-r--r-- | test/pptx/reference-no-slides/with-notes/input.native | 70 | ||||
| -rw-r--r-- | test/pptx/reference-no-slides/with-notes/output.pptx | bin | 0 -> 33927 bytes |
6 files changed, 96 insertions, 0 deletions
diff --git a/test/Tests/Writers/Powerpoint.hs b/test/Tests/Writers/Powerpoint.hs index ab8b49314..35269205b 100644 --- a/test/Tests/Writers/Powerpoint.hs +++ b/test/Tests/Writers/Powerpoint.hs @@ -276,5 +276,17 @@ tests = let def {writerReferenceDoc = Just "pptx/reference-deleted-layouts.pptx"} "pptx/layouts/input.native" "pptx/layouts/deleted.pptx" + , ooxmlTest + writePowerpoint + "Slides can be missing from the reference doc" + def {writerReferenceDoc = Just "pptx/reference-no-slides.pptx"} + "pptx/reference-no-slides/add-slides/input.native" + "pptx/reference-no-slides/add-slides/output.pptx" + , ooxmlTest + writePowerpoint + "Notes are placed at the right position with a reference doc without slides" + def {writerReferenceDoc = Just "pptx/reference-no-slides.pptx"} + "pptx/reference-no-slides/with-notes/input.native" + "pptx/reference-no-slides/with-notes/output.pptx" ] in regularTests <> referenceSpecificTests diff --git a/test/pptx/reference-no-slides.pptx b/test/pptx/reference-no-slides.pptx Binary files differnew file mode 100644 index 000000000..2c4d77184 --- /dev/null +++ b/test/pptx/reference-no-slides.pptx diff --git a/test/pptx/reference-no-slides/add-slides/input.native b/test/pptx/reference-no-slides/add-slides/input.native new file mode 100644 index 000000000..de1250533 --- /dev/null +++ b/test/pptx/reference-no-slides/add-slides/input.native @@ -0,0 +1,14 @@ +[ Header + 2 + ( "first-slide" , [] , [] ) + [ Str "First" , Space , Str "Slide" ] +, Para [ Str "Title" ] +, Header + 2 + ( "second-slide" , [] , [] ) + [ Str "Second" , Space , Str "Slide" ] +, BulletList + [ [ Plain [ Str "First" , Space , Str "item" ] ] + , [ Plain [ Str "Second" , Space , Str "item" ] ] + ] +] diff --git a/test/pptx/reference-no-slides/add-slides/output.pptx b/test/pptx/reference-no-slides/add-slides/output.pptx Binary files differnew file mode 100644 index 000000000..35c0c5869 --- /dev/null +++ b/test/pptx/reference-no-slides/add-slides/output.pptx diff --git a/test/pptx/reference-no-slides/with-notes/input.native b/test/pptx/reference-no-slides/with-notes/input.native new file mode 100644 index 000000000..f671a2b0b --- /dev/null +++ b/test/pptx/reference-no-slides/with-notes/input.native @@ -0,0 +1,70 @@ +[ Header + 2 + ( "first-slide" , [] , [] ) + [ Str "First" , Space , Str "Slide" ] +, Para + [ Str "First" + , Space + , Str "slide" + , Space + , Str "with" + , Space + , Str "notes" + ] +, Div + ( "" , [ "notes" ] , [] ) + [ Para + [ Str "Notes" + , Space + , Str "for" + , Space + , Str "the" + , Space + , Str "first" + , Space + , Str "slide" + ] + ] +, Header + 2 + ( "second-slide" , [] , [] ) + [ Str "Second" , Space , Str "Slide" ] +, Para + [ Str "Slide" + , Space + , Str "without" + , Space + , Str "notes" + ] +, Header + 2 + ( "third-slide" , [] , [] ) + [ Str "Third" , Space , Str "Slide" ] +, Para + [ Str "Slide" + , Space + , Str "with" + , Space + , Str "notes" + , Space + , Str "again" + ] +, BulletList + [ [ Plain [ Str "First" , Space , Str "item" ] ] + , [ Plain [ Str "Second" , Space , Str "item" ] ] + ] +, Div + ( "" , [ "notes" ] , [] ) + [ Para + [ Str "Notes" + , Space + , Str "for" + , Space + , Str "the" + , Space + , Str "third" + , Space + , Str "slides" + ] + ] +] diff --git a/test/pptx/reference-no-slides/with-notes/output.pptx b/test/pptx/reference-no-slides/with-notes/output.pptx Binary files differnew file mode 100644 index 000000000..448d866bf --- /dev/null +++ b/test/pptx/reference-no-slides/with-notes/output.pptx |
