sd/qa/unit/misc-tests.cxx |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

New commits:
commit c9022ce00e75e4696f6d86ed732baee793683c84
Author:     Mohit Marathe <[email protected]>
AuthorDate: Mon Dec 15 15:16:34 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Wed Dec 17 13:13:57 2025 +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]>

diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index a50461ec119c..bd416356a4bc 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -96,6 +96,7 @@ public:
     void testEncodedTableStyles();
     void testTdf157117();
     void testPageBackgroundImages();
+    void testCanvasSlideExportODP();
 
     CPPUNIT_TEST_SUITE(SdMiscTest);
     CPPUNIT_TEST(testTdf99396);
@@ -123,6 +124,7 @@ public:
     CPPUNIT_TEST(testEncodedTableStyles);
     CPPUNIT_TEST(testTdf157117);
     CPPUNIT_TEST(testPageBackgroundImages);
+    CPPUNIT_TEST(testCanvasSlideExportODP);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1237,6 +1239,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