diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Library_test.mk | 1 | ||||
-rw-r--r-- | test/source/lokcallback.cxx | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/Library_test.mk b/test/Library_test.mk index 8b1fd214490d..bee378ff34f5 100644 --- a/test/Library_test.mk +++ b/test/Library_test.mk @@ -33,6 +33,7 @@ $(eval $(call gb_Library_use_libraries,test,\ cppuhelper \ i18nlangtag \ sal \ + sfx \ svt \ test-setupvcl \ tl \ diff --git a/test/source/lokcallback.cxx b/test/source/lokcallback.cxx index 389219192a50..13d381f0b46a 100644 --- a/test/source/lokcallback.cxx +++ b/test/source/lokcallback.cxx @@ -13,16 +13,23 @@ #include <rtl/strbuf.hxx> #include <tools/gen.hxx> #include <comphelper/lok.hxx> +#include <sfx2/viewsh.hxx> TestLokCallbackWrapper::TestLokCallbackWrapper(LibreOfficeKitCallback callback, void* data) - : m_callback(callback) + : Idle("TestLokCallbackWrapper flush timer") + , m_callback(callback) , m_data(data) { + // Flushing timer needs to run with the lowest priority, so that all pending tasks + // such as invalidations are processed before it. + SetPriority(TaskPriority::LOWEST); } inline void TestLokCallbackWrapper::callCallback(int nType, const char* pPayload) { m_callback(nType, pPayload, m_data); + if (!IsActive()) + Start(); } void TestLokCallbackWrapper::libreOfficeKitViewCallback(int nType, const char* pPayload) @@ -52,4 +59,14 @@ void TestLokCallbackWrapper::libreOfficeKitViewInvalidateTilesCallback( callCallback(LOK_CALLBACK_INVALIDATE_TILES, buf.makeStringAndClear().getStr()); } +void TestLokCallbackWrapper::Invoke() +{ + // Timer timeout, flush any possibly pending data. + for (SfxViewShell* viewShell = SfxViewShell::GetFirst(false); viewShell != nullptr; + viewShell = SfxViewShell::GetNext(*viewShell, false)) + { + viewShell->flushPendingLOKInvalidateTiles(); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |