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

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Jun 22 10:09:00 PDT 2012


 sw/qa/extras/rtftok/data/fdo46966.rtf             |   10 ++++++++++
 sw/qa/extras/rtftok/rtftok.cxx                    |   17 +++++++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    3 ++-
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 4148d1bd400fe86b44e527a9fe11613c4437594c
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 22 18:55:15 2012 +0200

    fdo#46966 dmapper: fix headery/footery default value
    
    The docx spec doesn't say what is the default value, the rtf spec says
    it's 720, not 1440.
    
    Change-Id: Icb331591d4f2f96a7786f808d99af5974e645f8e

diff --git a/sw/qa/extras/rtftok/data/fdo46966.rtf b/sw/qa/extras/rtftok/data/fdo46966.rtf
new file mode 100644
index 0000000..de0f7df
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo46966.rtf
@@ -0,0 +1,10 @@
+{\rtf1\ansi
+{\fonttbl{\f0 Times New Roman;}}
+{\stylesheet{\s0\snext0\f0\fs24 Normal;}}
+
+\margl720\margr1440\margt720\margb1440
+\sectd
+\marglsxn720\margrsxn1440\margtsxn720\margbsxn1440
+{\header Header}
+Text
+\par }
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index e7ed1bb..fef82e2 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -96,6 +96,7 @@ public:
     void testFdo50539();
     void testFdo50665();
     void testFdo49659();
+    void testFdo46966();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -135,6 +136,7 @@ public:
     CPPUNIT_TEST(testFdo50539);
     CPPUNIT_TEST(testFdo50665);
     CPPUNIT_TEST(testFdo49659);
+    CPPUNIT_TEST(testFdo46966);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -794,6 +796,21 @@ void Test::testFdo49659()
     CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, nValue);
 }
 
+void Test::testFdo46966()
+{
+    /*
+     * The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch).
+     *
+     * xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin
+     */
+    load("fdo46966.rtf");
+
+    uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
+    sal_Int32 nValue = 0;
+    xPropertySet->getPropertyValue("TopMargin") >>= nValue;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(720)), nValue);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a38aec4..8e6d2c6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3370,7 +3370,8 @@ void DomainMapper_Impl::SetPageMarginTwip( PageMarElement eElement, sal_Int32 nV
 
 _PageMar::_PageMar()
 {
-    header = footer = top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440));
+    header = footer = ConversionHelper::convertTwipToMM100(sal_Int32(720));
+    top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440));
     right = left = ConversionHelper::convertTwipToMM100( sal_Int32(1800));
     gutter = 0;
 }


More information about the Libreoffice-commits mailing list