sc/qa/unit/data/ods/shared-formula/column-labels.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+)
New commits: commit 958827673309a80a710a86a9b115945547f520a0 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Sat Oct 1 22:44:28 2016 -0400 tdf#93894: Add unit test for this. Change-Id: Ifd38b9fde776d9be48e776972993856cfe59b477 Reviewed-on: https://gerrit.libreoffice.org/29515 Reviewed-by: Kohei Yoshida <libreoff...@kohei.us> Tested-by: Kohei Yoshida <libreoff...@kohei.us> diff --git a/sc/qa/unit/data/ods/shared-formula/column-labels.ods b/sc/qa/unit/data/ods/shared-formula/column-labels.ods new file mode 100644 index 0000000..cfe49ce Binary files /dev/null and b/sc/qa/unit/data/ods/shared-formula/column-labels.ods differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 8ef4a8c..f06e66e 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -219,6 +219,7 @@ public: void testSharedFormulaBIFF5(); void testSharedFormulaXLSB(); void testSharedFormulaXLS(); + void testSharedFormulaColumnLabelsODS(); void testExternalRefCacheXLSX(); void testExternalRefCacheODS(); void testHybridSharedStringODS(); @@ -329,6 +330,7 @@ public: CPPUNIT_TEST(testSharedFormulaBIFF5); CPPUNIT_TEST(testSharedFormulaXLSB); CPPUNIT_TEST(testSharedFormulaXLS); + CPPUNIT_TEST(testSharedFormulaColumnLabelsODS); CPPUNIT_TEST(testExternalRefCacheXLSX); CPPUNIT_TEST(testExternalRefCacheODS); CPPUNIT_TEST(testHybridSharedStringODS); @@ -3320,6 +3322,44 @@ void ScFiltersTest::testSharedFormulaXLS() } } +void ScFiltersTest::testSharedFormulaColumnLabelsODS() +{ + ScDocShellRef xDocSh = loadDoc("shared-formula/column-labels.", FORMAT_ODS); + + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument& rDoc = xDocSh->GetDocument(); + rDoc.CalcAll(); + + // Cells C2, D2 and E2 all should contain formula groups of length 5. + for (SCCOL i = 2; i <= 4; ++i) + { + const ScFormulaCell* pCell = rDoc.GetFormulaCell(ScAddress(i,1,0)); + CPPUNIT_ASSERT(pCell); + CPPUNIT_ASSERT(pCell->IsShared()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(5), pCell->GetSharedLength()); + } + + CPPUNIT_ASSERT_EQUAL( 5.0, rDoc.GetValue(ScAddress(2,1,0))); + CPPUNIT_ASSERT_EQUAL(15.0, rDoc.GetValue(ScAddress(2,2,0))); + CPPUNIT_ASSERT_EQUAL(30.0, rDoc.GetValue(ScAddress(2,3,0))); + CPPUNIT_ASSERT_EQUAL(28.0, rDoc.GetValue(ScAddress(2,4,0))); + CPPUNIT_ASSERT_EQUAL(48.0, rDoc.GetValue(ScAddress(2,5,0))); + + CPPUNIT_ASSERT_EQUAL( 0.0, rDoc.GetValue(ScAddress(3,1,0))); + CPPUNIT_ASSERT_EQUAL( 50.0, rDoc.GetValue(ScAddress(3,2,0))); + CPPUNIT_ASSERT_EQUAL(144.0, rDoc.GetValue(ScAddress(3,3,0))); + CPPUNIT_ASSERT_EQUAL(147.0, rDoc.GetValue(ScAddress(3,4,0))); + CPPUNIT_ASSERT_EQUAL(320.0, rDoc.GetValue(ScAddress(3,5,0))); + + CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(4,1,0))); + CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(4,2,0))); + CPPUNIT_ASSERT_EQUAL(4.0, rDoc.GetValue(ScAddress(4,3,0))); + CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(ScAddress(4,4,0))); + CPPUNIT_ASSERT_EQUAL(5.0, rDoc.GetValue(ScAddress(4,5,0))); + + xDocSh->DoClose(); +} + void ScFiltersTest::testExternalRefCacheXLSX() { ScDocShellRef xDocSh = loadDoc("external-refs.", FORMAT_XLSX); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits