Commit 6fb9e909 authored by Thomas Hartmann's avatar Thomas Hartmann

Tests.QmlDesigner: adding some QApplication::processEvents();

This is needed process all the events created by NodeInstanceView.

Change-Id: Ia2df51f5aafdc670e60a47064092123a1a100049
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 96a41678
......@@ -125,6 +125,8 @@ static void initializeMetaTypeSystem(const QString &resourcePath)
static QmlDesigner::Model* createModel(const QString &typeName, int major = 1, int minor = 1, Model *metaInfoPropxyModel = 0)
{
QApplication::processEvents();
QmlDesigner::Model *model = QmlDesigner::Model::create(typeName, major, minor, metaInfoPropxyModel);
QPlainTextEdit *textEdit = new QPlainTextEdit;
......@@ -182,6 +184,15 @@ void tst_TestCore::cleanupTestCase()
MetaInfo::clearGlobal();
}
void tst_TestCore::init()
{
QApplication::processEvents();
}
void tst_TestCore::cleanup()
{
QApplication::processEvents();
}
void tst_TestCore::testModelCreateCoreModel()
{
QScopedPointer<Model> model(createModel("QtQuick.Item"));
......@@ -1837,6 +1848,7 @@ void tst_TestCore::reparentingNode()
QCOMPARE(childNode.parentProperty().parentModelNode(), childNode2);
QApplication::processEvents();
model->detachView(nodeInstanceView);
}
......@@ -1954,6 +1966,8 @@ void tst_TestCore::reparentingNodeLikeDragAndDrop()
QCOMPARE(textNode.parentProperty().parentModelNode(), rectNode);
QVERIFY(rectNode.allDirectSubModelNodes().contains(textNode));
QApplication::processEvents();
model->detachView(nodeInstanceView);
}
......@@ -2005,6 +2019,8 @@ void tst_TestCore::testModelReorderSiblings()
QVERIFY(nodeInstanceView->instanceForNode(c).parentId() == rootModelNode.internalId());
}
QApplication::processEvents();
model->detachView(nodeInstanceView);
}
......@@ -2037,6 +2053,7 @@ void tst_TestCore::testModelRootNode()
QString errorMsg = tr("Exception: %1 %2 %3:%4").arg(exception.type(), exception.function(), exception.file()).arg(exception.line());
QFAIL(errorMsg.toLatin1().constData());
}
QApplication::processEvents();
}
void tst_TestCore::reparentingNodeInModificationGroup()
......@@ -2087,6 +2104,8 @@ void tst_TestCore::reparentingNodeInModificationGroup()
QCOMPARE(childNode2.parentProperty().parentModelNode(), view->rootModelNode());
QVERIFY(childNode2.isValid());
QVERIFY(view->rootModelNode().allDirectSubModelNodes().contains(childNode2));
QApplication::processEvents();
}
void tst_TestCore::testModelAddAndRemoveProperty()
......@@ -2127,6 +2146,8 @@ void tst_TestCore::testModelAddAndRemoveProperty()
QVERIFY(node.hasProperty("foo"));
QCOMPARE(node.variantProperty("foo").value().toString(), QString("bar"));
QApplication::processEvents();
model->detachView(nodeInstanceView);
}
......@@ -2199,6 +2220,8 @@ void tst_TestCore::testModelViewNotification()
model->detachView(view1.data());
expectedCalls << TestView::MethodCall("modelAboutToBeDetached", QStringList() << QString::number(reinterpret_cast<long>(model.data())));
QCOMPARE(view1->methodCalls(), expectedCalls);
QApplication::processEvents();
}
......@@ -3879,6 +3902,8 @@ void tst_TestCore::testMetaInfoCustomType()
// DeclarativePropertyChanges just has 3 properties
QCOMPARE(propertyChangesInfo.propertyNames().size() - stateOperationInfo.propertyNames().size(), 3);
QApplication::processEvents();
}
void tst_TestCore::testMetaInfoEnums()
......@@ -3903,6 +3928,8 @@ void tst_TestCore::testMetaInfoEnums()
QCOMPARE(view->rootModelNode().metaInfo().propertyTypeName("horizontalAlignment"), QLatin1String("HAlignment"));
QVERIFY(view->rootModelNode().metaInfo().propertyKeysForEnum("horizontalAlignment").contains(QLatin1String("AlignLeft")));
QVERIFY(view->rootModelNode().metaInfo().propertyKeysForEnum("horizontalAlignment").contains(QLatin1String("AlignRight")));
QApplication::processEvents();
}
void tst_TestCore::testMetaInfoProperties()
......@@ -3919,6 +3946,8 @@ void tst_TestCore::testMetaInfoProperties()
QVERIFY(textNodeMetaInfo.propertyIsWritable("text"));
QVERIFY(textNodeMetaInfo.propertyIsWritable("x"));
QApplication::processEvents();
}
void tst_TestCore::testMetaInfoDotProperties()
......@@ -3952,6 +3981,8 @@ void tst_TestCore::testMetaInfoDotProperties()
QVERIFY(rectNode.metaInfo().propertyNames().contains("border.width"));
QVERIFY(rectNode.metaInfo().hasProperty("border"));
QVERIFY(rectNode.metaInfo().hasProperty("border.width"));
QApplication::processEvents();
}
void tst_TestCore::testMetaInfoListProperties()
......@@ -3983,6 +4014,8 @@ void tst_TestCore::testMetaInfoListProperties()
QVERIFY(!view->rootModelNode().metaInfo().propertyIsListProperty("effect"));
QVERIFY(view->rootModelNode().metaInfo().hasProperty("parent"));
QVERIFY(!view->rootModelNode().metaInfo().propertyIsListProperty("parent"));
QApplication::processEvents();
}
void tst_TestCore::testStatesRewriter()
......@@ -7157,6 +7190,8 @@ void tst_TestCore::testRewriterMovingInOut()
"Rectangle {\n"
"}");
QCOMPARE(textEdit.toPlainText(), expected2);
QApplication::processEvents();
}
void tst_TestCore::testRewriterMovingInOutWithTransaction()
......@@ -7208,6 +7243,7 @@ void tst_TestCore::testRewriterMovingInOutWithTransaction()
"Rectangle {\n"
"}");
QCOMPARE(textEdit.toPlainText(), expected2);
QApplication::processEvents();
}
void tst_TestCore::testRewriterComplexMovingInOut()
......@@ -7306,6 +7342,7 @@ void tst_TestCore::testRewriterComplexMovingInOut()
" }\n"
"}");
QCOMPARE(textEdit.toPlainText(), expected4);
QApplication::processEvents();
}
void tst_TestCore::removeCenteredInAnchorByDetaching()
......
......@@ -45,6 +45,10 @@ public:
private slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
//
// unit tests MetaInfo, NodeMetaInfo, PropertyMetaInfo
......
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