summaryrefslogtreecommitdiffstats
path: root/include/test
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-10-21 12:09:56 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-10-22 15:54:18 +0200
commit5a2f4971c8e3f7c6b2caaad353ec1c2593499692 (patch)
tree1be8458bb9460d50fe3c7940da829b74c31299a7 /include/test
parentMove SalInstanceImage decl to header file (diff)
downloadcore-5a2f4971c8e3f7c6b2caaad353ec1c2593499692.tar.gz
core-5a2f4971c8e3f7c6b2caaad353ec1c2593499692.zip
revert unittests to use plain text-based LibreOfficeKitCallback
At least for now it seems that the more complex SfxLokCallbackInterface is just an unnecessary complication for unit tests. The performance doesn't matter, and handling all the specialized callbacks makes things more complicated. In the future it'd be also useful to make the tests (optionally?) use also CallbackFlushHandler as the provider of the messages, in order to test CallbackFlushHandler more thoroughly, so perhaps in the end it makes more sense to keep unit tests using the plain text interface. This reverts unittest-related parts of 3b729db05553c1a6d461fb41c89 and adds a smaller wrapper callback class that converts messages from SfxLokCallbackInterface to LibreOfficeKitCallback format. Change-Id: I6c14f0be4ed7b777444b131140be54188d309cca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124004 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'include/test')
-rw-r--r--include/test/lokcallback.hxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/test/lokcallback.hxx b/include/test/lokcallback.hxx
new file mode 100644
index 000000000000..988ce7688e93
--- /dev/null
+++ b/include/test/lokcallback.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <test/testdllapi.hxx>
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
+#include <sfx2/lokcallback.hxx>
+
+/**
+A helper to convert SfxLokCallbackInterface to a LIbreOfficeKitCallback for tests.
+
+It reimplements the specialized callbacks and converts them to the generic type/payload
+callback.
+*/
+
+class OOO_DLLPUBLIC_TEST TestLokCallbackWrapper : public SfxLokCallbackInterface
+{
+public:
+ TestLokCallbackWrapper(LibreOfficeKitCallback callback, void* data);
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) override;
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload, int nViewId) override;
+ virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect,
+ int nPart) override;
+
+private:
+ void callCallback(int nType, const char* pPayload);
+ LibreOfficeKitCallback m_callback;
+ void* m_data;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */