diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-07-15 09:10:10 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-07-15 09:16:08 +0200 |
commit | abc28ffc04067eb24840fbf564c311aaee10f84d (patch) | |
tree | 0ed449b055c3205b659869e38f0aeb231b749210 /sw | |
parent | 003434f1e2f4bd7ec08d2428fe2b90c11e680cef (diff) |
fdo#76803: Unit test so that this never regresses.
Change-Id: Id0b883b7d7b902c1f8e41bcf39220ef74b3488bf
Diffstat (limited to 'sw')
-rw-r--r-- | sw/CppunitTest_sw_ooxmlimport.mk | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/fdo76803.docx | bin | 0 -> 36516 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 31 |
3 files changed, 32 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_ooxmlimport.mk b/sw/CppunitTest_sw_ooxmlimport.mk index 7eff1bc68ea3..682b31c3eaa0 100644 --- a/sw/CppunitTest_sw_ooxmlimport.mk +++ b/sw/CppunitTest_sw_ooxmlimport.mk @@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_ooxmlimport, \ )) $(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlimport, \ + basegfx \ comphelper \ cppu \ cppuhelper \ diff --git a/sw/qa/extras/ooxmlimport/data/fdo76803.docx b/sw/qa/extras/ooxmlimport/data/fdo76803.docx Binary files differnew file mode 100644 index 000000000000..65fad065a00b --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/fdo76803.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 954dae38e374..8d85f1dba7b7 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -12,6 +12,7 @@ #if !defined(WNT) +#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontWeight.hpp> @@ -19,6 +20,7 @@ #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp> #include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/PointSequenceSequence.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> @@ -2245,6 +2247,35 @@ DECLARE_OOXMLIMPORT_TEST(testFdo80555, "fdo80555.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(245), xShape->getPosition().Y); } +DECLARE_OOXMLIMPORT_TEST(testFdo76803, "fdo76803.docx") +{ + // The ContourPolyPolygon was wrong + uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY); + + drawing::PointSequenceSequence rContour = getProperty<drawing::PointSequenceSequence>(xPropertySet, "ContourPolyPolygon"); + basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(rContour)); + + // We've got exactly one polygon inside + CPPUNIT_ASSERT_EQUAL(sal_uInt32(1), aPolyPolygon.count()); + + // Now check it deeply + basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0)); + + CPPUNIT_ASSERT_EQUAL(sal_uInt32(4), aPolygon.count()); + + CPPUNIT_ASSERT_EQUAL(double(-163), aPolygon.getB2DPoint(0).getX()); + CPPUNIT_ASSERT_EQUAL(double(0), aPolygon.getB2DPoint(0).getY()); + + CPPUNIT_ASSERT_EQUAL(double(-163), aPolygon.getB2DPoint(1).getX()); + CPPUNIT_ASSERT_EQUAL(double(3661), aPolygon.getB2DPoint(1).getY()); + + CPPUNIT_ASSERT_EQUAL(double(16988), aPolygon.getB2DPoint(2).getX()); + CPPUNIT_ASSERT_EQUAL(double(3661), aPolygon.getB2DPoint(2).getY()); + + CPPUNIT_ASSERT_EQUAL(double(16988), aPolygon.getB2DPoint(3).getX()); + CPPUNIT_ASSERT_EQUAL(double(0), aPolygon.getB2DPoint(3).getY()); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); |