diff options
author | Eike Rathke <erack@redhat.com> | 2015-06-18 21:30:22 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-06-18 22:05:56 +0200 |
commit | ba70050dc37f82306a8a3c5815372a4b9fff18fc (patch) | |
tree | 0cf8df1d07e266a9866dac57315e603e505f1ec2 /sc | |
parent | bcace9acafa24d5251e90587af776fdb0a808ed8 (diff) |
add test case document to unit tests, tdf#69552
Change-Id: I73da1e00dd2b19088fbbe7e999611835f2ed4882
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xlsx/ceiling-floor.xlsx | bin | 0 -> 14300 bytes | |||
-rw-r--r-- | sc/qa/unit/helper/shared_test_impl.hxx | 15 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 41 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 14 |
4 files changed, 69 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xlsx/ceiling-floor.xlsx b/sc/qa/unit/data/xlsx/ceiling-floor.xlsx Binary files differnew file mode 100644 index 000000000000..a98a355bf7dd --- /dev/null +++ b/sc/qa/unit/data/xlsx/ceiling-floor.xlsx diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx index bc2ee65c036d..666be995b61a 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 e529e089d654..d54a9e5ae987 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 4ac4bf86e7cb..33431cafc753 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() { { |