diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-16 17:42:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-23 09:18:59 +0100 |
commit | a212fc2c00fc0c7f348aa6908b113b8ff3adbe56 (patch) | |
tree | 7a6a761a2b7a37ac599e2f856fbdb89a53756eaf /sw/qa | |
parent | 2f31ac76be64953d19a72e3d8eae42b1ac5c5473 (diff) |
Add SwXTextDocument::postMouseEvent() testcase.
Change-Id: I8cb072b81e005e435577b617204e02fa94ff9f88
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/tiledrendering/data/dummy.fodt (renamed from sw/qa/extras/tiledrendering/data/set-text-selection.fodt) | 0 | ||||
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 21 |
2 files changed, 20 insertions, 1 deletions
diff --git a/sw/qa/extras/tiledrendering/data/set-text-selection.fodt b/sw/qa/extras/tiledrendering/data/dummy.fodt index 79a34d5143a7..79a34d5143a7 100644 --- a/sw/qa/extras/tiledrendering/data/set-text-selection.fodt +++ b/sw/qa/extras/tiledrendering/data/dummy.fodt diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index e7dd7792bd36..bce4dc6f152f 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); |