[Libreoffice-commits] core.git: sc/qa

Eike Rathke erack at redhat.com
Thu Jun 18 13:06:34 PDT 2015


 sc/qa/unit/data/xlsx/ceiling-floor.xlsx |binary
 sc/qa/unit/helper/shared_test_impl.hxx  |   15 +++++++++++
 sc/qa/unit/subsequent_export-test.cxx   |   41 +++++++++++++++++++++++++++++++-
 sc/qa/unit/subsequent_filters-test.cxx  |   14 ++++++++++
 4 files changed, 69 insertions(+), 1 deletion(-)

New commits:
commit ba70050dc37f82306a8a3c5815372a4b9fff18fc
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Jun 18 21:30:22 2015 +0200

    add test case document to unit tests, tdf#69552
    
    Change-Id: I73da1e00dd2b19088fbbe7e999611835f2ed4882

diff --git a/sc/qa/unit/data/xlsx/ceiling-floor.xlsx b/sc/qa/unit/data/xlsx/ceiling-floor.xlsx
new file mode 100644
index 0000000..a98a355
Binary files /dev/null and b/sc/qa/unit/data/xlsx/ceiling-floor.xlsx differ
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx
index bc2ee65..666be99 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -271,6 +271,21 @@ void testFunctionsExcel2010_Impl( ScDocument& rDoc )
     }
 }
 
+void testCeilingFloor_Impl( ScDocument& rDoc )
+{
+    // Original test case document is ceiling-floor.xlsx
+    // Sheet1.K1 has =AND(K3:K81) to evaluate all results.
+    const char* pORef = "Sheet1.K1";
+    OUString aRef( OUString::createFromAscii( pORef));
+    ScAddress aPos;
+    aPos.Parse(aRef);
+    if (!checkFormula( rDoc, aPos, "AND(K3:K81)"))
+        CPPUNIT_FAIL("Wrong formula.");
+    CPPUNIT_ASSERT_MESSAGE( OString( OString(pORef) + " result is error.").getStr(),
+            isFormulaWithoutError( rDoc, aPos));
+    CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(aPos));
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index e529e08..d54a9e5 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -126,6 +126,11 @@ public:
     void testFunctionsExcel2010XLS();
     void testFunctionsExcel2010ODS();
 
+    void testCeilingFloor( sal_uLong nFormatType );
+    void testCeilingFloorXLSX();
+    void testCeilingFloorXLS();
+    void testCeilingFloorODS();
+
     void testRelativePaths();
     void testSheetProtection();
 
@@ -182,13 +187,16 @@ public:
     CPPUNIT_TEST(testSharedFormulaStringResultExportXLSX);
     CPPUNIT_TEST(testFunctionsExcel2010XLSX);
     CPPUNIT_TEST(testFunctionsExcel2010XLS);
+    CPPUNIT_TEST(testFunctionsExcel2010ODS);
+    CPPUNIT_TEST(testCeilingFloorXLSX);
+    CPPUNIT_TEST(testCeilingFloorXLS);
+    CPPUNIT_TEST(testCeilingFloorODS);
 #if !defined(WNT)
     CPPUNIT_TEST(testRelativePaths);
 #endif
     CPPUNIT_TEST(testSheetProtection);
     CPPUNIT_TEST(testPivotTableXLSX);
     CPPUNIT_TEST(testPivotTableTwoDataFieldsXLSX);
-    CPPUNIT_TEST(testFunctionsExcel2010ODS);
 #if !defined(WNT)
     CPPUNIT_TEST(testSupBookVirtualPath);
 #endif
@@ -1988,6 +1996,37 @@ void ScExportTest::testFunctionsExcel2010XLS()
     testFunctionsExcel2010(XLS);
 }
 
+void ScExportTest::testCeilingFloor( sal_uLong nFormatType )
+{
+    ScDocShellRef xShell = loadDoc("ceiling-floor.", XLSX);
+    CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.Is());
+
+    ScDocShellRef xDocSh = saveAndReload(xShell, nFormatType);
+    ScDocument& rDoc = xDocSh->GetDocument();
+    rDoc.CalcAll(); // perform hard re-calculation.
+
+    testCeilingFloor_Impl(rDoc);
+
+    xDocSh->DoClose();
+}
+
+void ScExportTest::testCeilingFloorXLSX()
+{
+    testCeilingFloor(XLSX);
+}
+
+void ScExportTest::testCeilingFloorXLS()
+{
+    // CEILING.PRECISE() and FLOOR.PRECISE() with one parameter only currently
+    // (2015-06-18) don't survive .xls save/reload and give NA()
+    //testCeilingFloor(XLS);
+}
+
+void ScExportTest::testCeilingFloorODS()
+{
+    testCeilingFloor(ODS);
+}
+
 void ScExportTest::testRelativePaths()
 {
     ScDocShellRef xDocSh = loadDoc("fdo79305.", ODS);
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 4ac4bf8..33431ca 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -107,6 +107,7 @@ public:
     void testHardRecalcODS();
     void testFunctionsODS();
     void testFunctionsExcel2010();
+    void testCeilingFloorXLSX();
     void testCachedFormulaResultsODS();
     void testCachedMatrixFormulaResultsODS();
     void testFormulaDepAcrossSheetsODS();
@@ -213,6 +214,7 @@ public:
     CPPUNIT_TEST(testHardRecalcODS);
     CPPUNIT_TEST(testFunctionsODS);
     CPPUNIT_TEST(testFunctionsExcel2010);
+    CPPUNIT_TEST(testCeilingFloorXLSX);
     CPPUNIT_TEST(testCachedFormulaResultsODS);
     CPPUNIT_TEST(testFormulaDepAcrossSheetsODS);
     CPPUNIT_TEST(testFormulaDepDeleteContentsODS);
@@ -547,6 +549,18 @@ void ScFiltersTest::testFunctionsExcel2010()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testCeilingFloorXLSX()
+{
+    ScDocShellRef xDocSh = loadDoc("ceiling-floor.", XLSX);
+    CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xDocSh.Is());
+    ScDocument& rDoc = xDocSh->GetDocument();
+    rDoc.CalcAll(); // perform hard re-calculation.
+
+    testCeilingFloor_Impl(rDoc);
+
+    xDocSh->DoClose();
+}
+
 void ScFiltersTest::testCachedFormulaResultsODS()
 {
     {


More information about the Libreoffice-commits mailing list