[Libreoffice-commits] core.git: sw/qa
Pierre-Eric Pelloux-Prayer
pierre-eric at lanedo.com
Sun Sep 1 04:55:31 PDT 2013
sw/qa/extras/ooxmlexport/data/a4andborders.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 14 ++++++++++++++
2 files changed, 14 insertions(+)
New commits:
commit 91455ec39fef5b16fc6873a51d3963941a952347
Author: Pierre-Eric Pelloux-Prayer <pierre-eric at lanedo.com>
Date: Wed Aug 28 15:30:27 2013 +0200
docx export: add unit test for page size with page borders
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Change-Id: I999fa2893fc404f90136b2a2e79aefa93f177896
Reviewed-on: https://gerrit.libreoffice.org/5665
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/qa/extras/ooxmlexport/data/a4andborders.docx b/sw/qa/extras/ooxmlexport/data/a4andborders.docx
new file mode 100755
index 0000000..afeb91c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/a4andborders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b9c5ba7..1445ccc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -114,6 +114,7 @@ public:
void testTransparentShadow();
void testBnc834035();
void testFdo68418();
+ void testA4AndBorders();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -204,6 +205,7 @@ void Test::run()
{"transparent-shadow.docx", &Test::testTransparentShadow},
{"bnc834035.odt", &Test::testBnc834035},
{"fdo68418.docx", &Test::testFdo68418},
+ {"a4andborders.docx", &Test::testA4AndBorders},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -1250,6 +1252,18 @@ void Test::testFdo68418()
CPPUNIT_ASSERT_EQUAL(OUString("aaaa"), xFooterParagraph->getString()); // I get an error that it expects ''
}
+void Test::testA4AndBorders()
+{
+ /*
+ * The problem was that in case of a document with borders, the pgSz attribute
+ * was exported as a child of pgBorders, thus being ignored on reload.
+ * We assert dimension against A4 size in mm (to avoid minor rounding errors)
+ */
+ uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect Page Width (mm)", sal_Int32(210), getProperty<sal_Int32>(xPageStyle, "Width") / 100);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect Page Height (mm)", sal_Int32(297), getProperty<sal_Int32>(xPageStyle, "Height") / 100);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list