[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 7 08:36:35 PST 2014


 sw/qa/extras/ooxmlimport/data/strict.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |    6 +++++-
 writerfilter/source/ooxml/model.xml       |    1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 195b8491d0299038fb64d19463e3ce90905bf346
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 7 16:57:42 2014 +0100

    DOCX strict import: fix headers
    
    Now that the document has a header, better to just test the bottom
    margin, as in case there is a header, the top margin has different
    semantics in Word and Writer.
    
    Change-Id: I11212965ecd364cdc8a205c3ab3b8b71ed12944b

diff --git a/sw/qa/extras/ooxmlimport/data/strict.docx b/sw/qa/extras/ooxmlimport/data/strict.docx
index 4195398..57d671f 100644
Binary files a/sw/qa/extras/ooxmlimport/data/strict.docx and b/sw/qa/extras/ooxmlimport/data/strict.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2503c81..d0c0b4a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1908,11 +1908,15 @@ DECLARE_OOXMLIMPORT_TEST(testStrict, "strict.docx")
 {
     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
     // This was only 127, pt suffix was ignored, so this got parsed as twips instead of points.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(72 * 20)), getProperty<sal_Int32>(xPageStyle, "TopMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(72 * 20)), getProperty<sal_Int32>(xPageStyle, "BottomMargin"));
     // This was only 1397, same issue
     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(792 * 20)), getProperty<sal_Int32>(xPageStyle, "Height"));
     // Text was missing, due to not handling the strict namespaces.
     getParagraph(1, "Hello world!");
+
+    // Header in the document caused a crash on import.
+    uno::Reference<text::XText> xHeaderText(xPageStyle->getPropertyValue("HeaderText"), uno::UNO_QUERY);
+    getParagraphOfText(1, xHeaderText, "This is a header.");
 }
 
 #endif
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 0a84d4f..c31bbef 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -19,6 +19,7 @@
 <model xmlns:rng="http://relaxng.org/ns/structure/1.0">
   <namespace-alias name="http://www.w3.org/XML/1998/namespace" alias="xml" id="xml"/>
   <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships" alias="relationships" id="officeRel"/>
+  <namespace-alias name="http://purl.oclc.org/ooxml/officeDocument/relationships" alias="relationships" id="officeRel"/>
   <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="office" id="vmlOffice"/>
   <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme" id="officeRelTheme"/>
   <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing" id="dmlWordDr"/>


More information about the Libreoffice-commits mailing list