diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-14 12:44:29 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-14 13:59:59 +0200 |
commit | 87b682500f481b61399609b24a4a695fda93f552 (patch) | |
tree | 4ebcb09365f24a790263b2ea8e7bde80d271af4f /sd/qa | |
parent | 36ff8bf48b9384b91f2999bc18b567864226125d (diff) |
Add SdXImpressDocument::setGraphicSelection() testcase.
Change-Id: Ifdf3ef84cd886b338536629fb36ebba694916d6a
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/tiledrendering/data/shape.odp | bin | 0 -> 10159 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/data/shape.odp b/sd/qa/unit/tiledrendering/data/shape.odp Binary files differnew file mode 100644 index 000000000000..f73476140d73 --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/shape.odp diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 1b87768b241e..16ec35191641 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -43,6 +43,7 @@ public: void testPostKeyEvent(); void testPostMouseEvent(); void testSetTextSelection(); + void testSetGraphicSelection(); #endif CPPUNIT_TEST_SUITE(SdTiledRenderingTest); @@ -51,6 +52,7 @@ public: CPPUNIT_TEST(testPostKeyEvent); CPPUNIT_TEST(testPostMouseEvent); CPPUNIT_TEST(testSetTextSelection); + CPPUNIT_TEST(testSetGraphicSelection); #endif CPPUNIT_TEST_SUITE_END(); @@ -219,6 +221,28 @@ void SdTiledRenderingTest::testSetTextSelection() // The new selection must include the ending dot, too -- but not the first word. CPPUNIT_ASSERT_EQUAL(OUString("bbb."), rEditView.GetSelected()); } + +void SdTiledRenderingTest::testSetGraphicSelection() +{ + SdXImpressDocument* pXImpressDocument = createDoc("shape.odp"); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdPage* pPage = pViewShell->GetActualPage(); + SdrObject* pObject = pPage->GetObj(0); + // Make sure the rectangle has 8 handles: at each corner and at the center of each edge. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(8), pObject->GetHdlCount()); + // Take the bottom center one. + SdrHdl* pHdl = pObject->GetHdl(6); + CPPUNIT_ASSERT_EQUAL(HDL_LOWER, pHdl->GetKind()); + Rectangle aShapeBefore = pObject->GetSnapRect(); + // Resize. + pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, convertMm100ToTwip(pHdl->GetPos().getX()), convertMm100ToTwip(pHdl->GetPos().getY())); + pXImpressDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, convertMm100ToTwip(pHdl->GetPos().getX()), convertMm100ToTwip(pHdl->GetPos().getY() + 1000)); + Rectangle aShapeAfter = pObject->GetSnapRect(); + // Check that a resize happened, but aspect ratio is not kept. + CPPUNIT_ASSERT_EQUAL(aShapeBefore.getWidth(), aShapeAfter.getWidth()); + CPPUNIT_ASSERT(aShapeBefore.getHeight() < aShapeAfter.getHeight()); +} + #endif CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); |