diff options
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/tiledrendering/data/2slides.odp | bin | 0 -> 10984 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/data/2slides.odp b/sd/qa/unit/tiledrendering/data/2slides.odp Binary files differnew file mode 100644 index 000000000000..baa42ba9fca5 --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/2slides.odp diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 3f1a08c8372d..14dfb2a64244 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -77,6 +77,7 @@ public: void testCreateViewGraphicSelection(); void testCreateViewTextCursor(); void testTdf102223(); + void testPostKeyEventInvalidation(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -105,6 +106,7 @@ public: CPPUNIT_TEST(testCreateViewGraphicSelection); CPPUNIT_TEST(testCreateViewTextCursor); CPPUNIT_TEST(testTdf102223); + CPPUNIT_TEST(testPostKeyEventInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1289,6 +1291,51 @@ void SdTiledRenderingTest::testTdf102223() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testPostKeyEventInvalidation() +{ + // Load a document and begin text edit on the first slide. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("2slides.odp"); + CPPUNIT_ASSERT_EQUAL(0, pXImpressDocument->getPart()); + ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdrView* pView = pViewShell->GetView(); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F2); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_F2); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(pView->GetTextEditObject()); + + // Create a second view and begin text edit there as well, in parallel. + SfxLokHelper::createView(); + pXImpressDocument->initializeForTiledRendering({}); + ViewCallback aView2; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); + pXImpressDocument->setPart(1); + sd::ViewShell* pViewShell2 = pXImpressDocument->GetDocShell()->GetViewShell(); + SdrView* pView2 = pViewShell2->GetView(); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F2); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_F2); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(pView2->GetTextEditObject()); + + // Now go left with the cursor in the second view an watch for + // invalidations. + aView2.m_bTilesInvalidated = false; + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT); + Scheduler::ProcessEventsToIdle(); + // This failed: moving the cursor caused unexpected invalidation. + CPPUNIT_ASSERT(!aView2.m_bTilesInvalidated); + + mxComponent->dispose(); + mxComponent.clear(); + comphelper::LibreOfficeKit::setActive(false); +} CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); |