[Libreoffice-commits] .: 2 commits - sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 18 16:11:55 PDT 2012


 sc/qa/unit/filters-test.cxx |   44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

New commits:
commit 24761a6fd7ec028ad94f5b0c9993e0ac804bdee7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Sep 19 01:10:49 2012 +0200

    use the defines instead of hard coded numbers
    
    Change-Id: Id410cd758f325b9c7011ae1b7b911914a5822e0d

diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 2126a45..dc6df6d 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -373,7 +373,7 @@ void testContentImpl(ScDocument* pDoc, sal_Int32 nFormat ) //same code for ods,
 void ScFiltersTest::testContentODS()
 {
     const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("universal-content."));
-    ScDocShellRef xDocSh = loadDoc(aFileNameBase, 0);
+    ScDocShellRef xDocSh = loadDoc(aFileNameBase, ODS);
     xDocSh->DoHardRecalc(true);
 
     ScDocument* pDoc = xDocSh->GetDocument();
@@ -384,7 +384,7 @@ void ScFiltersTest::testContentODS()
 void ScFiltersTest::testContentXLS()
 {
     const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("universal-content."));
-    ScDocShellRef xDocSh = loadDoc(aFileNameBase, 1);
+    ScDocShellRef xDocSh = loadDoc(aFileNameBase, XLS);
     xDocSh->DoHardRecalc(true);
 
     ScDocument* pDoc = xDocSh->GetDocument();
@@ -395,7 +395,7 @@ void ScFiltersTest::testContentXLS()
 void ScFiltersTest::testContentXLSX()
 {
     const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("universal-content."));
-    ScDocShellRef xDocSh = loadDoc(aFileNameBase, 2);
+    ScDocShellRef xDocSh = loadDoc(aFileNameBase, XLSX);
     xDocSh->DoHardRecalc(true);
 
     ScDocument* pDoc = xDocSh->GetDocument();
@@ -406,7 +406,7 @@ void ScFiltersTest::testContentXLSX()
 void ScFiltersTest::testContentLotus123()
 {
     const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("universal-content."));
-    ScDocShellRef xDocSh = loadDoc(aFileNameBase, 3);
+    ScDocShellRef xDocSh = loadDoc(aFileNameBase, LOTUS123);
     xDocSh->DoHardRecalc(true);
 
     ScDocument* pDoc = xDocSh->GetDocument();
commit 1b6314f81cc4d6c29dd83b0009e3d3cd7b419c08
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Sep 19 01:10:17 2012 +0200

    enable the content test for lotus 123 files
    
    Change-Id: I8819b99b1eb1ea27d7e242d329f1e4fc878bdb2b

diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 15d5f7b..2126a45 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -324,7 +324,7 @@ void ScFiltersTest::testRangeNameODS()
 
 namespace {
 
-void testContentImpl(ScDocument* pDoc ) //same code for ods, xls, xlsx
+void testContentImpl(ScDocument* pDoc, sal_Int32 nFormat ) //same code for ods, xls, xlsx
 {
     double fValue;
     //check value import
@@ -334,10 +334,12 @@ void testContentImpl(ScDocument* pDoc ) //same code for ods, xls, xlsx
     CPPUNIT_ASSERT_MESSAGE("value not imported correctly", fValue == 2);
     rtl::OUString aString;
     pDoc->GetString(1,0,0,aString);
+
     //check string import
     CPPUNIT_ASSERT_MESSAGE("string imported not correctly", aString == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("String1")));
     pDoc->GetString(1,1,0,aString);
     CPPUNIT_ASSERT_MESSAGE("string not imported correctly", aString == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("String2")));
+
     //check basic formula import
     pDoc->GetValue(2,0,0,fValue);
     CPPUNIT_ASSERT_MESSAGE("=2*3", fValue == 6);
@@ -347,16 +349,22 @@ void testContentImpl(ScDocument* pDoc ) //same code for ods, xls, xlsx
     CPPUNIT_ASSERT_MESSAGE("=2-3", fValue == -1);
     pDoc->GetValue(2,3,0,fValue);
     CPPUNIT_ASSERT_MESSAGE("=C1+C2", fValue == 11);
+
     //check merged cells import
-    SCCOL nCol = 4;
-    SCROW nRow = 1;
-    pDoc->ExtendMerge(4, 1, nCol, nRow, 0, false);
-    CPPUNIT_ASSERT_MESSAGE("merged cells are not imported", nCol == 5 && nRow == 2);
-    //check notes import
-    ScAddress aAddress(7, 2, 0);
-    ScPostIt* pNote = pDoc->GetNotes(aAddress.Tab())->findByAddress(aAddress);
-    CPPUNIT_ASSERT_MESSAGE("note not imported", pNote);
-    CPPUNIT_ASSERT_MESSAGE("note text not imported correctly", pNote->GetText() == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test")));
+    if(nFormat != LOTUS123)
+    {
+        SCCOL nCol = 4;
+        SCROW nRow = 1;
+        pDoc->ExtendMerge(4, 1, nCol, nRow, 0, false);
+        CPPUNIT_ASSERT_MESSAGE("merged cells are not imported", nCol == 5 && nRow == 2);
+
+        //check notes import
+        ScAddress aAddress(7, 2, 0);
+        ScPostIt* pNote = pDoc->GetNotes(aAddress.Tab())->findByAddress(aAddress);
+        CPPUNIT_ASSERT_MESSAGE("note not imported", pNote);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("note text not imported correctly", pNote->GetText(), rtl::OUString("Test"));
+    }
+
     //add additional checks here
 }
 
@@ -369,7 +377,7 @@ void ScFiltersTest::testContentODS()
     xDocSh->DoHardRecalc(true);
 
     ScDocument* pDoc = xDocSh->GetDocument();
-    testContentImpl(pDoc);
+    testContentImpl(pDoc, ODS);
     xDocSh->DoClose();
 }
 
@@ -380,7 +388,7 @@ void ScFiltersTest::testContentXLS()
     xDocSh->DoHardRecalc(true);
 
     ScDocument* pDoc = xDocSh->GetDocument();
-    testContentImpl(pDoc);
+    testContentImpl(pDoc, XLS);
     xDocSh->DoClose();
 }
 
@@ -391,7 +399,7 @@ void ScFiltersTest::testContentXLSX()
     xDocSh->DoHardRecalc(true);
 
     ScDocument* pDoc = xDocSh->GetDocument();
-    testContentImpl(pDoc);
+    testContentImpl(pDoc, XLSX);
     xDocSh->DoClose();
 }
 
@@ -403,7 +411,7 @@ void ScFiltersTest::testContentLotus123()
 
     ScDocument* pDoc = xDocSh->GetDocument();
     CPPUNIT_ASSERT(pDoc);
-    //testContentImpl(pDoc);
+    testContentImpl(pDoc, LOTUS123);
     xDocSh->DoClose();
 }
 


More information about the Libreoffice-commits mailing list