diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index b1fc22e16ef2..560fc32585a5 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -1381,6 +1383,52 @@ DECLARE_ODFEXPORT_TEST(testTextFrameVertAdjust, "textframe-vertadjust.odt") CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty(xFrame, u"TextVerticalAdjust"_ustr)); } +CPPUNIT_TEST_FIXTURE(Test, testTdf69500) +{ + createSwDoc(); + + static constexpr OUString sToolBarName = u"private:resource/toolbar/custom_toolbar_1"_ustr; + + auto getUIConfigManager = [this]() { + css::uno::Reference xContext + = comphelper::getProcessComponentContext(); + uno::Reference xModel(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT(xModel.is()); + uno::Reference xConfigSupplier(xModel, uno::UNO_QUERY); + CPPUNIT_ASSERT(xConfigSupplier.is()); + uno::Reference xConfigManager + = xConfigSupplier->getUIConfigurationManager(); + return xConfigManager; + }; + + // Create and persist a custom toolbar to the document + { + uno::Reference xConfigManager = getUIConfigManager(); + + uno::Reference xIndexContainer(xConfigManager->createSettings(), + uno::UNO_SET_THROW); + uno::Reference xIndexAccess(xIndexContainer, uno::UNO_QUERY_THROW); + uno::Reference xProps(xIndexContainer, uno::UNO_QUERY_THROW); + + xProps->setPropertyValue(u"UIName"_ustr, uno::Any(u"Custom Toolbar 1"_ustr)); + + xConfigManager->insertSettings(sToolBarName, xIndexAccess); + + uno::Reference xPersistence(xConfigManager, + uno::UNO_QUERY_THROW); + xPersistence->store(); + } + + saveAndReload(mpFilter); + + // Without the fix, the toolbar will be gone after save-and-reload + { + uno::Reference xConfigManager = getUIConfigManager(); + + CPPUNIT_ASSERT(xConfigManager->hasSettings(sToolBarName)); + } +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */