diff options
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods | bin | 0 -> 7823 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 33 |
2 files changed, 33 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods b/sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods Binary files differnew file mode 100644 index 000000000000..1e3fac470137 --- /dev/null +++ b/sc/qa/unit/data/ods/custom-numfmt-hybrid-cell.ods 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); |