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

Jan Holesovsky kendy at collabora.com
Tue Oct 13 02:09:27 PDT 2015


 sw/CppunitTest_sw_ww8export.mk       |    5 ++++-
 sw/qa/extras/ww8export/ww8export.cxx |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit b630f9a36a844f46757abb6ce16fa7cd527a4341
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Oct 13 11:00:43 2015 +0200

    tdf#94386: Unit test stub - emulates the steps to trigger the bug.
    
    [But does not assert the result yet.]
    
    Change-Id: I7a9c64057339538f80d57c21fce83f4b23cdf396

diff --git a/sw/CppunitTest_sw_ww8export.mk b/sw/CppunitTest_sw_ww8export.mk
index d7ea011..8ec16bc 100644
--- a/sw/CppunitTest_sw_ww8export.mk
+++ b/sw/CppunitTest_sw_ww8export.mk
@@ -24,6 +24,8 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8export, \
     test \
     unotest \
     utl \
+    sfx \
+    svl \
     sw \
     tl \
 	$(gb_UWINAPI) \
@@ -37,7 +39,8 @@ $(eval $(call gb_CppunitTest_use_externals,sw_ww8export,\
 $(eval $(call gb_CppunitTest_set_include,sw_ww8export,\
     -I$(SRCDIR)/sw/inc \
     -I$(SRCDIR)/sw/source/core/inc \
-	-I$(SRCDIR)/sw/qa/extras/inc \
+    -I$(SRCDIR)/sw/source/uibase/inc \
+    -I$(SRCDIR)/sw/qa/extras/inc \
     $$(INCLUDE) \
 ))
 
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index d2374ec..4268e4f 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -20,6 +20,15 @@
 #include <com/sun/star/text/XFormField.hpp>
 #include <com/sun/star/view/DocumentZoomType.hpp>
 
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+
+#include <cmdid.h>
+#include <envimg.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+
 class Test : public SwModelTestBase
 {
 public:
@@ -53,6 +62,23 @@ protected:
         }
         return false;
     }
+
+    virtual void postLoad(const char* pFilename) SAL_OVERRIDE
+    {
+        if (OString(pFilename) == "tdf94386.odt")
+        {
+            SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+            CPPUNIT_ASSERT(pTextDoc);
+            SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+
+            // emulate the behavior from tdf#94386 - insert an envelope to the
+            // document
+            SfxItemSet aSet(pWrtShell->GetView().GetCurShell()->GetPool(), FN_ENVELOP, FN_ENVELOP);
+            aSet.Put(SwEnvItem());
+            SfxRequest aRequest(FN_ENVELOP, SfxCallMode::SYNCHRON, aSet);
+            SW_MOD()->ExecOther(aRequest);
+        }
+    }
 };
 
 DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc")
@@ -542,6 +568,12 @@ DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
     //the save must survive without asserting
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt")
+{
+    // TODO: assert here that the 2nd page has the right size even after
+    // the save as .doc
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list