diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-05 09:29:35 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-05 09:31:56 -0500 |
commit | b55a751803209bc4eddb6d938417cdcbd05313fd (patch) | |
tree | 4b04221bb6d8c32e48e705fa6be65abd149a9768 /sc | |
parent | 798a9f8873189edab232d9f20007d5ab15ac74e5 (diff) |
New test document to handle Excel's wrong shared formula range.
This is but just one example out of many out in the wild...
Change-Id: Ia542cff0e583bdcc397d0ee6ee3eaaa84f64fe4f
(cherry picked from commit 830a7f501b12c1c34753a656491050a252043974)
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xls/shared-formula-gap.xls | bin | 0 -> 13824 bytes | |||
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 34 |
2 files changed, 33 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xls/shared-formula-gap.xls b/sc/qa/unit/data/xls/shared-formula-gap.xls Binary files differnew file mode 100644 index 000000000000..762e3935f567 --- /dev/null +++ b/sc/qa/unit/data/xls/shared-formula-gap.xls diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index d12ea6098687..bec9f76d0dfd 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -349,8 +349,8 @@ void ScFiltersTest::testContentXLS_XML() void ScFiltersTest::testSharedFormulaXLS() { ScDocShellRef xDocSh = loadDoc("shared-formula.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); // Check the results of formula cells in the shared formula range. for (SCROW i = 1; i <= 18; ++i) @@ -367,6 +367,38 @@ void ScFiltersTest::testSharedFormulaXLS() CPPUNIT_ASSERT_MESSAGE("Incorrect group geometry.", xGroup->mpTopCell->aPos.Row() == 1 && xGroup->mnLength == 18); xDocSh->DoClose(); + + // The following file contains shared formula whose range is inaccurate. + // Excel can easily mess up shared formula ranges, so we need to be able + // to handle these wrong ranges that Excel stores. + + xDocSh = loadDoc("shared-formula-gap.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + pDoc = xDocSh->GetDocument(); + pDoc->CalcAll(); + + if (!checkFormula(*pDoc, ScAddress(1,0,0), "A1*20")) + CPPUNIT_FAIL("Wrong formula."); + + if (!checkFormula(*pDoc, ScAddress(1,1,0), "A2*20")) + CPPUNIT_FAIL("Wrong formula."); + + if (!checkFormula(*pDoc, ScAddress(1,2,0), "A3*20")) + CPPUNIT_FAIL("Wrong formula."); + + // There is an intentional gap at row 4. + + if (!checkFormula(*pDoc, ScAddress(1,4,0), "A5*20")) + CPPUNIT_FAIL("Wrong formula."); + + if (!checkFormula(*pDoc, ScAddress(1,5,0), "A6*20")) + CPPUNIT_FAIL("Wrong formula."); + + if (!checkFormula(*pDoc, ScAddress(1,6,0), "A7*20")) + CPPUNIT_FAIL("Wrong formula."); + + if (!checkFormula(*pDoc, ScAddress(1,7,0), "A8*20")) + CPPUNIT_FAIL("Wrong formula."); } void ScFiltersTest::testSharedFormulaXLSX() |