sw/qa/extras/tiledrendering/data/dummy.fodt | 8 +++++ sw/qa/extras/tiledrendering/data/set-text-selection.fodt | 8 ----- sw/qa/extras/tiledrendering/tiledrendering.cxx | 21 ++++++++++++++- 3 files changed, 28 insertions(+), 9 deletions(-)
New commits: commit e75ff5473102539493d2c230e675440180ecb775 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Mar 16 17:42:38 2015 +0100 Add SwXTextDocument::postMouseEvent() testcase. Change-Id: I8cb072b81e005e435577b617204e02fa94ff9f88 diff --git a/sw/qa/extras/tiledrendering/data/set-text-selection.fodt b/sw/qa/extras/tiledrendering/data/dummy.fodt similarity index 100% rename from sw/qa/extras/tiledrendering/data/set-text-selection.fodt rename to sw/qa/extras/tiledrendering/data/dummy.fodt diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index c5ebde7..2b28b7c 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -22,11 +22,13 @@ class SwTiledRenderingTest : public SwModelTestBase { public: + void testPostMouseEvent(); void testSetTextSelection(); void testSetGraphicSelection(); void testResetSelection(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); + CPPUNIT_TEST(testPostMouseEvent); CPPUNIT_TEST(testSetTextSelection); CPPUNIT_TEST(testSetGraphicSelection); CPPUNIT_TEST(testResetSelection); @@ -46,9 +48,26 @@ SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName) return pTextDocument; } +void SwTiledRenderingTest::testPostMouseEvent() +{ + SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false); + // Did we manage to go after the first character? + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), pShellCrsr->GetPoint()->nContent.GetIndex()); + + Point aStart = pShellCrsr->GetSttPos(); + aStart.setX(aStart.getX() - 1000); + pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aStart.getX(), aStart.getY(), 1); + pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aStart.getX(), aStart.getY(), 1); + // The new cursor position must be before the first word. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), pShellCrsr->GetPoint()->nContent.GetIndex()); +} + void SwTiledRenderingTest::testSetTextSelection() { - SwXTextDocument* pXTextDocument = createDoc("set-text-selection.fodt"); + SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); // Move the cursor into the second word. pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 5, /*bBasicCall=*/false); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits