diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-12-30 01:17:29 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-12-30 01:21:54 +0100 |
commit | 11109ded381e0cc4f44f7837af995c8c82b3df09 (patch) | |
tree | 89777b69260c8406f18c1ca5f630f4188113893b /sc | |
parent | b010e6724fa5cd519daafd3abf57f0a3257025bb (diff) |
add test for fdo#84556
Change-Id: I9b3af4f66513fff437facd17c0758ee92ac5744d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xls/shared-formula/relative-refs1.xls (renamed from sc/qa/unit/data/xls/shared-formula/relative-refs.xls) | bin | 7168 -> 7168 bytes | |||
-rw-r--r-- | sc/qa/unit/data/xls/shared-formula/relative-refs2.xls | bin | 0 -> 6656 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 61 |
3 files changed, 48 insertions, 13 deletions
diff --git a/sc/qa/unit/data/xls/shared-formula/relative-refs.xls b/sc/qa/unit/data/xls/shared-formula/relative-refs1.xls Binary files differindex 88678b46e5bf..88678b46e5bf 100644 --- a/sc/qa/unit/data/xls/shared-formula/relative-refs.xls +++ b/sc/qa/unit/data/xls/shared-formula/relative-refs1.xls diff --git a/sc/qa/unit/data/xls/shared-formula/relative-refs2.xls b/sc/qa/unit/data/xls/shared-formula/relative-refs2.xls Binary files differnew file mode 100644 index 000000000000..56ff822fc59a --- /dev/null +++ b/sc/qa/unit/data/xls/shared-formula/relative-refs2.xls diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 529486dce661..703f90593ba9 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -2583,23 +2583,58 @@ void ScFiltersTest::testSharedFormulaXLSB() void ScFiltersTest::testSharedFormulaXLS() { - ScDocShellRef xDocSh = loadDoc("shared-formula/relative-refs.", XLS); - CPPUNIT_ASSERT(xDocSh.Is()); - ScDocument& rDoc = xDocSh->GetDocument(); - rDoc.CalcAll(); + { + // fdo#80091 + ScDocShellRef xDocSh = loadDoc("shared-formula/relative-refs1.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument& rDoc = xDocSh->GetDocument(); + rDoc.CalcAll(); - // A1:A30 should be all formulas, and they should belong to the same group. - const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(0,1,0)); - CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow()); - CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(29), pFC->GetSharedLength()); + // A1:A30 should be all formulas, and they should belong to the same group. + const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(0,1,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(29), pFC->GetSharedLength()); - for(SCROW nRow = 0; nRow < 30; ++nRow) - { - ASSERT_DOUBLES_EQUAL(double(nRow+1), rDoc.GetValue(0, nRow, 0)); + for(SCROW nRow = 0; nRow < 30; ++nRow) + { + ASSERT_DOUBLES_EQUAL(double(nRow+1), rDoc.GetValue(0, nRow, 0)); + } + + xDocSh->DoClose(); } - xDocSh->DoClose(); + { + // fdo#84556 and some related tests + ScDocShellRef xDocSh = loadDoc("shared-formula/relative-refs2.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument& rDoc = xDocSh->GetDocument(); + rDoc.CalcAll(); + + { + const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(2,1,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength()); + + OUString aFormula; + rDoc.GetFormula(2, 1, 0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B9:D9)"), aFormula); + } + + { + const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(4,8,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength()); + + OUString aFormula; + rDoc.GetFormula(4, 8, 0, aFormula); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(G9:EY9)"), aFormula); + } + + xDocSh->DoClose(); + } } void ScFiltersTest::testExternalRefCacheXLSX() |