summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-22 13:21:46 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-26 20:00:27 +0200
commit3a8124d5ce9c45a14edb88c5614d994e4dbfc225 (patch)
treeda7e66424a6bb1aeddb4fd7652cffa654120a6e6 /sd
parent6e4a68189693626e1b79f675f1cfda846b5ebce8 (diff)
sd lok: Test invalidation after adding\removing slide
Reviewed-on: https://gerrit.libreoffice.org/79499 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 2984856798d8ad98b96e6a57bfcc701bc52876e8) Change-Id: I4677d78b1bfad36a7b3bde4651b9900e617b6422 Reviewed-on: https://gerrit.libreoffice.org/79625 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index d9797587ae21..6a3837897bbb 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -117,6 +117,7 @@ public:
void testTdf115873Group();
void testCutSelectionChange();
void testLanguageAllText();
+ void testInsertDeletePageInvalidation();
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -164,6 +165,7 @@ public:
CPPUNIT_TEST(testTdf115873Group);
CPPUNIT_TEST(testCutSelectionChange);
CPPUNIT_TEST(testLanguageAllText);
+ CPPUNIT_TEST(testInsertDeletePageInvalidation);
CPPUNIT_TEST_SUITE_END();
@@ -931,6 +933,7 @@ public:
bool m_bCursorVisibleChanged;
bool m_bViewLock;
bool m_bTilesInvalidated;
+ std::vector<tools::Rectangle> m_aInvalidations;
std::map<int, bool> m_aViewCursorInvalidations;
std::map<int, bool> m_aViewCursorVisibilities;
bool m_bViewSelectionSet;
@@ -959,6 +962,18 @@ public:
case LOK_CALLBACK_INVALIDATE_TILES:
{
m_bTilesInvalidated = true;
+ OString text(pPayload);
+ if (!text.startsWith("EMPTY"))
+ {
+ uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload));
+ CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
+ tools::Rectangle aInvalidationRect;
+ aInvalidationRect.setX(aSeq[0].toInt32());
+ aInvalidationRect.setY(aSeq[1].toInt32());
+ aInvalidationRect.setWidth(aSeq[2].toInt32());
+ aInvalidationRect.setHeight(aSeq[3].toInt32());
+ m_aInvalidations.push_back(aInvalidationRect);
+ }
}
break;
case LOK_CALLBACK_GRAPHIC_SELECTION:
@@ -2168,6 +2183,34 @@ void SdTiledRenderingTest::testCutSelectionChange()
CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), m_aSelection.size());
}
+void SdTiledRenderingTest::testInsertDeletePageInvalidation()
+{
+ // Load the document.
+ comphelper::LibreOfficeKit::setActive();
+ SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ CPPUNIT_ASSERT_EQUAL(8, pXImpressDocument->getParts());
+
+ // Insert slide
+ aView1.m_bTilesInvalidated = false;
+ aView1.m_aInvalidations.clear();
+ comphelper::dispatchCommand(".uno:InsertPage", uno::Sequence<beans::PropertyValue>());
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
+ CPPUNIT_ASSERT_EQUAL(9, pXImpressDocument->getParts());
+ CPPUNIT_ASSERT_EQUAL(size_t(9), aView1.m_aInvalidations.size());
+
+ // Delete slide
+ aView1.m_bTilesInvalidated = false;
+ aView1.m_aInvalidations.clear();
+ comphelper::dispatchCommand(".uno:DeletePage", uno::Sequence<beans::PropertyValue>());
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
+ CPPUNIT_ASSERT_EQUAL(8, pXImpressDocument->getParts());
+ CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();