summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf123354.docxbin0 -> 33106 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport15.cxx22
2 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123354.docx b/sw/qa/extras/ooxmlexport/data/tdf123354.docx
new file mode 100644
index 000000000000..15c7663c645c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf123354.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 85e7097093d0..cd3dc8021f2a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -16,6 +16,8 @@
#include <com/sun/star/text/XTextColumns.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XTextField.hpp>
char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
@@ -69,6 +71,26 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf118701, "tdf118701.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[10]/w:pPr[1]/w:numPr", 1);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf123354, "tdf123354.docx")
+{
+ // Tests cell formula ABS(x) to SQRT(x POW 2) 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("SQRT((-234) POW 2)"), xEnumerationAccess1->getPresentation(true).trim());
+ CPPUNIT_ASSERT_EQUAL(OUString("234"), xEnumerationAccess1->getPresentation(false).trim());
+
+ uno::Reference<text::XTextField> xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("SQRT((SUM(<A1:B1>)-SUM(<A2>)*2) POW 2)"), xEnumerationAccess2->getPresentation(true).trim());
+ CPPUNIT_ASSERT_EQUAL(OUString("700035"), xEnumerationAccess2->getPresentation(false).trim());
+
+ uno::Reference<text::XTextField> xEnumerationAccess3(xFields->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("SQRT((<A1>) POW 2)"), xEnumerationAccess3->getPresentation(true).trim());
+ CPPUNIT_ASSERT_EQUAL(OUString("233423"), xEnumerationAccess3->getPresentation(false).trim());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf98000_changePageStyle, "tdf98000_changePageStyle.odt")
{
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);