Kaydet (Commit) d0e30c11 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

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: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 905c107c
...@@ -1159,6 +1159,10 @@ SwSbxValue SwCalc::PrimFunc(bool &rChkPow) ...@@ -1159,6 +1159,10 @@ SwSbxValue SwCalc::PrimFunc(bool &rChkPow)
return nErg; return nErg;
break; break;
} }
case CALC_RP:
// ignore, see tdf#121962
SAL_INFO("sw.calc", ")");
break;
case CALC_MEAN: case CALC_MEAN:
{ {
SAL_INFO("sw.calc", "mean"); SAL_INFO("sw.calc", "mean");
......
...@@ -116,6 +116,7 @@ public: ...@@ -116,6 +116,7 @@ public:
void testTdf106702(); void testTdf106702();
void testTdf113143(); void testTdf113143();
void testTdf115262(); void testTdf115262();
void testTdf121962();
CPPUNIT_TEST_SUITE(PdfExportTest); CPPUNIT_TEST_SUITE(PdfExportTest);
CPPUNIT_TEST(testTdf106059); CPPUNIT_TEST(testTdf106059);
...@@ -148,6 +149,7 @@ public: ...@@ -148,6 +149,7 @@ public:
CPPUNIT_TEST(testTdf106702); CPPUNIT_TEST(testTdf106702);
CPPUNIT_TEST(testTdf113143); CPPUNIT_TEST(testTdf113143);
CPPUNIT_TEST(testTdf115262); CPPUNIT_TEST(testTdf115262);
CPPUNIT_TEST(testTdf121962);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -1582,6 +1584,34 @@ void PdfExportTest::testTdf115262() ...@@ -1582,6 +1584,34 @@ void PdfExportTest::testTdf115262()
FPDFText_ClosePage(pTextPage); 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); CPPUNIT_TEST_SUITE_REGISTRATION(PdfExportTest);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment