summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-12-11 10:52:50 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-12-13 00:41:03 +0100
commit47180e4b83b5371d4006789261937de05e47a076 (patch)
tree7520ff86af0c20da08504bde4c0a77c5fb2d7277
parent9df01c894d73e744a9d55c3db64f052a8f496287 (diff)
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@cib.de> (cherry picked from commit d0e30c11740ba22af5f6a8156dd00dad8c378b2a) Reviewed-on: https://gerrit.libreoffice.org/64969 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sw/source/core/bastyp/calc.cxx3
-rw-r--r--vcl/qa/cppunit/pdfexport/data/tdf121962.odtbin0 -> 14974 bytes
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport.cxx30
3 files changed, 33 insertions, 0 deletions
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
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/tdf121962.odt
Binary files 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);
}