diff options
-rw-r--r-- | include/vcl/builder.hxx | 2 | ||||
-rw-r--r-- | test/source/screenshot_test.cxx | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 6e47c022b844..c649e9904e6a 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -40,6 +40,7 @@ class MessageDialog; class NumericFormatter; class PopupMenu; class SalInstanceBuilder; +class ScreenshotTest; class ScrollBar; class Slider; class DateField; @@ -486,6 +487,7 @@ protected: std::unique_ptr<VclBuilder> m_pUIBuilder; friend class ::SalInstanceBuilder; + friend class ::ScreenshotTest; }; /* diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx index 44c7403fb836..2e7575b0f48d 100644 --- a/test/source/screenshot_test.cxx +++ b/test/source/screenshot_test.cxx @@ -184,19 +184,30 @@ void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription) VclPtrInstance<Dialog> pDialog(Application::GetDefDialogParent(), WB_STDDIALOG | WB_SIZEABLE, Dialog::InitFlag::NoParent); { - VclBuilder aBuilder(pDialog, VclBuilderContainer::getUIRootDir(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8)); - vcl::Window *pRoot = aBuilder.get_widget_root(); + VclPtr<vcl::Window> aOwnedToplevel; + + std::unique_ptr<VclBuilder> xBuilder(new VclBuilder(pDialog, VclBuilderContainer::getUIRootDir(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8))); + vcl::Window *pRoot = xBuilder->get_widget_root(); Dialog *pRealDialog = dynamic_cast<Dialog*>(pRoot); if (!pRealDialog) { pRealDialog = pDialog; } + else + { + aOwnedToplevel.set(pRoot); + xBuilder->drop_ownership(pRoot); + } pRealDialog->SetText(utl::ConfigManager::getProductName()); pRealDialog->SetStyle(pDialog->GetStyle() | WB_CLOSEABLE); dumpDialogToPath(*pRealDialog); + + if (VclBuilderContainer* pOwnedToplevel = dynamic_cast<VclBuilderContainer*>(aOwnedToplevel.get())) + pOwnedToplevel->m_pUIBuilder = std::move(xBuilder); + aOwnedToplevel.disposeAndClear(); } pDialog.disposeAndClear(); |