sd/qa/unit/data/odp/canvas-slide.odp |binary
 sd/qa/unit/export-tests-ooxml4.cxx   |   22 ++++++++++++++++++++++
 sd/qa/unit/misc-tests.cxx            |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)

New commits:
commit f5e78d746d4e97c74fbf5ae56f65d88670b5c741
Author:     Mohit Marathe <[email protected]>
AuthorDate: Mon Dec 15 16:58:22 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 08:57:44 2026 +0100

    sd: add testOmitCanvasSlideExport
    
    This unit test verifies if canvas page is omitted while exporting
    to pptx
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I3a269499772306c33998b33524376aa329c15273
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195658
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196723

diff --git a/sd/qa/unit/data/odp/canvas-slide.odp 
b/sd/qa/unit/data/odp/canvas-slide.odp
new file mode 100644
index 000000000000..f73114937e6f
Binary files /dev/null and b/sd/qa/unit/data/odp/canvas-slide.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx 
b/sd/qa/unit/export-tests-ooxml4.cxx
index 721d78a721e1..fe212fdc4f22 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -8,6 +8,7 @@
  */
 
 #include "sdmodeltestbase.hxx"
+#include "test/unoapi_test.hxx"
 #include <tools/color.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <editeng/eeitem.hxx>
@@ -1890,6 +1891,27 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf169559)
         pXmlDoc,
         
"/p:sldMaster/p:cSld/p:spTree/p:sp[2]/p:txBody/a:lstStyle/a:lvl1pPr/a:spcAft/a:spcPts",
         "val", u"1701");
+
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testOmitCanvasSlideExport)
+{
+    createSdImpressDoc("odp/canvas-slide.odp");
+
+    SdXImpressDocument* pXImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pXImpressDocument);
+    SdDrawDocument* pDoc = pXImpressDocument->GetDoc();
+    CPPUNIT_ASSERT_MESSAGE("no document", pDoc != nullptr);
+
+    // the document has 2 pages - one canvas page, and one normal page
+    CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), 
pDoc->GetSdPageCount(PageKind::Standard));
+    CPPUNIT_ASSERT(pDoc->HasCanvasPage());
+
+    save(TestFilter::PPTX);
+
+    // Verify that the canvas slide was omitted from the export
+    // It should have one master slide, and one slide
+    xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/presentation.xml"_ustr);
+    assertXPath(pXmlDocContent, 
"/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1);
+    assertXPath(pXmlDocContent, "/p:presentation/p:sldIdLst/p:sldId", 1);
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 852124e1915e341bf61481fa6e53bb83b64552d0
Author:     Mohit Marathe <[email protected]>
AuthorDate: Mon Dec 15 15:16:34 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Tue Jan 13 08:57:31 2026 +0100

    sd: add unit test for odp export of canvas slide
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: Id55665f8206546ff766117f53f07c0639b711746
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195652
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196722

diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index df5ba7d5940f..2068ebf5ff13 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -95,6 +95,7 @@ public:
     void testEncodedTableStyles();
     void testTdf157117();
     void testPageBackgroundImages();
+    void testCanvasSlideExportODP();
 
     CPPUNIT_TEST_SUITE(SdMiscTest);
     CPPUNIT_TEST(testTdf99396);
@@ -122,6 +123,7 @@ public:
     CPPUNIT_TEST(testEncodedTableStyles);
     CPPUNIT_TEST(testTdf157117);
     CPPUNIT_TEST(testPageBackgroundImages);
+    CPPUNIT_TEST(testCanvasSlideExportODP);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1236,6 +1238,37 @@ void SdMiscTest::testPageBackgroundImages()
         CPPUNIT_ASSERT(!rName.isEmpty());
 }
 
+void SdMiscTest::testCanvasSlideExportODP()
+{
+    createSdImpressDoc();
+    SdXImpressDocument* pXImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pXImpressDocument);
+
+    // insert canvas page to make a total of 2 pages
+    dispatchCommand(mxComponent, u".uno:InsertCanvasSlide"_ustr, {});
+
+    // assert the document has 2 standard pages
+    SdDrawDocument* pDocument = pXImpressDocument->GetDoc();
+    CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), 
pDocument->GetSdPageCount(PageKind::Standard));
+
+    // saving with config items in settings.xml
+    std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+        comphelper::ConfigurationChanges::create());
+    officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, 
pBatch);
+    pBatch->commit();
+    save(u"impress8"_ustr);
+
+    // Verify if the "HasCanvasPage" item is true
+    xmlDocUniquePtr pXmlDoc = parseExport(u"settings.xml"_ustr);
+    CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc);
+    static constexpr OString 
sPathStart("/office:document-settings/office:settings/"
+                                        
"config:config-item-set[@config:name='ooo:view-settings']/"
+                                        
"config:config-item-map-indexed[@config:name='Views']/"
+                                        "config:config-item-map-entry"_ostr);
+    assertXPathContent(pXmlDoc, sPathStart + 
"/config:config-item[@config:name='HasCanvasPage']",
+                       u"true");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();

Reply via email to