diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-19 17:56:35 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-19 20:10:22 +0200 |
commit | 288013f25d2e52a76f7ce5368c505a6ccb3b64a2 (patch) | |
tree | 7f2ebea4554cd171b22577c38b8105df08191739 /sw/qa/extras | |
parent | aa51bf1e17dfb4a0a95a24e7de7f55d2b44b9472 (diff) |
sw: emit LOK_CALLBACK_STATE_CHANGED when cursor enters/leaves a redline
For now only care about the start of the cursor, which can be only at a
single redline.
Add matching testcase + expose it in the gtktiledviewer status bar for
interactive manual testing.
Change-Id: Ib61757412d6b54bef64361d4a8563795ca0bab6c
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 69f965c2d8dc..f203fcaa3ae8 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -27,6 +27,7 @@ #include <wrtsh.hxx> #include <view.hxx> #include <UndoManager.hxx> +#include <cmdid.h> #include <sfx2/viewsh.hxx> #include <sfx2/lokhelper.hxx> @@ -128,6 +129,7 @@ private: int m_nInvalidations; int m_nRedlineTableSizeChanged; int m_nRedlineTableEntryModified; + int m_nTrackedChangeIndex; }; SwTiledRenderingTest::SwTiledRenderingTest() @@ -136,7 +138,8 @@ SwTiledRenderingTest::SwTiledRenderingTest() m_nSelectionAfterSearchResult(0), m_nInvalidations(0), m_nRedlineTableSizeChanged(0), - m_nRedlineTableEntryModified(0) + m_nRedlineTableEntryModified(0), + m_nTrackedChangeIndex(-1) { } @@ -157,6 +160,7 @@ void SwTiledRenderingTest::callback(int nType, const char* pPayload, void* pData void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) { + OString aPayload(pPayload); switch (nType) { case LOK_CALLBACK_INVALIDATE_TILES: @@ -220,6 +224,19 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) ++m_nRedlineTableEntryModified; } break; + case LOK_CALLBACK_STATE_CHANGED: + { + OString aTrackedChangeIndexPrefix(".uno:TrackedChangeIndex="); + if (aPayload.startsWith(aTrackedChangeIndexPrefix)) + { + OString sIndex = aPayload.copy(aTrackedChangeIndexPrefix.getLength()); + if (sIndex.isEmpty()) + m_nTrackedChangeIndex = -1; + else + m_nTrackedChangeIndex = sIndex.toInt32(); + } + } + break; } } @@ -1274,6 +1291,15 @@ void SwTiledRenderingTest::testTrackChangesCallback() // This was 0, as LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED wasn't sent. CPPUNIT_ASSERT_EQUAL(1, m_nRedlineTableSizeChanged); + CPPUNIT_ASSERT_EQUAL(-1, m_nTrackedChangeIndex); + pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + SfxItemSet aSet(pWrtShell->GetDoc()->GetAttrPool(), FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_ACCEPT_DIRECT); + SfxVoidItem aItem(FN_REDLINE_ACCEPT_DIRECT); + aSet.Put(aItem); + pWrtShell->GetView().GetState(aSet); + // This failed, LOK_CALLBACK_STATE_CHANGED wasn't sent. + CPPUNIT_ASSERT_EQUAL(0, m_nTrackedChangeIndex); + comphelper::LibreOfficeKit::setActive(false); } |