diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-25 23:32:03 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-25 23:43:02 -0400 |
commit | 1f70bfcd415cde8d0e0423525b3bdc1f471f1894 (patch) | |
tree | 743005d33d04cebe1085451b88a86023b7e8ec86 /sc/qa/unit | |
parent | b08754f3358992387ea0eec7957745f4667ea7eb (diff) |
fdo#76611: Write test for this.
Change-Id: Ib2852ccf8c19f9ed0fc5edda0b197d9801affae6
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls | bin | 0 -> 13824 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 30 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls b/sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls Binary files differnew file mode 100644 index 000000000000..72487ce22df2 --- /dev/null +++ b/sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 7482bed20ab8..8870b9bbece4 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -169,6 +169,7 @@ public: void testColumnStyleXLSX(); void testSharedFormulaHorizontalXLS(); + void testSharedFormulaWrappedRefsXLS(); void testExternalRefCacheXLSX(); void testExternalRefCacheODS(); @@ -244,6 +245,7 @@ public: CPPUNIT_TEST(testOutlineODS); CPPUNIT_TEST(testColumnStyleXLSX); CPPUNIT_TEST(testSharedFormulaHorizontalXLS); + CPPUNIT_TEST(testSharedFormulaWrappedRefsXLS); CPPUNIT_TEST(testExternalRefCacheXLSX); CPPUNIT_TEST(testExternalRefCacheODS); CPPUNIT_TEST_SUITE_END(); @@ -2481,6 +2483,34 @@ void ScFiltersTest::testSharedFormulaHorizontalXLS() xDocSh->DoClose(); } +void ScFiltersTest::testSharedFormulaWrappedRefsXLS() +{ + ScDocShellRef xDocSh = loadDoc("shared-formula/wrapped-refs.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + pDoc->CalcAll(); + + // Check the values of H7:H10. + CPPUNIT_ASSERT_EQUAL(7.0, pDoc->GetValue(ScAddress(7,6,0))); + CPPUNIT_ASSERT_EQUAL(8.0, pDoc->GetValue(ScAddress(7,7,0))); + CPPUNIT_ASSERT_EQUAL(9.0, pDoc->GetValue(ScAddress(7,8,0))); + CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(7,9,0))); + + // EM7:EM10 should reference H7:H10. + CPPUNIT_ASSERT_EQUAL(7.0, pDoc->GetValue(ScAddress(142,6,0))); + CPPUNIT_ASSERT_EQUAL(8.0, pDoc->GetValue(ScAddress(142,7,0))); + CPPUNIT_ASSERT_EQUAL(9.0, pDoc->GetValue(ScAddress(142,8,0))); + CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(142,9,0))); + + // Make sure EM7:EM10 are grouped. + const ScFormulaCell *pFC = pDoc->GetFormulaCell(ScAddress(142,6,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength()); + + xDocSh->DoClose(); +} + void ScFiltersTest::testExternalRefCacheXLSX() { ScDocShellRef xDocSh = loadDoc("external-refs.", XLSX); |