summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-13 15:59:54 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-27 12:34:56 +0200
commit0aef79869abb8cbe8339682b6f8b5003e31fefaa (patch)
treeecee12937827816b58dffc03762700a794261e5d
parentf873d84c2612aaa96e811f290a6268c23fa1f6d2 (diff)
sc lok: Test invalidation triggered by PageDown
Reviewed-on: https://gerrit.libreoffice.org/79487 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 54bb961b1e8c01603782f8e5c50e9e1ee5896d7c) Change-Id: Id54a679b60e440f17371a3a532928bd161077e90 Reviewed-on: https://gerrit.libreoffice.org/79613 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 711d663b5892..adca0bf2cf7e 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -37,6 +37,7 @@
#include <vcl/scheduler.hxx>
#include <vcl/vclevent.hxx>
#include <sc.hrc>
+#include <comphelper/string.hxx>
#include <chrono>
#include <cstddef>
@@ -96,6 +97,7 @@ public:
void testIMESupport();
void testFilterDlg();
void testVbaRangeCopyPaste();
+ void testPageDownInvalidation();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -129,6 +131,7 @@ public:
CPPUNIT_TEST(testIMESupport);
CPPUNIT_TEST(testFilterDlg);
CPPUNIT_TEST(testVbaRangeCopyPaste);
+ CPPUNIT_TEST(testPageDownInvalidation);
CPPUNIT_TEST_SUITE_END();
private:
@@ -432,6 +435,7 @@ public:
bool m_bGraphicViewSelection;
bool m_bFullInvalidateTiles;
bool m_bInvalidateTiles;
+ tools::Rectangle m_aInvalidation;
bool m_bViewLock;
OString m_sCellFormula;
boost::property_tree::ptree m_aCommentCallbackResult;
@@ -499,6 +503,15 @@ public:
}
else
{
+ if (m_aInvalidation.IsEmpty())
+ {
+ uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload));
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength());
+ m_aInvalidation.setX(aSeq[0].toInt32());
+ m_aInvalidation.setY(aSeq[1].toInt32());
+ m_aInvalidation.setWidth(aSeq[2].toInt32());
+ m_aInvalidation.setHeight(aSeq[3].toInt32());
+ }
m_bInvalidateTiles = true;
}
}
@@ -1673,6 +1686,31 @@ void ScTiledRenderingTest::testVbaRangeCopyPaste()
comphelper::LibreOfficeKit::setActive(false);
}
+void ScTiledRenderingTest::testPageDownInvalidation()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ ScModelObj* pModelObj = createDoc("empty.ods");
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ CPPUNIT_ASSERT(pViewData);
+
+ int nView1 = SfxLokHelper::getView();
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
+
+ SfxLokHelper::setView(nView1);
+ aView1.m_bInvalidateTiles = false;
+ aView1.m_aInvalidation = tools::Rectangle();
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, awt::Key::PAGEDOWN, 0);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, awt::Key::PAGEDOWN, 0);
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidation);
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);