summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2014-09-27 16:59:48 +0200
committerAndras Timar <andras.timar@collabora.com>2014-10-14 15:27:51 +0200
commitfb03b5419e03af611ce1d349ee912efed4b09d17 (patch)
tree8cf2e84bf6d34abe3eaebdf2e02736c8804de3b3 /sw/qa
parentee4b1ce2e20b81427c060bea429467bb6b9bc63f (diff)
fix/improve handling of mso-position-(horizontal|vertical)(-relative)
This is a squash of commits f6fa787 to e5bbc721 . Change-Id: Ieb76ccb2fe8a425af3204de144021b7a731d0778 Reviewed-on: https://gerrit.libreoffice.org/11701 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docxbin0 -> 7751 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx37
2 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docx b/sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docx
new file mode 100644
index 000000000000..2fb28ecfb3fd
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 55902469123b..18c15fafa0b9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3658,6 +3658,43 @@ DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, "footer-body-distance.docx")
#endif
+DECLARE_OOXMLEXPORT_TEST(testMsoPosition, "bnc884615-mso-position.docx")
+{
+ if(xmlDocPtr doc = parseExport("word/footer1.xml"))
+ {
+ // We write the frames out in different order than they were read, so check it's the correct
+ // textbox first by checking width. These tests may need reordering if that gets fixed.
+ OUString style1 = getXPath(doc, "/w:ftr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
+ CPPUNIT_ASSERT( style1.indexOf( ";width:531pt;" ) >= 0 );
+ CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" ) >= 0 );
+ CPPUNIT_ASSERT( style1.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 );
+ OUString style2 = getXPath(doc, "/w:ftr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
+ CPPUNIT_ASSERT( style2.indexOf( ";width:549pt;" ) >= 0 );
+ CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:text" ) >= 0 );
+ CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal:center" ) >= 0 );
+ CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal-relative:text" ) >= 0 );
+ OUString style3 = getXPath(doc, "/w:ftr/w:p/w:r[5]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
+ CPPUNIT_ASSERT( style3.indexOf( ";width:36pt;" ) >= 0 );
+ CPPUNIT_ASSERT( style3.indexOf( ";mso-position-horizontal-relative:text" ) >= 0 );
+ CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:text" ) >= 0 );
+ }
+ if(xmlDocPtr doc = parseExport("word/header1.xml"))
+ {
+ OUString style1 = getXPath(doc, "/w:hdr/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
+ CPPUNIT_ASSERT( style1.indexOf( ";width:335.75pt;" ) >= 0 );
+ CPPUNIT_ASSERT( style1.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 );
+ CPPUNIT_ASSERT( style1.indexOf( ";mso-position-vertical-relative:page" ) >= 0 );
+ OUString style2 = getXPath(doc, "/w:hdr/w:p/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
+ CPPUNIT_ASSERT( style2.indexOf( ";width:138.15pt;" ) >= 0 );
+ CPPUNIT_ASSERT( style2.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 );
+ CPPUNIT_ASSERT( style2.indexOf( ";mso-position-vertical-relative:page" ) >= 0 );
+ OUString style3 = getXPath(doc, "/w:hdr/w:p/w:r[4]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "style");
+ CPPUNIT_ASSERT( style3.indexOf( ";width:163.8pt;" ) >= 0 );
+ CPPUNIT_ASSERT( style3.indexOf( ";mso-position-horizontal-relative:page" ) >= 0 );
+ CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:page" ) >= 0 );
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */