diff options
author | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-05-16 12:25:40 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-05-23 09:11:20 +0200 |
commit | 6184185d0636623d8870e3e13800301d36ded850 (patch) | |
tree | 7f89e26d4194ccf433a85734203146ec29075ffe /sd | |
parent | c3c620c89d0159629f04642cb665fc8fdff7481e (diff) |
SmartArt: regenerate diagram test
Change-Id: I6d44335ab51c92dc605ee341efaaa4bf6f7bd42f
Reviewed-on: https://gerrit.libreoffice.org/72587
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/data/regenerate-diagram.pptx | bin | 0 -> 41813 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 59 |
2 files changed, 59 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/data/regenerate-diagram.pptx b/sd/qa/unit/tiledrendering/data/regenerate-diagram.pptx Binary files differnew file mode 100644 index 000000000000..97635a51871e --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/regenerate-diagram.pptx diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 8ac4be6fdd2f..6e38741acd7d 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -57,6 +57,7 @@ #include <vcl/vclevent.hxx> #include <chrono> +#include <cstdlib> using namespace css; @@ -119,6 +120,7 @@ public: void testTdf115873(); void testTdf115873Group(); void testCutSelectionChange(); + void testRegenerateDiagram(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -165,6 +167,7 @@ public: CPPUNIT_TEST(testTdf115873); CPPUNIT_TEST(testTdf115873Group); CPPUNIT_TEST(testCutSelectionChange); + CPPUNIT_TEST(testRegenerateDiagram); CPPUNIT_TEST_SUITE_END(); @@ -202,6 +205,9 @@ void SdTiledRenderingTest::setUp() { test::BootstrapFixture::setUp(); + // prevent showing warning message box + setenv("OOX_NO_SMARTART_WARNING", "1", 1); + mxDesktop.set(css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); } @@ -2251,6 +2257,59 @@ void SdTiledRenderingTest::testCutSelectionChange() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testRegenerateDiagram() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("regenerate-diagram.pptx"); + CPPUNIT_ASSERT(pXImpressDocument); + + SdPage* pActualPage = pXImpressDocument->GetDocShell()->GetViewShell()->GetActualPage(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pActualPage->GetObj(0)->GetSubList()->GetObjCount()); + + // select diagram + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + Scheduler::ProcessEventsToIdle(); + + // enter group + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F3); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F3); + Scheduler::ProcessEventsToIdle(); + + // select shape and delete + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE); + Scheduler::ProcessEventsToIdle(); + + // exit group + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | awt::Key::F3); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | awt::Key::F3); + Scheduler::ProcessEventsToIdle(); + + // select diagram + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObj(0)->GetSubList()->GetObjCount()); + + // regenerate diagram + comphelper::dispatchCommand(".uno:RegenerateDiagram", uno::Sequence<beans::PropertyValue>()); + Scheduler::ProcessEventsToIdle(); + + // diagram content (child shape count) should be the same as in the beginning + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pActualPage->GetObj(0)->GetSubList()->GetObjCount()); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); |