diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-02-24 04:44:20 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-25 21:25:48 +0200 |
commit | b7c7893e02b78947e34c7dd1015be6cad0f8d4cb (patch) | |
tree | 41738c263575a9fcac9794029ac8d21fa9be9bac /sd | |
parent | 718f05f5810eea75599f532bbc659eada8e52085 (diff) |
sd lok: Delete selection highlight after cutting text.
Call drawing also after the new selection is set, similar to
other cases where DrawSelectionXOR() is called before and after
selection change.
In desktop LO drawing is always called again and again by timeout,
so there the selection is updated anyway, while in LO online painting
does not emit a notification.
Reviewed-on: https://gerrit.libreoffice.org/50268
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 56629f9797fa1cf8b7c86b93ee2ea62673444c94)
Change-Id: I6e9337fc0cfb61656387ba44d901521c3dfa60dd
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/data/cut_selection_change.odp | bin | 0 -> 10983 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/cut_selection_change.odp b/sd/qa/unit/tiledrendering/data/cut_selection_change.odp Binary files differnew file mode 100644 index 000000000000..19d3a18480e2 --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/cut_selection_change.odp diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index b97caf538a7d..7ce798600084 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -114,6 +114,7 @@ public: void testTdf115873Group(); void testIMESupport(); void testPasteTextOnSlide(); + void testCutSelectionChange(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -159,6 +160,7 @@ public: CPPUNIT_TEST(testTdf115873Group); CPPUNIT_TEST(testIMESupport); CPPUNIT_TEST(testPasteTextOnSlide); + CPPUNIT_TEST(testCutSelectionChange); CPPUNIT_TEST_SUITE_END(); @@ -2173,6 +2175,51 @@ void SdTiledRenderingTest::testPasteTextOnSlide() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testCutSelectionChange() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("cut_selection_change.odp"); + CPPUNIT_ASSERT(pXImpressDocument); + + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this); + Scheduler::ProcessEventsToIdle(); + + // Select first text object + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + Scheduler::ProcessEventsToIdle(); + + // step into text editing + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, '1', 0); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, '1', 0); + Scheduler::ProcessEventsToIdle(); + + // select some text + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | KEY_SHIFT); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | KEY_SHIFT); + Scheduler::ProcessEventsToIdle(); + + // Check that we have a selection before cutting + CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), m_aSelection.size()); + + // Cut the selected text + comphelper::dispatchCommand(".uno:Cut", uno::Sequence<beans::PropertyValue>()); + Scheduler::ProcessEventsToIdle(); + + // Selection is removed + CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), m_aSelection.size()); + + utl::TempFile* pNewTempFile(new utl::TempFile); + FileFormat* pFormat = getFormat(ODP); + save(pXImpressDocument->GetDocShell(), pFormat, *pNewTempFile); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); |