tdf#93894: Write a new test case for column and row labels combined.
Change-Id: I76e1f6f3c3aed9d940e4433026f752f3630f2373
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 0000000..02f711b
--- /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 bc82fb9..78724f8 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);