summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 23d3fe281440..67c04db7df2c 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");