diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-06 18:05:50 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-06 18:10:01 -0500 |
commit | 642d0c9abc30b5f9c06abe4d91b55fdf06427ce5 (patch) | |
tree | e56530550ba420211594829a3d551f356eaf1403 /sc/qa | |
parent | ac6e8ac7e407887a18bca6c835f85e372a4d0932 (diff) |
fdo#74553: Write unit test for this.
Change-Id: Ie33047dff35c7aa31aaed9ec6c8e1fe5f8f5b9d7
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/xls/shared-formula/horizontal.xls | bin | 0 -> 70144 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 45 |
2 files changed, 45 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/shared-formula/horizontal.xls b/sc/qa/unit/data/xls/shared-formula/horizontal.xls Binary files differnew file mode 100644 index 000000000000..318379f371b5 --- /dev/null +++ b/sc/qa/unit/data/xls/shared-formula/horizontal.xls diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 003fdd06fba5..448a9fab1271 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -158,6 +158,8 @@ public: void testColumnStyleXLSX(); + void testSharedFormulaHorizontalXLS(); + CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBasicCellContentODS); CPPUNIT_TEST(testRangeNameXLS); @@ -231,6 +233,7 @@ public: CPPUNIT_TEST(testPrintRangeODS); CPPUNIT_TEST(testOutlineODS); CPPUNIT_TEST(testColumnStyleXLSX); + CPPUNIT_TEST(testSharedFormulaHorizontalXLS); CPPUNIT_TEST_SUITE_END(); private: @@ -2443,6 +2446,48 @@ void ScFiltersTest::testColumnStyleXLSX() const ScProtectionAttr& rAttrNew = static_cast<const ScProtectionAttr&>(pPattern->GetItem(ATTR_PROTECTION)); CPPUNIT_ASSERT(!rAttrNew.GetProtection()); + + xDocSh->DoClose(); +} + +void ScFiltersTest::testSharedFormulaHorizontalXLS() +{ + ScDocShellRef xDocSh = loadDoc("shared-formula/horizontal.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + + // Make sure K2:S2 on the 2nd sheet are all formula cells. + ScAddress aPos(0, 1, 1); + for (SCCOL nCol = 10; nCol <= 18; ++nCol) + { + aPos.SetCol(nCol); + CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", pDoc->GetCellType(aPos) == CELLTYPE_FORMULA); + } + + // Likewise, B3:J9 all should be formula cells. + for (SCCOL nCol = 1; nCol <= 9; ++nCol) + { + aPos.SetCol(nCol); + for (SCROW nRow = 2; nRow <= 8; ++nRow) + { + aPos.SetRow(nRow); + CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", pDoc->GetCellType(aPos) == CELLTYPE_FORMULA); + } + } + + // B2:I2 too. + aPos.SetRow(1); + for (SCCOL nCol = 1; nCol <= 8; ++nCol) + { + aPos.SetCol(nCol); + CPPUNIT_ASSERT_MESSAGE("Formula cell is expected here.", pDoc->GetCellType(aPos) == CELLTYPE_FORMULA); + } + + // J2 has a string of "MW". + aPos.SetCol(9); + CPPUNIT_ASSERT_EQUAL(OUString("MW"), pDoc->GetString(aPos)); + + xDocSh->DoClose(); } ScFiltersTest::ScFiltersTest() |