diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-01-30 16:43:35 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-01-30 17:19:31 +0100 |
commit | 7877638814de86202d33b5653a0f91d63341e98c (patch) | |
tree | 8f4a5b4fafb3af2a57c3ac99b76b51cd0ba19182 /sw/qa/extras | |
parent | 1e33b3dc73e96c6c005d13e20c3f546fcb301ed8 (diff) |
n#792778 oox: implement import of v:line inside v:group
The problem was that in ShapeBase::convertAndInsert(), the rectangle
calculated for a line was zero, that's why it wasn't imported. Fix this
by overriding the get*Rectangle() methods in LineShape, instead of doing
so with implConvertAndInsert().
Change-Id: Ie4bb2f7964b438cb56e4f5ee7a4ebe9f8f8eb734
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/groupshape-line.docx | bin | 0 -> 10291 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 33 |
2 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-line.docx b/sw/qa/extras/ooxmlimport/data/groupshape-line.docx Binary files differnew file mode 100644 index 000000000000..5ee2dca887a9 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/groupshape-line.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 28db45e512f8..3abfa6d5b388 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -113,6 +113,7 @@ public: void testN792778(); void testN793262(); void testN793998(); + void testGroupshapeLine(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -178,6 +179,7 @@ void Test::run() {"n792778.docx", &Test::testN792778}, {"n793262.docx", &Test::testN793262}, {"n793998.docx", &Test::testN793998}, + {"groupshape-line.docx", &Test::testGroupshapeLine}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1101,6 +1103,37 @@ void Test::testN792778() CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape->getPosition().Y); } +void Test::testGroupshapeLine() +{ + /* + * Another fallout from n#792778, this time first the lines inside a + * groupshape wasn't imported, then the fix broke the size/position of + * non-groupshape lines. Test both here. + * + * xray ThisComponent.DrawPage.Count ' 2 shapes + * xray ThisComponent.DrawPage(0).Position 'x: 2656, y: 339 + * xray ThisComponent.DrawPage(0).Size ' width: 3270, height: 1392 + * xray ThisComponent.DrawPage(1).getByIndex(0).Position 'x: 1272, y: 2286 + * xray ThisComponent.DrawPage(1).getByIndex(0).Size 'width: 10160, height: 0 + */ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDrawPage->getCount()); + + uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2656), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(339), xShape->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3270), xShape->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1392), xShape->getSize().Height); + + uno::Reference<drawing::XShapes> xGroupShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); + xShape.set(xGroupShape->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1272), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2286), xShape->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(10160), xShape->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getSize().Height); +} + void Test::testN793262() { uno::Reference<container::XEnumerationAccess> xHeaderText = getProperty< uno::Reference<container::XEnumerationAccess> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText"); |