summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-01-25 13:15:09 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-01-25 13:19:21 +0100
commit71a8f79f4bdf567b6fce23091ca1663455cadba9 (patch)
tree33418b0cc932b3619da78d001aedaaca7640d7b3 /sc/qa/unit
parent3a1f90a6c7fa0c0604acac6d76f9d4ef3ac20311 (diff)
improve the tests for cached value import
The test now also tests for Err:* import and checks that these have been imported as error values and not only as text values. Future clean-up: Merge the cached matrix test file into the cached value one. Change-Id: I9c0a06f058ff6620bd7ca169b3bee07a5430997e
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/data/contentCSV/matrix2.csv12
-rw-r--r--sc/qa/unit/data/ods/cachedValue.odsbin9176 -> 9433 bytes
-rw-r--r--sc/qa/unit/data/ods/matrix.odsbin12992 -> 12934 bytes
-rw-r--r--sc/qa/unit/data/ods/volatile.odsbin7982 -> 0 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx51
5 files changed, 36 insertions, 27 deletions
diff --git a/sc/qa/unit/data/contentCSV/matrix2.csv b/sc/qa/unit/data/contentCSV/matrix2.csv
index 2effd613c639..8450f0d01c62 100644
--- a/sc/qa/unit/data/contentCSV/matrix2.csv
+++ b/sc/qa/unit/data/contentCSV/matrix2.csv
@@ -1,6 +1,6 @@
-Matrices with errors and other misc potential problems:,,,,
-Err:502,Err:502,Err:502,,error result
-#N/A,#N/A,#N/A,,n/a
-TRUE,TRUE,TRUE,,Display TRUE instead of 1
-FALSE,FALSE,FALSE,,Display FALSE instead of 0
-42,,42,,Display blank cell instead of 0
+Matrices with errors and other misc potential problems:
+Err:502,Err:502,Err:502,
+#N/A,#N/A,#N/A,
+TRUE,TRUE,TRUE,
+FALSE,FALSE,FALSE,
+42,,42,,
diff --git a/sc/qa/unit/data/ods/cachedValue.ods b/sc/qa/unit/data/ods/cachedValue.ods
index a802e2205862..8fe411ab7666 100644
--- a/sc/qa/unit/data/ods/cachedValue.ods
+++ b/sc/qa/unit/data/ods/cachedValue.ods
Binary files differ
diff --git a/sc/qa/unit/data/ods/matrix.ods b/sc/qa/unit/data/ods/matrix.ods
index d3713cf82b2d..4d2f836567e3 100644
--- a/sc/qa/unit/data/ods/matrix.ods
+++ b/sc/qa/unit/data/ods/matrix.ods
Binary files differ
diff --git a/sc/qa/unit/data/ods/volatile.ods b/sc/qa/unit/data/ods/volatile.ods
deleted file mode 100644
index 6278de7c9c1e..000000000000
--- a/sc/qa/unit/data/ods/volatile.ods
+++ /dev/null
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index a8c37cbc6189..6182bf32a42a 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -133,7 +133,6 @@ public:
void testHardRecalcODS();
void testFunctionsODS();
void testCachedFormulaResultsODS();
- void testVolatileFunctionsODS();
void testCachedMatrixFormulaResultsODS();
void testDatabaseRangesODS();
void testDatabaseRangesXLS();
@@ -188,7 +187,6 @@ public:
CPPUNIT_TEST(testHardRecalcODS);
CPPUNIT_TEST(testFunctionsODS);
CPPUNIT_TEST(testCachedFormulaResultsODS);
- CPPUNIT_TEST(testVolatileFunctionsODS);
CPPUNIT_TEST(testCachedMatrixFormulaResultsODS);
CPPUNIT_TEST(testDatabaseRangesODS);
CPPUNIT_TEST(testDatabaseRangesXLS);
@@ -460,29 +458,40 @@ void ScFiltersTest::testCachedFormulaResultsODS()
createCSVPath("cachedValue.", aCSVFileName);
testFile(aCSVFileName, pDoc, 0);
- xDocSh->DoClose();
- }
-}
+ //we want to me sure that volatile functions are always recalculated
+ //regardless of cached results. if you update the ods file, you must
+ //update the values here.
+ //if NOW() is recacluated, then it should never equal sTodayCache
+ OUString sTodayCache("01/25/13 01:06 PM");
+ OUString sTodayRecalc(pDoc->GetString(0,0,1));
-void ScFiltersTest::testVolatileFunctionsODS()
-{
- ScDocShellRef xDocSh = loadDoc("volatile.", ODS);
+ CPPUNIT_ASSERT(sTodayCache != sTodayRecalc);
- CPPUNIT_ASSERT_MESSAGE("Failed to load volatile.ods", xDocSh.Is());
- ScDocument* pDoc = xDocSh->GetDocument();
-
- //we want to me sure that volatile functions are always recalculated
- //regardless of cached results. if you update the ods file, you must
- //update the values here.
- //if NOW() is recacluated, then it should never equal sTodayCache
- OUString sTodayCache("07/11/12 12:28 AM");
- OUString sTodayRecalc(pDoc->GetString(0,1,0));
- CPPUNIT_ASSERT(sTodayCache != sTodayRecalc);
+ OUString sTodayRecalcRef(pDoc->GetString(1,0,1));
+ CPPUNIT_ASSERT_EQUAL(sTodayRecalc, sTodayRecalcRef);
- OUString sTodayRecalcRef(pDoc->GetString(2,1,0));
- CPPUNIT_ASSERT(sTodayCache != sTodayRecalcRef);
+ // make sure that error values are not being treated as string values
+ for(SCCOL nCol = 0; nCol < 4; ++nCol)
+ {
+ for(SCROW nRow = 0; nRow < 2; ++nRow)
+ {
+ OUStringBuffer aIsErrorFormula("=ISERROR(");
+ aIsErrorFormula.append((char)('A'+nCol)).append(OUString::number(nRow));
+ aIsErrorFormula.append(")");
+ OUString aFormula = aIsErrorFormula.makeStringAndClear();
+ pDoc->SetString(nCol, nRow + 2, 2, aFormula);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8).getStr(), pDoc->GetString(nCol, nRow +2, 2), OUString("TRUE"));
+
+ OUStringBuffer aIsTextFormula("=ISTEXT(");
+ aIsTextFormula.append((char)('A'+nCol)).append(OUString::number(nRow));
+ aIsTextFormula.append(")");
+ pDoc->SetString(nCol, nRow + 4, 2, aIsTextFormula.makeStringAndClear());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("", pDoc->GetString(nCol, nRow +4, 2), OUString("FALSE"));
+ }
+ }
- xDocSh->DoClose();
+ xDocSh->DoClose();
+ }
}
void ScFiltersTest::testCachedMatrixFormulaResultsODS()