[Libreoffice-commits] core.git: sw/CppunitTest_sw_htmlexport.mk sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 12 02:03:30 PST 2013


 sw/CppunitTest_sw_htmlexport.mk        |    2 ++
 sw/qa/extras/htmlexport/htmlexport.cxx |   18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 12fd49a2701f4d23f23f0770bd40c8cd20b523c7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 12 11:00:24 2013 +0100

    CppunitTest_sw_htmlexport: make this really test the exported model
    
    There were two problems here:
    
    1) The original testsuite just served as a crash-test for the HTML
    export filter, but the second testcase assumed it also reloads the
    document model. Once this is fixed, we notice that:
    
    2) There are some nasty 'mm100 <-> in' rounding errors, work this around
    by using cms unconditionally.
    
    (Exact problem was that CharTopBorderDistance was 457, but was expected
    to be 450.)
    
    Change-Id: Iaa1f98486767e4dfa81c2ca3e456bc39131977eb

diff --git a/sw/CppunitTest_sw_htmlexport.mk b/sw/CppunitTest_sw_htmlexport.mk
index 603939a..5f0ed06 100644
--- a/sw/CppunitTest_sw_htmlexport.mk
+++ b/sw/CppunitTest_sw_htmlexport.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_htmlexport, \
     comphelper \
     cppu \
 	cppuhelper \
+	i18nlangtag \
     sal \
     sw \
     test \
@@ -36,6 +37,7 @@ $(eval $(call gb_CppunitTest_use_externals,sw_htmlexport,\
 
 $(eval $(call gb_CppunitTest_set_include,sw_htmlexport,\
     -I$(SRCDIR)/sw/inc \
+	-I$(SRCDIR)/sw/source/ui/inc \
     -I$(SRCDIR)/sw/source/core/inc \
 	-I$(SRCDIR)/sw/qa/extras/inc \
     $$(INCLUDE) \
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 6ebaad5..b200cda 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -10,6 +10,8 @@
 #include <swmodeltestbase.hxx>
 #include <com/sun/star/awt/Gradient.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
+#include <swmodule.hxx>
+#include <usrpref.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -37,10 +39,22 @@ void Test::run()
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
+        FieldUnit eUnit = FUNIT_NONE;
+        if (OString(rEntry.pName) == "charborder.odt")
+        {
+            // FIXME if padding-top gets exported as inches, not cms, we get rounding errors.
+            SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(false));
+            eUnit = pPref->GetMetric();
+            pPref->SetMetric(FUNIT_CM);
+        }
         load("/sw/qa/extras/htmlexport/data/", rEntry.pName,
              false /* not doing layout is required for this test */);
-        utl::TempFile aFile;
-        save("HTML", aFile);
+        reload("HTML (StarWriter)");
+        if (OString(rEntry.pName) == "charborder.odt")
+        {
+            SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(false));
+            pPref->SetMetric(eUnit);
+        }
         (this->*rEntry.pMethod)();
         finish();
     }


More information about the Libreoffice-commits mailing list