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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 12 23:41:26 UTC 2018


 sw/source/core/bastyp/calc.cxx              |    3 ++
 vcl/qa/cppunit/pdfexport/data/tdf121962.odt |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx      |   30 ++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)

New commits:
commit 47180e4b83b5371d4006789261937de05e47a076
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue Dec 11 10:52:50 2018 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Dec 13 00:41:03 2018 +0100

    tdf#121962 Don't treat closing bracket as invalid syntax
    
    Somehow there is a difference how the formula looks when converting via command line
    vs exporting from UI.
    In UI the sum formula looks like: 'sum( (0) ) (0|0|0|0)'
    while in cmd line it looks like:  'sum( (0) ) () '
    
    Both look sane, so just don't treat the second one as error.
    
    Change-Id: I345c062a9e7c8b9c849885bc6cb88167a3491dd8
    Reviewed-on: https://gerrit.libreoffice.org/64941
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit d0e30c11740ba22af5f6a8156dd00dad8c378b2a)
    Reviewed-on: https://gerrit.libreoffice.org/64969
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 4d80b9a2302e..ef0c5d7e9843 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -1148,6 +1148,9 @@ SwSbxValue SwCalc::PrimFunc(bool &rChkPow)
             return nErg;
             break;
         }
+        case CALC_RP:
+            // ignore, see tdf#121962
+            break;
         case CALC_MEAN:
         {
             m_nListPor = 1;
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf121962.odt b/vcl/qa/cppunit/pdfexport/data/tdf121962.odt
new file mode 100644
index 000000000000..a831b1136163
Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/tdf121962.odt differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 80cb72fc1dff..04b7309b5cd4 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -116,6 +116,7 @@ public:
     void testTdf106702();
     void testTdf113143();
     void testTdf115262();
+    void testTdf121962();
 
     CPPUNIT_TEST_SUITE(PdfExportTest);
     CPPUNIT_TEST(testTdf106059);
@@ -148,6 +149,7 @@ public:
     CPPUNIT_TEST(testTdf106702);
     CPPUNIT_TEST(testTdf113143);
     CPPUNIT_TEST(testTdf115262);
+    CPPUNIT_TEST(testTdf121962);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1579,6 +1581,34 @@ void PdfExportTest::testTdf115262()
     FPDFText_ClosePage(pTextPage);
 }
 
+void PdfExportTest::testTdf121962()
+{
+    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf121962.odt";
+    utl::MediaDescriptor aMediaDescriptor;
+    aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+    auto pPdfDocument = exportAndParse(aURL, aMediaDescriptor);
+    CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
+
+    // Get the first page
+    PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
+    CPPUNIT_ASSERT(pPdfPage.get());
+    FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get());
+
+    // Make sure the table sum is displayed as "0", not faulty expression.
+    int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
+    for (int i = 0; i < nPageObjectCount; ++i)
+    {
+        FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), i);
+        if (FPDFPageObj_GetType(pPageObject) != FPDF_PAGEOBJ_TEXT)
+            continue;
+        unsigned long nTextSize = FPDFTextObj_GetText(pPageObject, pTextPage, nullptr, 0);
+        std::vector<sal_Unicode> aText(nTextSize);
+        FPDFTextObj_GetText(pPageObject, pTextPage, aText.data(), nTextSize);
+        OUString sText(aText.data(), nTextSize / 2 - 1);
+        CPPUNIT_ASSERT(sText != "** Expression is faulty **");
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(PdfExportTest);
 
 }


More information about the Libreoffice-commits mailing list