[Libreoffice-commits] .: sw/qa

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Feb 27 02:22:24 PST 2012


 sw/qa/extras/rtftok/data/fdo45187.rtf |   32 ++++++++++++++++++++++++++++++++
 sw/qa/extras/rtftok/rtftok.cxx        |   22 ++++++++++++++++++++++
 2 files changed, 54 insertions(+)

New commits:
commit bb4ceaa4bbe253f4d6b22b09098de0f2f0b793c8
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Feb 27 11:19:38 2012 +0100

    add testcase for fdo#45187

diff --git a/sw/qa/extras/rtftok/data/fdo45187.rtf b/sw/qa/extras/rtftok/data/fdo45187.rtf
new file mode 100644
index 0000000..61b71ad
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo45187.rtf
@@ -0,0 +1,32 @@
+{\rtf1
+{\field
+{\*\fldinst SHAPE }
+{\fldrslt
+{\shp
+{\*\shpinst\shpleft1000\shptop1000\shpright2000\shpbottom2000
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+}
+}
+}
+}
+first
+\par
+{\field
+{\*\fldinst SHAPE }
+{\fldrslt
+{\shp
+{\*\shpinst\shpleft1000\shptop3000\shpright2000\shpbottom4000
+{\sp
+{\sn shapeType}
+{\sv 3}
+}
+}
+}
+}
+}
+second
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 92c3229..0e4a31b 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -59,6 +59,7 @@ public:
     void testFdo45543();
     void testN695479();
     void testFdo42465();
+    void testFdo45187();
 
     CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX) && !defined(WNT)
@@ -67,6 +68,7 @@ public:
     CPPUNIT_TEST(testFdo45543);
     CPPUNIT_TEST(testN695479);
     CPPUNIT_TEST(testFdo42465);
+    CPPUNIT_TEST(testFdo45187);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -244,6 +246,26 @@ void RtfModelTest::testFdo42465()
     CPPUNIT_ASSERT_EQUAL(3, getLength());
 }
 
+void RtfModelTest::testFdo45187()
+{
+    load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo45187.rtf")));
+
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    // There should be two shapes.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
+    // They should be anchored to different paragraphs.
+    uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
+    uno::Any aValue = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorPosition")));
+    awt::Point aFirstPoint;
+    aValue >>= aFirstPoint;
+    xPropertySet.set(xDraws->getByIndex(1), uno::UNO_QUERY);
+    aValue = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorPosition")));
+    awt::Point aSecondPoint;
+    aValue >>= aSecondPoint;
+    CPPUNIT_ASSERT(aFirstPoint.Y != aSecondPoint.Y);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list