From 1f70bfcd415cde8d0e0423525b3bdc1f471f1894 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 25 Apr 2014 23:32:03 -0400 Subject: fdo#76611: Write test for this. Change-Id: Ib2852ccf8c19f9ed0fc5edda0b197d9801affae6 --- .../unit/data/xls/shared-formula/wrapped-refs.xls | Bin 0 -> 13824 bytes sc/qa/unit/subsequent_filters-test.cxx | 30 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls (limited to 'sc') diff --git a/sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls b/sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls new file mode 100644 index 000000000000..72487ce22df2 Binary files /dev/null and b/sc/qa/unit/data/xls/shared-formula/wrapped-refs.xls differ 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(6), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast(4), pFC->GetSharedLength()); + + xDocSh->DoClose(); +} + void ScFiltersTest::testExternalRefCacheXLSX() { ScDocShellRef xDocSh = loadDoc("external-refs.", XLSX); -- cgit