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

Oliver Specht oliver.specht at cib.de
Fri Oct 23 00:40:00 PDT 2015


 sw/qa/extras/ww8export/ww8export.cxx |   25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 8110b255990baf650373dd88ef17390952a788a6
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Wed Oct 14 14:02:12 2015 +0200

    tdf#94386: envelope unit test completed
    
    added check for different page styles with different size
    to testTdf94386
    
    Change-Id: I4eb1c8669661285d2c98f6c5e9993af26c005d45
    Reviewed-on: https://gerrit.libreoffice.org/19371
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 6a54c5d..c3091eb 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -9,6 +9,7 @@
 
 #include <swmodeltestbase.hxx>
 
+#include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
@@ -597,8 +598,28 @@ DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
 
 DECLARE_WW8EXPORT_TEST(testTdf94386, "tdf94386.odt")
 {
-    // TODO: assert here that the 2nd page has the right size even after
-    // the save as .doc
+    // check that the first and next page use different page styles
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+        xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<text::XPageCursor> xCursor(
+        xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+
+    xCursor->jumpToFirstPage();
+    OUString firstPageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+    xCursor->jumpToLastPage();
+    OUString lastPageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+    CPPUNIT_ASSERT_EQUAL(false, firstPageStyleName.equals(lastPageStyleName));
+
+    uno::Reference<beans::XPropertySet> xFirstPropertySet(getStyles("PageStyles")->getByName(firstPageStyleName), uno::UNO_QUERY);
+    awt::Size fSize;
+    xFirstPropertySet->getPropertyValue("Size") >>= fSize;
+
+    uno::Reference<beans::XPropertySet> xNextPropertySet(getStyles("PageStyles")->getByName(lastPageStyleName), uno::UNO_QUERY);
+    awt::Size lSize;
+    xNextPropertySet->getPropertyValue("Size") >>= lSize;
+    bool isEqual = (fSize.Width == lSize.Width) || (fSize.Height == lSize.Height);
+    CPPUNIT_ASSERT_EQUAL(false, isEqual);
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list