[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sc/qa sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Mar 16 23:08:33 UTC 2019


 sc/qa/unit/data/ods/pivot-table-err-in-cache.ods |binary
 sc/qa/unit/pivottable_filters_test.cxx           |   19 +++++++++++++++++++
 sc/source/core/tool/interpr1.cxx                 |    1 +
 3 files changed, 20 insertions(+)

New commits:
commit 0a23bfacc46cb7c66ceb1bbec972cdcfa9afa50b
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Mar 7 16:38:20 2019 +0300
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Sun Mar 17 00:08:12 2019 +0100

    tdf#123923: make COUNTIF propagate errors in its first parameter
    
    In a specific case, Err:504 was emitted by COUNTIF when its 1st
    parameter was #REF!. This value was written into pivot cache definition
    when exporting to XLSX. Clearly Excel only expected propagated #REF!
    there, emitted error to user, and dropped the pivot table.
    
    This problem made XLSX pivot table cache generated by Calc unusable
    by Excel, despite ECMA-376 Part 1, 18.10.1.27 tells that the error
    value is application-dependent.
    
    The change makes COUNTIF to propagate errors received in its 1st
    parameter, instead of owerwriting them with own Err:504. This will
    likely need to be extended to other functions, if similar problems
    would arise.
    
    Change-Id: I459fa163a0e3e5f2c658631d66e096f4d46b1ace
    Reviewed-on: https://gerrit.libreoffice.org/68868
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 1f970c20a25deed282dbaf08a4be5af25e4951db)
    Reviewed-on: https://gerrit.libreoffice.org/69273
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods
new file mode 100644
index 000000000000..b566a61f8898
Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx
index ceb43d6ce664..e68e34904b3d 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -84,6 +84,7 @@ public:
     void testPivotTableDuplicatedMemberFilterXLSX();
     void testPivotTableTabularModeXLSX();
     void testTdf112106();
+    void testTdf123923();
 
     CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -122,6 +123,7 @@ public:
     CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX);
     CPPUNIT_TEST(testPivotTableTabularModeXLSX);
     CPPUNIT_TEST(testTdf112106);
+    CPPUNIT_TEST(testTdf123923);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2315,6 +2317,23 @@ void ScPivotTableFiltersTest::testTdf112106()
     xDocSh->DoClose();
 }
 
+void ScPivotTableFiltersTest::testTdf123923()
+{
+    // tdf#123923: Excel fails when it finds "Err:504" instead of "#REF!" in pivot table cache
+
+    ScDocShellRef xShell = loadDoc("pivot-table-err-in-cache.", FORMAT_ODS);
+    CPPUNIT_ASSERT(xShell.is());
+
+    std::shared_ptr<utl::TempFile> pXPathFile
+        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+    xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
+                                                "xl/pivotCache/pivotCacheDefinition1.xml");
+    CPPUNIT_ASSERT(pTable);
+
+    assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e",
+                "v", "#REF!");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d7279c1188a7..c9c3624bb019 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5743,6 +5743,7 @@ void ScInterpreter::ScCountIf()
                 }
                 break;
                 default:
+                    PopError(); // Propagate it further
                     PushIllegalParameter();
                     return ;
             }


More information about the Libreoffice-commits mailing list