diff options
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/screenshots/data/empty.ods | bin | 6873 -> 0 bytes | |||
-rw-r--r-- | sc/qa/unit/screenshots/screenshots.cxx | 23 |
2 files changed, 14 insertions, 9 deletions
diff --git a/sc/qa/unit/screenshots/data/empty.ods b/sc/qa/unit/screenshots/data/empty.ods Binary files differdeleted file mode 100644 index 14b4232189f5..000000000000 --- a/sc/qa/unit/screenshots/data/empty.ods +++ /dev/null diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index c52bbc533eaf..97fa0af03c47 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -42,7 +42,6 @@ #include <scitems.hxx> using namespace css; -static const char* DATA_DIRECTORY = "/sc/qa/unit/screenshots/data/"; class ScScreenshotTest : public ScreenshotTest { @@ -53,11 +52,11 @@ private: ScDocShellRef mxDocSh; ScTabViewShell* mpViewShell; ScAbstractDialogFactory* mpFact; - std::unique_ptr<ScImportStringStream> mpStream; + std::unique_ptr<SvMemoryStream> mpStream; std::unique_ptr<SfxItemSet> mpItemSet; /// helper - void initializeWithDoc(const char* pName); + void initialize(); /// helper method to populate KnownDialogs, called in setUp(). Needs to be /// written and has to add entries to KnownDialogs @@ -72,11 +71,9 @@ public: virtual ~ScScreenshotTest(); void testOpeningModalDialogs(); - //void testOpeningModelessDialogs(); CPPUNIT_TEST_SUITE(ScScreenshotTest); CPPUNIT_TEST(testOpeningModalDialogs); - //CPPUNIT_TEST(testOpeningModelessDialogs); CPPUNIT_TEST_SUITE_END(); }; @@ -95,11 +92,12 @@ ScScreenshotTest::~ScScreenshotTest() { } -void ScScreenshotTest::initializeWithDoc(const char* pName) +void ScScreenshotTest::initialize() { if (mxComponent.is()) mxComponent->dispose(); - mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument"); + // use new, epty doc to avoid file locking + mxComponent = loadFromDesktop("private:factory/scalc", "com.sun.star.sheet.SpreadsheetDocument"); mpFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent); CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", mpFoundShell); @@ -114,7 +112,14 @@ void ScScreenshotTest::initializeWithDoc(const char* pName) CPPUNIT_ASSERT_MESSAGE("Failed to create dialog factory", mpFact); const OUString aCsv("some, strings, here, separated, by, commas"); - mpStream.reset(new ScImportStringStream(aCsv)); + SvMemoryStream* pNewMemStream = new SvMemoryStream(const_cast<sal_Unicode *>(aCsv.getStr()), aCsv.getLength() * sizeof(sal_Unicode), StreamMode::READ); + pNewMemStream->SetStreamCharSet( RTL_TEXTENCODING_UNICODE ); + #ifdef OSL_BIGENDIAN + pNewMemStream->SetEndian(SvStreamEndian::BIG); + #else + pNewMemStream->SetEndian(SvStreamEndian::LITTLE); + #endif + mpStream.reset(pNewMemStream); } void ScScreenshotTest::registerKnownDialogsByID(mapType& rKnownDialogs) @@ -273,7 +278,7 @@ VclAbstractDialog* ScScreenshotTest::createDialogByID(sal_uInt32 nID) void ScScreenshotTest::testOpeningModalDialogs() { - initializeWithDoc("empty.ods"); + initialize(); /// process input file containing the UXMLDescriptions of the dialogs to dump processDialogBatchFile("sc/qa/unit/screenshots/data/screenshots.txt"); |