From abc28ffc04067eb24840fbf564c311aaee10f84d Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 15 Jul 2014 09:10:10 +0200 Subject: fdo#76803: Unit test so that this never regresses. Change-Id: Id0b883b7d7b902c1f8e41bcf39220ef74b3488bf --- sw/CppunitTest_sw_ooxmlimport.mk | 1 + sw/qa/extras/ooxmlimport/data/fdo76803.docx | Bin 0 -> 36516 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 31 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 sw/qa/extras/ooxmlimport/data/fdo76803.docx 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 new file mode 100644 index 000000000000..65fad065a00b Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo76803.docx differ 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 #include #include #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -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 xPropertySet(getShape(1), uno::UNO_QUERY); + + drawing::PointSequenceSequence rContour = getProperty(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(); -- cgit v1.2.3