[Libreoffice-commits] core.git: sc/qa sc/source

Jan-Marek Glogowski glogow at fbihome.de
Mon Jul 4 03:35:38 UTC 2016


 sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods |binary
 sc/qa/unit/subsequent_filters-test.cxx            |   14 ++++++++++++++
 sc/source/filter/xml/xmlcelli.cxx                 |    1 -
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 21a3d78cf080dc4d86edab2a7378055a2d848bfe
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Jun 17 21:22:02 2016 +0200

    tdf#100458 Don't forcefully change cell type
    
    Just quoting the source comment from the breaking commit
    61c39eae570d6d6040b65bfe93127b30e6080cc8.
    
    // If a matrix formula has a matrix reference cell that is intended to
    // have // a blank text result, the matrix reference cell is actually
    // saved(export) as a float cell with 0 as the value and empty <text:p/>.
    
    Ok
    
    // Import works around this by setting these cells as text cells so that
    // the blank text is used for display instead of the number 0.
    
    This seems to be wrong.
    
    Forcing the cell to a util::NumberFormat::TEXT actually kills
    the cell value, if the text is a result of the formular.
    
    I'm not sure if forcefully changing the cell format at this point is
    correct at any time, if a cell type was already determinated.
    
    I imagine that an undefined cell type should probably be fixed at the
    end of the row import, if Calc detected an error case, or even generally,
    
    This patch is just a minimalistic initial fix. If it's correct, it
    probably needs an additional code comment.
    
    Change-Id: If7d9d69467d56c7d8fd2444f9e8b3ae906285264
    Reviewed-on: https://gerrit.libreoffice.org/26435
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods b/sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods
new file mode 100644
index 0000000..afc65e7
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 0c1428e..35f0cbe 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -215,6 +215,8 @@ public:
 
     void testBnc762542();
 
+    void testTdf100458();
+
     CPPUNIT_TEST_SUITE(ScFiltersTest);
     CPPUNIT_TEST(testBooleanFormatXLSX);
     CPPUNIT_TEST(testBasicCellContentODS);
@@ -318,6 +320,8 @@ public:
 
     CPPUNIT_TEST(testHiddenSheetsXLSX);
 
+    CPPUNIT_TEST(testTdf100458);
+
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3328,6 +3332,16 @@ void ScFiltersTest::testRelFormulaValidationXLS()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testTdf100458()
+{
+    ScDocShellRef xDocSh = loadDoc("tdf100458_lost_zero_value.", FORMAT_ODS);
+    CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.Is());
+    ScDocument& rDoc = xDocSh->GetDocument();
+    CPPUNIT_ASSERT(rDoc.HasValueData(0, 0, 0));
+    CPPUNIT_ASSERT_EQUAL(double(0.0), rDoc.GetValue(0,0,0));
+    CPPUNIT_ASSERT(!rDoc.HasStringData(0, 0, 0));
+}
+
 ScFiltersTest::ScFiltersTest()
       : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 149435e..c8825fe 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1511,7 +1511,6 @@ void ScXMLTableRowCellContext::EndElement()
     if( bFormulaTextResult && (mbPossibleErrorCell || mbCheckWithCompilerForError) )
     {
         maStringValue.reset(GetFirstParagraph());
-        nCellType = util::NumberFormat::TEXT;
     }
 
     ScAddress aCellPos = rXMLImport.GetTables().GetCurrentCellPos();


More information about the Libreoffice-commits mailing list