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

Miklos Vajna vmiklos at collabora.co.uk
Tue Jun 10 08:09:34 PDT 2014


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   35 +++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 9 deletions(-)

New commits:
commit 147d3f61c4730ac1e545b02888a043f88dc8e3ad
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 10 16:33:39 2014 +0200

    CppunitTest_sw_ooxmlexport: port testTextFrameBorders to textboxes
    
    Change-Id: Idf837c1eecc3a5e0d6c82126685e4720e78b4481

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index df61c77..33556d1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -522,17 +522,34 @@ DECLARE_OOXMLEXPORT_TEST(testTextFrameBorders, "textframe-borders.docx")
 {
     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
-    uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty<sal_Int32>(xFrame, "BackColor"));
+    if (xIndexAccess->getCount())
+    {
+        // After import, a TextFrame is created by the VML import.
+        uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty<sal_Int32>(xFrame, "BackColor"));
 
-    table::BorderLine2 aBorder = getProperty<table::BorderLine2>(xFrame, "TopBorder");
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aBorder.Color);
-    CPPUNIT_ASSERT_EQUAL(sal_uInt32(35), aBorder.LineWidth);
+        table::BorderLine2 aBorder = getProperty<table::BorderLine2>(xFrame, "TopBorder");
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aBorder.Color);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt32(35), aBorder.LineWidth);
 
-    table::ShadowFormat aShadowFormat = getProperty<table::ShadowFormat>(xFrame, "ShadowFormat");
-    CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadowFormat.Location);
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(48), aShadowFormat.ShadowWidth);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aShadowFormat.Color);
+        table::ShadowFormat aShadowFormat = getProperty<table::ShadowFormat>(xFrame, "ShadowFormat");
+        CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadowFormat.Location);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(48), aShadowFormat.ShadowWidth);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aShadowFormat.Color);
+    }
+    else
+    {
+        // After export and import, the result is a shape.
+        uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty<sal_Int32>(xShape, "FillColor"));
+
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), getProperty<sal_Int32>(xShape, "LineColor"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(35), getProperty<sal_Int32>(xShape, "LineWidth"));
+
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(48), getProperty<sal_Int32>(xShape, "ShadowXDistance"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(48), getProperty<sal_Int32>(xShape, "ShadowYDistance"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), getProperty<sal_Int32>(xShape, "ShadowColor"));
+    }
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, "textframe-gradient.docx")


More information about the Libreoffice-commits mailing list