sw/qa/extras/tiledrendering/tiledrendering.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
New commits: commit 1d03fa7dced74c5ee2c5035d31610e88d6ca8610 Author: Miklos Vajna <[email protected]> Date: Wed Apr 8 17:48:21 2015 +0200 Add SwXTextDocument::postKeyEvent() testcase. Change-Id: I76904ed9596dcb0b6aa70bccd19279573687d30c diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 23d3fe2..67c04db 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -15,6 +15,7 @@ #include <vcl/svapp.hxx> #include <crsskip.hxx> #include <drawdoc.hxx> +#include <ndtxt.hxx> #include <wrtsh.hxx> static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/"; @@ -24,6 +25,7 @@ class SwTiledRenderingTest : public SwModelTestBase { public: void testRegisterCallback(); + void testPostKeyEvent(); void testPostMouseEvent(); void testSetTextSelection(); void testSetGraphicSelection(); @@ -31,6 +33,7 @@ public: CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); + CPPUNIT_TEST(testPostKeyEvent); CPPUNIT_TEST(testPostMouseEvent); CPPUNIT_TEST(testSetTextSelection); CPPUNIT_TEST(testSetGraphicSelection); @@ -110,6 +113,21 @@ void SwTiledRenderingTest::testRegisterCallback() #endif } +void SwTiledRenderingTest::testPostKeyEvent() +{ + 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()); + + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); + // Did we manage to insert the character after the first one? + CPPUNIT_ASSERT_EQUAL(OUString("Axaa bbb."), pShellCrsr->GetPoint()->nNode.GetNode().GetTxtNode()->GetTxt()); +} + void SwTiledRenderingTest::testPostMouseEvent() { SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
