[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Feb 6 15:05:12 PST 2014
sc/qa/unit/data/xls/shared-formula/horizontal.xls |binary
sc/qa/unit/subsequent_filters-test.cxx | 45 ++++++++++++++++++++++
sc/source/filter/excel/excform.cxx | 2
3 files changed, 46 insertions(+), 1 deletion(-)
New commits:
commit 16442998b8b6ac7e284ab2377013f36c28b2cb8c
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Feb 6 18:08:03 2014 -0500
fdo#74553: Use the shared formula column position Excel tells you...
Because sometimes this may be correct.
Change-Id: Id2c47bb4ad3f91b366a25306169de58bb38c1e81
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 6d925fb..cf44d3c 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -124,7 +124,7 @@ void ImportExcel::Formula(
SCROW nSharedRow;
if (pFormConv->ReadSharedFormulaPosition(maStrm, nSharedCol, nSharedRow))
{
- ScAddress aRefPos(aScPos.Col(), nSharedRow, GetCurrScTab());
+ ScAddress aRefPos(nSharedCol, nSharedRow, GetCurrScTab());
const ScTokenArray* pSharedCode = pFormConv->GetSharedFormula(aRefPos);
if (pSharedCode)
{
commit 642d0c9abc30b5f9c06abe4d91b55fdf06427ce5
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Feb 6 18:05:50 2014 -0500
fdo#74553: Write unit test for this.
Change-Id: Ie33047dff35c7aa31aaed9ec6c8e1fe5f8f5b9d7
diff --git a/sc/qa/unit/data/xls/shared-formula/horizontal.xls b/sc/qa/unit/data/xls/shared-formula/horizontal.xls
new file mode 100644
index 0000000..318379f
Binary files /dev/null and b/sc/qa/unit/data/xls/shared-formula/horizontal.xls differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 003fdd0..448a9fa 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()
More information about the Libreoffice-commits
mailing list