[Libreoffice-commits] .: sc/qa

Kohei Yoshida kohei at kemper.freedesktop.org
Sat Jul 23 08:44:07 PDT 2011


 sc/qa/unit/data/ods/named-ranges-global.ods |binary
 sc/qa/unit/filters-test.cxx                 |   26 ++++++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 8dca87b15321b7081031730475b9577fc8f8e25c
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Jul 18 17:20:50 2011 -0400

    Initial cut on testing ods document loading.
    
    The loading still fails in SfxObjectShell::DoLoad().  I need to look
    into it.

diff --git a/sc/qa/unit/data/ods/named-ranges-global.ods b/sc/qa/unit/data/ods/named-ranges-global.ods
new file mode 100644
index 0000000..9d23d32
Binary files /dev/null and b/sc/qa/unit/data/ods/named-ranges-global.ods differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 58189b0..2753999 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://"))
 {


More information about the Libreoffice-commits mailing list