[Libreoffice-commits] core.git: sc/qa
Miklos Vajna
vmiklos at collabora.co.uk
Fri Jul 1 14:18:56 UTC 2016
sc/qa/unit/tiledrendering/tiledrendering.cxx | 66 ++++++++++++++++++++++++++-
1 file changed, 64 insertions(+), 2 deletions(-)
New commits:
commit e3c36c789f481b855c0fb556a09f4b81401ed3db
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jul 1 15:04:55 2016 +0200
sc: add LOK_CALLBACK_CELL_VIEW_CURSOR testcase
Fails with the sc/source part of commit (sc lok: add
LOK_CALLBACK_CELL_VIEW_CURSOR, 2016-07-01) reverted.
Change-Id: I4a1a7d97b744dd089fe15bd58af6cca5e0b79e8f
Reviewed-on: https://gerrit.libreoffice.org/26856
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 24bbbce..ed85cd2 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -12,7 +12,6 @@
#include <test/xmltesttools.hxx>
#include <boost/property_tree/json_parser.hpp>
-#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <com/sun/star/frame/Desktop.hpp>
#include <comphelper/dispatchcommand.hxx>
@@ -28,6 +27,7 @@
#include <svl/srchitem.hxx>
#include <comphelper/lok.hxx>
+#include <sfx2/lokhelper.hxx>
#include <tabvwsh.hxx>
#include <docsh.hxx>
@@ -36,7 +36,10 @@
using namespace css;
-static const char* DATA_DIRECTORY = "/sc/qa/unit/tiledrendering/data/";
+namespace
+{
+
+const char* DATA_DIRECTORY = "/sc/qa/unit/tiledrendering/data/";
class ScTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
{
@@ -50,6 +53,7 @@ public:
void testPartHash();
void testDocumentSize();
void testEmptyColumnSelection();
+ void testViewCursors();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -57,6 +61,7 @@ public:
CPPUNIT_TEST(testPartHash);
CPPUNIT_TEST(testDocumentSize);
CPPUNIT_TEST(testEmptyColumnSelection);
+ CPPUNIT_TEST(testViewCursors);
CPPUNIT_TEST_SUITE_END();
private:
@@ -347,6 +352,63 @@ void ScTiledRenderingTest::testEmptyColumnSelection()
comphelper::LibreOfficeKit::setActive(false);
}
+class ViewCallback
+{
+public:
+ bool m_bOwnCursorInvalidated;
+ bool m_bViewCursorInvalidated;
+
+ ViewCallback()
+ : m_bOwnCursorInvalidated(false),
+ m_bViewCursorInvalidated(false)
+ {
+ }
+
+ static void callback(int nType, const char* pPayload, void* pData)
+ {
+ static_cast<ViewCallback*>(pData)->callbackImpl(nType, pPayload);
+ }
+
+ void callbackImpl(int nType, const char* /*pPayload*/)
+ {
+ switch (nType)
+ {
+ case LOK_CALLBACK_CELL_CURSOR:
+ {
+ m_bOwnCursorInvalidated = true;
+ }
+ break;
+ case LOK_CALLBACK_CELL_VIEW_CURSOR:
+ {
+ m_bViewCursorInvalidated = true;
+ }
+ break;
+ }
+ }
+};
+
+
+void ScTiledRenderingTest::testViewCursors()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ ScModelObj* pModelObj = createDoc("select-row-cols.ods");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ SfxLokHelper::createView();
+ ViewCallback aView2;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN);
+ Scheduler::ProcessEventsToIdle();
+ SfxLokHelper::destroyView(SfxLokHelper::getView());
+ CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated);
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list