diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-07-18 17:20:50 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-07-23 11:42:30 -0400 |
commit | 0980b065603bf113a13f37c934b8b220886d7a4b (patch) | |
tree | 5cef2db972266505e7e45d7ca95e52544f06316c /sc/qa/unit | |
parent | 4bdb4b742c96780b5ffdd14f0529ed3ab8e19f27 (diff) |
Initial cut on testing ods document loading.
The loading still fails in SfxObjectShell::DoLoad(). I need to look
into it.
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/data/ods/named-ranges-global.ods | bin | 0 -> 7925 bytes | |||
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 26 |
2 files changed, 22 insertions, 4 deletions
diff --git a/sc/qa/unit/data/ods/named-ranges-global.ods b/sc/qa/unit/data/ods/named-ranges-global.ods Binary files differnew file mode 100644 index 000000000000..9d23d32091a8 --- /dev/null +++ b/sc/qa/unit/data/ods/named-ranges-global.ods diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 58189b0c3336..2753999f344e 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -73,17 +73,20 @@ public: virtual void tearDown(); void recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, int nExpected); - bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData); + ScDocShellRef load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData); /** * Ensure CVEs remain unbroken */ void testCVEs(); + void testODSs(); + CPPUNIT_TEST_SUITE(FiltersTest); #if !defined(__OpenBSD__) CPPUNIT_TEST(testCVEs); #endif + CPPUNIT_TEST(testODSs); CPPUNIT_TEST_SUITE_END(); private: @@ -93,7 +96,7 @@ private: ::rtl::OUString m_aSrcRoot; }; -bool FiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, +ScDocShellRef FiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData) { SfxFilter aFilter( @@ -104,7 +107,11 @@ bool FiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, ScDocShellRef xDocShRef = new ScDocShell; SfxMedium aSrcMed(rURL, STREAM_STD_READ, true); aSrcMed.SetFilter(&aFilter); - return xDocShRef->DoLoad(&aSrcMed); + if (!xDocShRef->DoLoad(&aSrcMed)) + // load failed. + xDocShRef.Clear(); + + return xDocShRef; } void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData, int nExpected) @@ -140,7 +147,7 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin fprintf(stderr, "loading %s\n", aRes.getStr()); } sal_uInt32 nStartTime = osl_getGlobalTimer(); - bool bRes = load(rFilter, sURL, rUserData); + bool bRes = load(rFilter, sURL, rUserData).Is(); sal_uInt32 nEndTime = osl_getGlobalTimer(); if (nExpected == indeterminate) { @@ -179,6 +186,17 @@ void FiltersTest::testCVEs() } +void FiltersTest::testODSs() +{ +#if 0 +// TODO: loading of ods still fails. I need to look into this. + ScDocShellRef xDocSh = load(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("calc8")), + m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/calc/sc/qa/unit/data/ods/named-ranges-global.ods")), rtl::OUString()); + + CPPUNIT_ASSERT_MESSAGE("Failed to load named-ranges-global.ods.", xDocSh.Is()); +#endif +} + FiltersTest::FiltersTest() : m_aSrcRoot(RTL_CONSTASCII_USTRINGPARAM("file://")) { |