From e56334255291a0ccb5165d7ceaa1391b906bb4de Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 21 Jul 2016 17:05:32 +0200 Subject: screenshots: fix fallback cases for sd and sc Change-Id: I27dab5552e3924df30c8b09c46994b2d645bcde9 --- test/source/screenshot_test.cxx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'test/source/screenshot_test.cxx') diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx index 92f48ee28823..dfbd2cee257c 100644 --- a/test/source/screenshot_test.cxx +++ b/test/source/screenshot_test.cxx @@ -178,16 +178,24 @@ void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription) if (!rUIXMLDescription.isEmpty()) { VclPtrInstance 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(); - Dialog *pRealDialog = dynamic_cast(pRoot); - if (!pRealDialog) - pRealDialog = pDialog; + { + VclBuilder aBuilder(pDialog, VclBuilderContainer::getUIRootDir(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8)); + vcl::Window *pRoot = aBuilder.get_widget_root(); + Dialog *pRealDialog = dynamic_cast(pRoot); + + if (!pRealDialog) + { + pRealDialog = pDialog; + } + + pRealDialog->SetText("LibreOffice DialogScreenshot"); + pRealDialog->SetStyle(pDialog->GetStyle() | WB_CLOSEABLE); + + dumpDialogToPath(*pRealDialog); + } - pRealDialog->SetText("LibreOffice DialogScreenshot"); - pRealDialog->SetStyle(pDialog->GetStyle() | WB_CLOSEABLE); - dumpDialogToPath(*pRealDialog); + pDialog.disposeAndClear(); } } -- cgit v1.2.3