diff options
author | László Németh <nemeth@numbertext.org> | 2020-08-20 19:41:00 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-08-20 22:05:28 +0200 |
commit | 4d9b72d1c3929eca04c7a2e363ab6214676b0f64 (patch) | |
tree | 7665089d6ac8bdaf9079d091093ed868117a2a41 /sw | |
parent | 64e19525eebd0974f1609300d95a74c1e083e8e3 (diff) |
tdf#123390 DOCX import: fix SIGN formula
Convert SIGN(x) to the equivalent, but
portable Writer formula (0 < x) - (x < 0).
Note: this is a temporary conversion, which
supports only 1-level nesting of function calls.
Adding SIGN to Writer core, it will be possible
to remove portable conversion later.
Change-Id: I88853fe865808427c966b8570a052b101fecdac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101085
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf123390.docx | bin | 0 -> 25081 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123390.docx b/sw/qa/extras/ooxmlexport/data/tdf123390.docx Binary files differnew file mode 100644 index 000000000000..c3591dbfd2e6 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf123390.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index cd3dc8021f2a..c9cc9bd617c3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -91,6 +91,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123354, "tdf123354.docx") CPPUNIT_ASSERT_EQUAL(OUString("233423"), xEnumerationAccess3->getPresentation(false).trim()); } +DECLARE_OOXMLEXPORT_TEST(testTdf123390, "tdf123390.docx") +{ + // Tests cell formula SIGN(x) to (0 < x) - (x < 0) conversion + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + + uno::Reference<text::XTextField> xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((0 L (-11)) - ((-11) L 0))"), xEnumerationAccess1->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("-1"), xEnumerationAccess1->getPresentation(false).trim()); + + uno::Reference<text::XTextField> xEnumerationAccess4(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((0 L (<B2>)) - ((<B2>) L 0))"), xEnumerationAccess4->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("0"), xEnumerationAccess4->getPresentation(false).trim()); + + uno::Reference<text::XTextField> xEnumerationAccess3(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((0 L (0)) - ((0) L 0))"), xEnumerationAccess3->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("0"), xEnumerationAccess3->getPresentation(false).trim()); + + uno::Reference<text::XTextField> xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("((0 L (<B1>)) - ((<B1>) L 0))"), xEnumerationAccess2->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xEnumerationAccess2->getPresentation(false).trim()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf98000_changePageStyle, "tdf98000_changePageStyle.odt") { uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); |