diff options
author | Pierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com> | 2013-08-28 15:30:27 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-01 11:55:11 +0000 |
commit | 91455ec39fef5b16fc6873a51d3963941a952347 (patch) | |
tree | 1c75adf233b49248cbca8e4d29009b638c24972a /sw | |
parent | 7a64fe91db5fb231b3d980fb5d41fcdc87f86794 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rwxr-xr-x | sw/qa/extras/ooxmlexport/data/a4andborders.docx | bin | 0 -> 10014 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 14 |
2 files changed, 14 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/a4andborders.docx b/sw/qa/extras/ooxmlexport/data/a4andborders.docx Binary files differnew file mode 100755 index 000000000000..afeb91cda73d --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/a4andborders.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index b9c5ba77fd77..1445cccceb11 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(); |