Commit 4bcd4010 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Add instance test mode to test

For synchronisation to the puppet process.
parent 272b86a8
......@@ -27,6 +27,11 @@ class NodeInstanceServerInterface : public QObject
{
Q_OBJECT
public:
enum RunModus {
NormalModus,
TestModus // No preview images and synchronized
};
explicit NodeInstanceServerInterface(QObject *parent = 0);
virtual void createInstances(const CreateInstancesCommand &command) = 0;
......
......@@ -40,6 +40,7 @@
#include <modelnode.h>
#include <nodeinstance.h>
#include <nodeinstanceclientinterface.h>
#include <nodeinstanceserverinterface.h>
#include <QHash>
#include <QSet>
......@@ -80,7 +81,7 @@ class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInsta
public:
typedef QWeakPointer<NodeInstanceView> Pointer;
NodeInstanceView(QObject *parent = 0);
NodeInstanceView(QObject *parent = 0, NodeInstanceServerInterface::RunModus runModus = NodeInstanceServerInterface::NormalModus);
~NodeInstanceView();
void modelAttached(Model *model);
......@@ -182,6 +183,7 @@ private: //variables
QWeakPointer<NodeInstanceServerInterface> m_nodeInstanceServer;
QImage m_baseStatePreviewImage;
QTime m_lastCrashTime;
NodeInstanceServerInterface::RunModus m_runModus;
};
} // namespace ProxyNodeInstanceView
......
......@@ -23,12 +23,6 @@ class NodeInstanceServerProxy : public NodeInstanceServerInterface
{
Q_OBJECT
public:
enum RunModus {
NormalModus,
TestModus // No preview images and synchronized
};
explicit NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView, RunModus runModus = NormalModus);
~NodeInstanceServerProxy();
void createInstances(const CreateInstancesCommand &command);
......
......@@ -112,9 +112,10 @@ d too.
\see ~NodeInstanceView setRenderOffScreen
*/
NodeInstanceView::NodeInstanceView(QObject *parent)
NodeInstanceView::NodeInstanceView(QObject *parent, NodeInstanceServerInterface::RunModus runModus)
: AbstractView(parent),
m_baseStatePreviewImage(QSize(100, 100), QImage::Format_ARGB32)
m_baseStatePreviewImage(QSize(100, 100), QImage::Format_ARGB32),
m_runModus(runModus)
{
m_baseStatePreviewImage.fill(0xFFFFFF);
}
......@@ -141,7 +142,7 @@ NodeInstanceView::~NodeInstanceView()
void NodeInstanceView::modelAttached(Model *model)
{
AbstractView::modelAttached(model);
m_nodeInstanceServer = new NodeInstanceServerProxy(this);
m_nodeInstanceServer = new NodeInstanceServerProxy(this, m_runModus);
m_lastCrashTime.start();
connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(handleChrash()));
......@@ -169,7 +170,7 @@ void NodeInstanceView::restartProcess()
if (model()) {
delete nodeInstanceServer();
m_nodeInstanceServer = new NodeInstanceServerProxy(this);
m_nodeInstanceServer = new NodeInstanceServerProxy(this, m_runModus);
connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(handleChrash()));
nodeInstanceServer()->createScene(createCreateSceneCommand());
......
......@@ -1432,7 +1432,7 @@ void tst_TestCore::testBasicOperationsWithView()
QVERIFY(view.data());
model->attachView(view.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data(), NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
ModelNode rootModelNode = view->rootModelNode();
......@@ -1661,7 +1661,7 @@ void tst_TestCore::testModelRemoveNode()
QVERIFY(view.data());
model->attachView(view.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data(), NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
QCOMPARE(view->rootModelNode().allDirectSubModelNodes().count(), 0);
......@@ -1732,7 +1732,7 @@ void tst_TestCore::reparentingNode()
QCOMPARE(rootModelNode.id(), QString("rootModelNode"));
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data(), NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
ModelNode childNode = addNodeListChild(rootModelNode, "Qt/Rectangle", 4, 7, "data");
......@@ -1800,7 +1800,7 @@ void tst_TestCore::reparentingNodeLikeDragAndDrop()
QVERIFY(view.data());
model->attachView(view.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data(), NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
view->rootModelNode().setId("rootModelNode");
QCOMPARE(view->rootModelNode().id(), QString("rootModelNode"));
......@@ -1909,7 +1909,7 @@ void tst_TestCore::testModelReorderSiblings()
QVERIFY(view.data());
model->attachView(view.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data(), NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
ModelNode rootModelNode = view->rootModelNode();
......@@ -2044,7 +2044,7 @@ void tst_TestCore::testModelAddAndRemoveProperty()
ModelNode node = view->rootModelNode();
QVERIFY(node.isValid());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data(), NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
node.variantProperty("blah").setValue(-1);
......@@ -6061,7 +6061,7 @@ void tst_TestCore::testModelBindings()
QScopedPointer<Model> model(Model::create("Qt/Item", 4, 7));
QVERIFY(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data());
NodeInstanceView *nodeInstanceView = new NodeInstanceView(model.data(), NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
ModelNode rootModelNode = nodeInstanceView->rootModelNode();
......
......@@ -45,7 +45,7 @@
TestView::TestView(QmlDesigner::Model *model)
: QmlDesigner::QmlModelView(model)
{
QmlDesigner::NodeInstanceView *nodeInstanceView = new QmlDesigner::NodeInstanceView(model);
QmlDesigner::NodeInstanceView *nodeInstanceView = new QmlDesigner::NodeInstanceView(model, QmlDesigner::NodeInstanceServerInterface::TestModus);
model->attachView(nodeInstanceView);
}
......
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