Commit 9803e80c authored by Dmitry Kazakov's avatar Dmitry Kazakov

Make KisActionManagerTest at least not crash

parent db333bbc
......@@ -30,14 +30,20 @@
#include <kis_action_manager.h>
#include <KisViewManager.h>
#include "kis_node_manager.h"
void KisActionManagerTest::testUpdateGUI()
{
KisDocument* doc = createEmptyDocument();
KisMainWindow* mainWindow = KisPart::instance()->createMainWindow();
QPointer<KisView> view = new KisView(doc, mainWindow->resourceManager(), mainWindow->actionCollection(), mainWindow);
KisViewManager *viewManager = new KisViewManager(mainWindow, mainWindow->actionCollection());
KisPart::instance()->addView(view, doc);
view->setViewManager(viewManager);
viewManager->setCurrentView(view);
KisAction* action = new KisAction("dummy", this);
action->setActivationFlags(KisAction::ACTIVE_DEVICE);
view->viewManager()->actionManager()->addAction("dummy", action);
......@@ -53,6 +59,8 @@ void KisActionManagerTest::testUpdateGUI()
KisPaintLayerSP paintLayer1 = new KisPaintLayer(doc->image(), "paintlayer1", OPACITY_OPAQUE_U8);
doc->image()->addNode(paintLayer1);
viewManager->nodeManager()->slotUiActivatedNode(paintLayer1);
view->viewManager()->actionManager()->updateGUI();
QVERIFY(action->isEnabled());
QVERIFY(!action2->isEnabled());
......@@ -63,8 +71,12 @@ void KisActionManagerTest::testCondition()
KisDocument* doc = createEmptyDocument();
KisMainWindow* mainWindow = KisPart::instance()->createMainWindow();
QPointer<KisView> view = new KisView(doc, mainWindow->resourceManager(), mainWindow->actionCollection(), mainWindow);
KisViewManager *viewManager = new KisViewManager(mainWindow, mainWindow->actionCollection());
KisPart::instance()->addView(view, doc);
view->setViewManager(viewManager);
viewManager->setCurrentView(view);
KisAction* action = new KisAction("dummy", this);
action->setActivationFlags(KisAction::ACTIVE_DEVICE);
action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
......@@ -73,6 +85,8 @@ void KisActionManagerTest::testCondition()
KisPaintLayerSP paintLayer1 = new KisPaintLayer(doc->image(), "paintlayer1", OPACITY_OPAQUE_U8);
doc->image()->addNode(paintLayer1);
viewManager->nodeManager()->slotUiActivatedNode(paintLayer1);
view->viewManager()->actionManager()->updateGUI();
QVERIFY(action->isEnabled());
......@@ -100,8 +114,12 @@ void KisActionManagerTest::testTakeAction()
KisDocument* doc = createEmptyDocument();
KisMainWindow* mainWindow = KisPart::instance()->createMainWindow();
QPointer<KisView> view = new KisView(doc, mainWindow->resourceManager(), mainWindow->actionCollection(), mainWindow);
KisViewManager *viewManager = new KisViewManager(mainWindow, mainWindow->actionCollection());
KisPart::instance()->addView(view, doc);
view->setViewManager(viewManager);
viewManager->setCurrentView(view);
KisAction* action = new KisAction("dummy", this);
view->viewManager()->actionManager()->addAction("dummy", action);
QVERIFY(view->viewManager()->actionManager()->actionByName("dummy") != 0);
......
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