From 04a200cf8e578a9f41d4511f31c1ee16fec4556d Mon Sep 17 00:00:00 2001 From: Katarina Behrens Date: Tue, 28 Jun 2016 22:29:52 +0200 Subject: screenshots: don't crash on opening csv import dlg Change-Id: I1ff56d79f7ff31317187cf077380481f1ef44366 --- sc/qa/unit/screenshots/screenshots.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'sc/qa') diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index ee12727e369f..68d2814397d1 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -96,6 +96,8 @@ private: ScDocShellRef xDocSh; ScTabViewShell* pViewShell; ScAbstractDialogFactory* pFact; + + std::unique_ptr pStream; }; ScScreenshotTest::ScScreenshotTest() @@ -138,6 +140,9 @@ void ScScreenshotTest::initializeWithDoc(const char* pName) pFact = ScAbstractDialogFactory::Create(); CPPUNIT_ASSERT_MESSAGE("Failed to create dialog factory", pFact); + + const OUString aCsv("some, strings, here, separated, by, commas"); + pStream.reset( new ScImportStringStream( aCsv) ); } VclAbstractDialog* ScScreenshotTest::createDialogByID( sal_uInt32 nID ) @@ -240,13 +245,11 @@ VclAbstractDialog* ScScreenshotTest::createDialogByID( sal_uInt32 nID ) break; } - //case 12: - //{ - // const OUString aCsv("some, strings, here, separated, by, commas"); - // ScImportStringStream aStream( aCsv ); - // pReturnDialog = pFact->CreateScImportAsciiDlg( OUString(), &aStream, SC_PASTETEXT ); - // break; - //} + case 13: + { + pReturnDialog = pFact->CreateScImportAsciiDlg( OUString(), pStream.get(), SC_PASTETEXT ); + break; + } //ScopedVclPtrInstance pDlg14( pViewShell->GetDialogParent(), &rViewData ); //ScopedVclPtrInstance pDlg16(pViewShell->GetDialogParent()); default: @@ -290,7 +293,7 @@ void ScScreenshotTest::testOpeningModalDialogs() { initializeWithDoc("empty.ods"); - const sal_uInt32 nDialogs = 13; + const sal_uInt32 nDialogs = 14; for ( sal_uInt32 i = 0; i < nDialogs; i++ ) { -- cgit v1.2.3