summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2016-10-01 22:44:28 -0400
committerKohei Yoshida <libreoffice@kohei.us>2016-10-04 03:50:35 +0000
commit958827673309a80a710a86a9b115945547f520a0 (patch)
tree5bdb943628cd28f0d08c70d8857c91cd171f06ba
parent7da2f3ce9f7b049c177a735a146dae84a764d3f7 (diff)
tdf#93894: Add unit test for this.
Change-Id: Ifd38b9fde776d9be48e776972993856cfe59b477 Reviewed-on: https://gerrit.libreoffice.org/29515 Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> Tested-by: Kohei Yoshida <libreoffice@kohei.us>
-rw-r--r--sc/qa/unit/data/ods/shared-formula/column-labels.odsbin0 -> 10129 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx40
2 files changed, 40 insertions, 0 deletions
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 000000000000..cfe49ce2c480
--- /dev/null
+++ b/sc/qa/unit/data/ods/shared-formula/column-labels.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 8ef4a8c7e7be..f06e66e38489 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);