[Libreoffice-commits] core.git: sc/qa
Kohei Yoshida
kohei.yoshida at collabora.com
Mon Apr 24 23:48:46 UTC 2017
sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods |binary
sc/qa/unit/subsequent_filters-test.cxx | 33 ++++++++++++++++++++++
2 files changed, 33 insertions(+)
New commits:
commit e4f28aea21ce7e8f960cc2062f83715549be215e
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Apr 22 10:10:00 2017 -0400
tdf#107310: add unit test for this.
I decided to add this to the filters test since it's the ods import
code that sets the cells in hybrid "zero as empty string" mode.
Change-Id: Icb34733e8550b655fbd70be718af5006b257a3e3
Reviewed-on: https://gerrit.libreoffice.org/36818
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods b/sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods
new file mode 100644
index 000000000000..1e3fac470137
Binary files /dev/null and b/sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 177d84185d6a..93853a4c68ce 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -205,6 +205,7 @@ public:
void testRichTextContentODS();
void testMiscRowHeights();
void testOptimalHeightReset();
+ void testCustomNumFormatHybridCellODS();
void testPrintRangeODS();
void testOutlineODS();
@@ -323,6 +324,7 @@ public:
CPPUNIT_TEST(testMiscRowHeights);
CPPUNIT_TEST(testOptimalHeightReset);
+ CPPUNIT_TEST(testCustomNumFormatHybridCellODS);
CPPUNIT_TEST(testPrintRangeODS);
CPPUNIT_TEST(testOutlineODS);
CPPUNIT_TEST(testColumnStyleXLSX);
@@ -3146,6 +3148,37 @@ void ScFiltersTest::testOptimalHeightReset()
xDocSh->DoClose();
}
+void ScFiltersTest::testCustomNumFormatHybridCellODS()
+{
+ ScDocShellRef xDocSh = loadDoc("custom-numfmt-hybrid-cell.", FORMAT_ODS, false);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.SetAutoCalc(true);
+
+ // All of B14, B16 and B18 should be displaying empty strings by virture
+ // of the custom number format being set on those cells.
+
+ for (SCROW nRow : {13, 15, 17})
+ {
+ ScAddress aPos(1, nRow, 0);
+ OUString aStr = rDoc.GetString(aPos);
+ CPPUNIT_ASSERT(aStr.isEmpty());
+ }
+
+ // Now, set value of 1 to B15. This should trigger re-calc on B18 and B18
+ // should now show a value of 1.
+ rDoc.SetValue(ScAddress(1,15,0), 1.0);
+
+ OUString aStr = rDoc.GetString(ScAddress(1,17,0));
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), aStr);
+
+ // Make sure the cell doesn't have an error value.
+ ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(1,17,0));
+ CPPUNIT_ASSERT(pFC);
+ CPPUNIT_ASSERT(pFC->GetErrCode() == FormulaError::NONE);
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testPrintRangeODS()
{
ScDocShellRef xDocSh = loadDoc("print-range.", FORMAT_ODS);
More information about the Libreoffice-commits
mailing list