From 42062d99f171196778685e655e4edafd33ac159f Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 18 Oct 2016 18:16:42 -0400 Subject: tdf#93894: Write a new test case for column and row labels combined. Change-Id: I76e1f6f3c3aed9d940e4433026f752f3630f2373 --- .../data/ods/shared-formula/column-row-labels.ods | Bin 0 -> 11711 bytes sc/qa/unit/subsequent_filters-test.cxx | 41 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 sc/qa/unit/data/ods/shared-formula/column-row-labels.ods 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 Binary files /dev/null and b/sc/qa/unit/data/ods/shared-formula/column-row-labels.ods 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); -- cgit v1.2.3