summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2016-10-18 18:16:42 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2016-10-18 20:27:45 -0400
commit42062d99f171196778685e655e4edafd33ac159f (patch)
treecd510f1b034cec3373deb22a8e197570a387905c
parent2b32042294a497f9e387348faf20fcdcb0c0fd7a (diff)
tdf#93894: Write a new test case for column and row labels combined.
Change-Id: I76e1f6f3c3aed9d940e4433026f752f3630f2373
-rw-r--r--sc/qa/unit/data/ods/shared-formula/column-row-labels.odsbin0 -> 11711 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx41
2 files changed, 41 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/shared-formula/column-row-labels.ods b/sc/qa/unit/data/ods/shared-formula/column-row-labels.ods
new file mode 100644
index 000000000000..02f711bc66da
--- /dev/null
+++ b/sc/qa/unit/data/ods/shared-formula/column-row-labels.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index bc82fb98dc9b..78724f8e8ac6 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -221,6 +221,7 @@ public:
void testSharedFormulaXLSB();
void testSharedFormulaXLS();
void testSharedFormulaColumnLabelsODS();
+ void testSharedFormulaColumnRowLabelsODS();
void testExternalRefCacheXLSX();
void testExternalRefCacheODS();
void testHybridSharedStringODS();
@@ -333,6 +334,7 @@ public:
CPPUNIT_TEST(testSharedFormulaXLSB);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testSharedFormulaColumnLabelsODS);
+ CPPUNIT_TEST(testSharedFormulaColumnRowLabelsODS);
CPPUNIT_TEST(testExternalRefCacheXLSX);
CPPUNIT_TEST(testExternalRefCacheODS);
CPPUNIT_TEST(testHybridSharedStringODS);
@@ -3470,6 +3472,45 @@ void ScFiltersTest::testSharedFormulaColumnLabelsODS()
xDocSh->DoClose();
}
+void ScFiltersTest::testSharedFormulaColumnRowLabelsODS()
+{
+ ScDocShellRef xDocSh = loadDoc("shared-formula/column-row-labels.", FORMAT_ODS);
+
+ CPPUNIT_ASSERT(xDocSh.Is());
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll();
+
+ // Expected output in each of the three ranges.
+ //
+ // +---+---+---+
+ // | 1 | 4 | 7 |
+ // +---+---+---+
+ // | 2 | 5 | 8 |
+ // +---+---+---+
+ // | 3 | 6 | 9 |
+ // +---+---+---+
+
+ auto aCheckFunc = [&](SCCOL nStartCol, SCROW nStartRow)
+ {
+ double fExpected = 1.0;
+ for (SCCOL nCol = 0; nCol <= 2; ++nCol)
+ {
+ for (SCROW nRow = 0; nRow <= 2; ++nRow)
+ {
+ ScAddress aPos(nStartCol+nCol, nStartRow+nRow, 0);
+ CPPUNIT_ASSERT_EQUAL(fExpected, rDoc.GetValue(aPos));
+ fExpected += 1.0;
+ }
+ }
+ };
+
+ aCheckFunc(5, 1); // F2:H4
+ aCheckFunc(9, 1); // J2:L4
+ aCheckFunc(1, 6); // B7:D9
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testExternalRefCacheXLSX()
{
ScDocShellRef xDocSh = loadDoc("external-refs.", FORMAT_XLSX);