From 147d3f61c4730ac1e545b02888a043f88dc8e3ad Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 10 Jun 2014 16:33:39 +0200 Subject: [PATCH] CppunitTest_sw_ooxmlexport: port testTextFrameBorders to textboxes Change-Id: Idf837c1eecc3a5e0d6c82126685e4720e78b4481 --- sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 35 ++++++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index df61c77e2eaf..33556d19d806 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 xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); - uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty(xFrame, "BackColor")); + if (xIndexAccess->getCount()) + { + // After import, a TextFrame is created by the VML import. + uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty(xFrame, "BackColor")); - table::BorderLine2 aBorder = getProperty(xFrame, "TopBorder"); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aBorder.Color); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(35), aBorder.LineWidth); + table::BorderLine2 aBorder = getProperty(xFrame, "TopBorder"); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aBorder.Color); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(35), aBorder.LineWidth); - table::ShadowFormat aShadowFormat = getProperty(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(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 xShape(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), getProperty(xShape, "FillColor")); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), getProperty(xShape, "LineColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(35), getProperty(xShape, "LineWidth")); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(48), getProperty(xShape, "ShadowXDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(48), getProperty(xShape, "ShadowYDistance")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), getProperty(xShape, "ShadowColor")); + } } DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, "textframe-gradient.docx")