Kaydet (Commit) 6184185d authored tarafından Grzegorz Araminowicz's avatar Grzegorz Araminowicz Kaydeden (comit) Miklos Vajna

SmartArt: regenerate diagram test

Change-Id: I6d44335ab51c92dc605ee341efaaa4bf6f7bd42f
Reviewed-on: https://gerrit.libreoffice.org/72587
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst c3c620c8
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include <vcl/vclevent.hxx> #include <vcl/vclevent.hxx>
#include <chrono> #include <chrono>
#include <cstdlib>
using namespace css; using namespace css;
...@@ -119,6 +120,7 @@ public: ...@@ -119,6 +120,7 @@ public:
void testTdf115873(); void testTdf115873();
void testTdf115873Group(); void testTdf115873Group();
void testCutSelectionChange(); void testCutSelectionChange();
void testRegenerateDiagram();
CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback); CPPUNIT_TEST(testRegisterCallback);
...@@ -165,6 +167,7 @@ public: ...@@ -165,6 +167,7 @@ public:
CPPUNIT_TEST(testTdf115873); CPPUNIT_TEST(testTdf115873);
CPPUNIT_TEST(testTdf115873Group); CPPUNIT_TEST(testTdf115873Group);
CPPUNIT_TEST(testCutSelectionChange); CPPUNIT_TEST(testCutSelectionChange);
CPPUNIT_TEST(testRegenerateDiagram);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -202,6 +205,9 @@ void SdTiledRenderingTest::setUp() ...@@ -202,6 +205,9 @@ void SdTiledRenderingTest::setUp()
{ {
test::BootstrapFixture::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()))); mxDesktop.set(css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
} }
...@@ -2251,6 +2257,59 @@ void SdTiledRenderingTest::testCutSelectionChange() ...@@ -2251,6 +2257,59 @@ void SdTiledRenderingTest::testCutSelectionChange()
comphelper::LibreOfficeKit::setActive(false); 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_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment