sd/qa/unit/misc-tests.cxx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
New commits: commit 222c6a34618178f6a6b170c0fe48acbe12f57a24 Author: Mohit Marathe <[email protected]> AuthorDate: Mon Dec 15 15:16:34 2025 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Tue Jan 13 20:12:54 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/+/196823 Tested-by: Jenkins diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index bcfbb55677a0..9da73ca3384d 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(TestFilter::ODP); + + // 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();
