summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-08 03:05:13 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-08 03:05:13 (GMT)
commit238ccf72409b3668bf6f7df6bd7d7057ac7d2443 (patch)
tree198dad1d874e5f359779447b4ae535c329207d16 /tests
parent71f9283df3caabadcfb04e2ab6f57305cd73c0d1 (diff)
parentdcce90c4d9c8d010d7fc45c33048ff00e468b89c (diff)
downloadQt-238ccf72409b3668bf6f7df6bd7d7057ac7d2443.zip
Qt-238ccf72409b3668bf6f7df6bd7d7057ac7d2443.tar.gz
Qt-238ccf72409b3668bf6f7df6bd7d7057ac7d2443.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/data/startup.qml17
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp193
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp54
4 files changed, 202 insertions, 78 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml
new file mode 100644
index 0000000..f3ff620
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml
@@ -0,0 +1,17 @@
+import Qt 4.7
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ objectName: "innerRect"
+ height: 100; width: 100; color: "green"
+ property real targetX: 100
+
+ x: targetX
+ Behavior on x {
+ NumberAnimation {}
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 26c8231..4c9c9ca 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -68,6 +68,7 @@ private slots:
void reassignedAnimation();
void disabled();
void dontStart();
+ void startup();
};
void tst_qdeclarativebehaviors::simpleBehavior()
@@ -326,6 +327,21 @@ void tst_qdeclarativebehaviors::dontStart()
delete rect;
}
+void tst_qdeclarativebehaviors::startup()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeRectangle *innerRect = rect->findChild<QDeclarativeRectangle*>("innerRect");
+ QVERIFY(innerRect);
+
+ QCOMPARE(innerRect->x(), qreal(100)); //should be set immediately
+
+ delete rect;
+}
+
QTEST_MAIN(tst_qdeclarativebehaviors)
#include "tst_qdeclarativebehaviors.moc"
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 722e161..dcd72d2 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -136,7 +136,7 @@ private slots:
private:
QDeclarativeEngine engine;
- void testType(const QString& qml, const QString& type);
+ void testType(const QString& qml, const QString& type, const QString& error);
};
#define VERIFY_ERRORS(errorfile) \
@@ -1069,7 +1069,7 @@ void tst_qdeclarativelanguage::declaredPropertyValues()
}
// Check that first child of qml is of given type. Empty type insists on error.
-void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type)
+void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type, const QString& expectederror)
{
QDeclarativeComponent component(&engine);
component.setData(qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports
@@ -1078,6 +1078,13 @@ void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type)
if (type.isEmpty()) {
QVERIFY(component.isError());
+ QString actualerror;
+ foreach (const QDeclarativeError e, component.errors()) {
+ if (!actualerror.isEmpty())
+ actualerror.append("; ");
+ actualerror.append(e.description());
+ }
+ QCOMPARE(actualerror,expectederror);
} else {
VERIFY_ERRORS(0);
QObject *object = component.create();
@@ -1097,156 +1104,199 @@ void tst_qdeclarativelanguage::importsBuiltin_data()
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
// import built-ins
QTest::newRow("missing import")
<< "Test {}"
- << "";
+ << ""
+ << "Test is not a type";
QTest::newRow("not in version 0.0")
<< "import com.nokia.Test 0.0\n"
"Test {}"
- << "";
+ << ""
+ << "Test is not a type";
+ QTest::newRow("version not installed")
+ << "import com.nokia.Test 99.0\n"
+ "Test {}"
+ << ""
+ << "module \"com.nokia.Test\" version 99.0 is not installed";
QTest::newRow("in version 0.0")
<< "import com.nokia.Test 0.0\n"
"TestTP {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("qualified in version 0.0")
<< "import com.nokia.Test 0.0 as T\n"
"T.TestTP {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("in version 1.0")
<< "import com.nokia.Test 1.0\n"
"Test {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("qualified wrong")
<< "import com.nokia.Test 1.0 as T\n" // QT-610
"Test {}"
- << "";
+ << ""
+ << "Test is not a type";
QTest::newRow("qualified right")
<< "import com.nokia.Test 1.0 as T\n"
"T.Test {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("qualified right but not in version 0.0")
<< "import com.nokia.Test 0.0 as T\n"
"T.Test {}"
- << "";
+ << ""
+ << "T.Test is not a type";
QTest::newRow("in version 1.1")
<< "import com.nokia.Test 1.1\n"
"Test {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("in version 1.3")
<< "import com.nokia.Test 1.3\n"
"Test {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("in version 1.5")
<< "import com.nokia.Test 1.5\n"
"Test {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("changed in version 1.8")
<< "import com.nokia.Test 1.8\n"
"Test {}"
- << "TestType2";
+ << "TestType2"
+ << "";
QTest::newRow("in version 1.12")
<< "import com.nokia.Test 1.12\n"
"Test {}"
- << "TestType2";
+ << "TestType2"
+ << "";
QTest::newRow("old in version 1.9")
<< "import com.nokia.Test 1.9\n"
"OldTest {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("old in version 1.11")
<< "import com.nokia.Test 1.11\n"
"OldTest {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("multiversion 1")
<< "import com.nokia.Test 1.11\n"
"import com.nokia.Test 1.12\n"
"Test {}"
- << "TestType2";
+ << "TestType2"
+ << "";
QTest::newRow("multiversion 2")
<< "import com.nokia.Test 1.11\n"
"import com.nokia.Test 1.12\n"
"OldTest {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("qualified multiversion 3")
<< "import com.nokia.Test 1.0 as T0\n"
"import com.nokia.Test 1.8 as T8\n"
"T0.Test {}"
- << "TestType";
+ << "TestType"
+ << "";
QTest::newRow("qualified multiversion 4")
<< "import com.nokia.Test 1.0 as T0\n"
"import com.nokia.Test 1.8 as T8\n"
"T8.Test {}"
- << "TestType2";
+ << "TestType2"
+ << "";
}
void tst_qdeclarativelanguage::importsBuiltin()
{
QFETCH(QString, qml);
QFETCH(QString, type);
- testType(qml,type);
+ QFETCH(QString, error);
+ testType(qml,type,error);
}
void tst_qdeclarativelanguage::importsLocal_data()
{
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
// import locals
QTest::newRow("local import")
<< "import \"subdir\"\n" // QT-613
"Test {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("local import second")
<< "import Qt 4.6\nimport \"subdir\"\n"
"Test {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("local import subsubdir")
<< "import Qt 4.6\nimport \"subdir/subsubdir\"\n"
"SubTest {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("local import QTBUG-7721 A")
<< "subdir.Test {}" // no longer allowed (QTBUG-7721)
- << "";
+ << ""
+ << "subdir.Test is not a type";
QTest::newRow("local import QTBUG-7721 B")
<< "import \"subdir\" as X\n"
"X.subsubdir.SubTest {}" // no longer allowed (QTBUG-7721)
- << "";
+ << ""
+ << "X.subsubdir.SubTest is not a type";
QTest::newRow("local import as")
<< "import \"subdir\" as T\n"
"T.Test {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("wrong local import as")
<< "import \"subdir\" as T\n"
"Test {}"
- << "";
+ << ""
+ << "Test is not a type";
QTest::newRow("library precedence over local import")
<< "import \"subdir\"\n"
"import com.nokia.Test 1.0\n"
"Test {}"
- << "TestType";
+ << "TestType"
+ << "";
}
void tst_qdeclarativelanguage::importsLocal()
{
QFETCH(QString, qml);
QFETCH(QString, type);
- testType(qml,type);
+ QFETCH(QString, error);
+ testType(qml,type,error);
}
void tst_qdeclarativelanguage::importsRemote_data()
{
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage";
- QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle";
- QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QDeclarativeText";
- QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QDeclarativeImage";
- QTest::newRow("wrong remote import with undeclared local") << "import \""+serverdir+"\"\nWrongTestLocal {}" << "";
- QTest::newRow("wrong remote import of internal local") << "import \""+serverdir+"\"\nLocalInternal {}" << "";
- QTest::newRow("wrong remote import of undeclared local") << "import \""+serverdir+"\"\nUndeclaredLocal {}" << "";
+ QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle"
+ << "";
+ QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QDeclarativeText"
+ << "";
+ QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QDeclarativeImage"
+ << "";
+ QTest::newRow("wrong remote import with undeclared local") << "import \""+serverdir+"\"\nWrongTestLocal {}" << ""
+ << "WrongTestLocal is not a type";
+ QTest::newRow("wrong remote import of internal local") << "import \""+serverdir+"\"\nLocalInternal {}" << ""
+ << "LocalInternal is not a type";
+ QTest::newRow("wrong remote import of undeclared local") << "import \""+serverdir+"\"\nUndeclaredLocal {}" << ""
+ << "UndeclaredLocal is not a type";
}
#include "testhttpserver.h"
@@ -1255,11 +1305,12 @@ void tst_qdeclarativelanguage::importsRemote()
{
QFETCH(QString, qml);
QFETCH(QString, type);
+ QFETCH(QString, error);
TestHTTPServer server(14445);
server.serveDirectory(SRCDIR);
- testType(qml,type);
+ testType(qml,type,error);
}
void tst_qdeclarativelanguage::importsInstalled_data()
@@ -1268,43 +1319,57 @@ void tst_qdeclarativelanguage::importsInstalled_data()
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
// import installed
QTest::newRow("installed import 0")
<< "import com.nokia.installedtest 0.0\n"
"InstalledTestTP {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("installed import 0 as TP")
<< "import com.nokia.installedtest 0.0 as TP\n"
"TP.InstalledTestTP {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("installed import 1")
<< "import com.nokia.installedtest 1.0\n"
"InstalledTest {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("installed import 2")
<< "import com.nokia.installedtest 1.3\n"
"InstalledTest {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("installed import 3")
<< "import com.nokia.installedtest 1.4\n"
"InstalledTest {}"
- << "QDeclarativeText";
- QTest::newRow("installed import 4")
+ << "QDeclarativeText"
+ << "";
+ QTest::newRow("installed import minor version not available") // QTBUG-9627
<< "import com.nokia.installedtest 1.10\n"
"InstalledTest {}"
- << "QDeclarativeText";
+ << ""
+ << "module \"com.nokia.installedtest\" version 1.10 is not installed";
+ QTest::newRow("installed import major version not available") // QTBUG-9627
+ << "import com.nokia.installedtest 9.0\n"
+ "InstalledTest {}"
+ << ""
+ << "module \"com.nokia.installedtest\" version 9.0 is not installed";
QTest::newRow("installed import visibility") // QT-614
<< "import com.nokia.installedtest 1.4\n"
"PrivateType {}"
- << "";
+ << ""
+ << "PrivateType is not a type";
}
void tst_qdeclarativelanguage::importsInstalled()
{
QFETCH(QString, qml);
QFETCH(QString, type);
- testType(qml,type);
+ QFETCH(QString, error);
+ testType(qml,type,error);
}
@@ -1312,65 +1377,77 @@ void tst_qdeclarativelanguage::importsOrder_data()
{
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
QTest::newRow("installed import overrides 1") <<
"import com.nokia.installedtest 1.0\n"
"import com.nokia.installedtest 1.4\n"
"InstalledTest {}"
- << "QDeclarativeText";
+ << "QDeclarativeText"
+ << "";
QTest::newRow("installed import overrides 2") <<
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"InstalledTest {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("installed import re-overrides 1") <<
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"import com.nokia.installedtest 1.4\n"
"InstalledTest {}"
- << "QDeclarativeText";
+ << "QDeclarativeText"
+ << "";
QTest::newRow("installed import re-overrides 2") <<
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"import com.nokia.installedtest 1.4\n"
"import com.nokia.installedtest 1.0\n"
"InstalledTest {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("installed import versus builtin 1") <<
"import com.nokia.installedtest 1.5\n"
"import Qt 4.6\n"
"Rectangle {}"
- << "QDeclarativeRectangle";
+ << "QDeclarativeRectangle"
+ << "";
QTest::newRow("installed import versus builtin 2") <<
"import Qt 4.6\n"
"import com.nokia.installedtest 1.5\n"
"Rectangle {}"
- << "QDeclarativeText";
+ << "QDeclarativeText"
+ << "";
QTest::newRow("namespaces cannot be overridden by types 1") <<
"import Qt 4.6 as Rectangle\n"
"import com.nokia.installedtest 1.5\n"
"Rectangle {}"
- << "";
+ << ""
+ << "Namespace Rectangle cannot be used as a type";
QTest::newRow("namespaces cannot be overridden by types 2") <<
"import Qt 4.6 as Rectangle\n"
"import com.nokia.installedtest 1.5\n"
"Rectangle.Image {}"
- << "QDeclarativeImage";
+ << "QDeclarativeImage"
+ << "";
QTest::newRow("local last 1") <<
"LocalLast {}"
- << "QDeclarativeText";
+ << "QDeclarativeText"
+ << "";
QTest::newRow("local last 2") <<
"import com.nokia.installedtest 1.0\n"
"LocalLast {}"
- << "QDeclarativeRectangle"; // i.e. from com.nokia.installedtest, not data/LocalLast.qml
+ << "QDeclarativeRectangle"
+ << ""; // i.e. from com.nokia.installedtest, not data/LocalLast.qml
}
void tst_qdeclarativelanguage::importsOrder()
{
QFETCH(QString, qml);
QFETCH(QString, type);
- testType(qml,type);
+ QFETCH(QString, error);
+ testType(qml,type,error);
}
void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod()
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index ba0f9a7..74da79e 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -378,16 +378,17 @@ void tst_qdeclarativexmllistmodel::reload()
QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int)));
QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int)));
QSignalSpy spyCount(model, SIGNAL(countChanged()));
- QSignalSpy spyReset(model, SIGNAL(modelReset()));
model->reload();
- QTRY_COMPARE(spyReset.count(), 1);
- QCOMPARE(spyCount.count(), 0);
- QCOMPARE(spyInsert.count(), 0);
- QCOMPARE(spyRemove.count(), 0);
+ QTRY_COMPARE(spyCount.count(), 1);
+ QTRY_COMPARE(spyInsert.count(), 1);
+ QTRY_COMPARE(spyRemove.count(), 1);
+
+ QCOMPARE(spyInsert[0][0].toInt(), 0);
+ QCOMPARE(spyInsert[0][1].toInt(), 9);
- QCOMPARE(model->data(0, model->roles().first()).toString(), QString("Polly"));
- QCOMPARE(model->data(model->count()-1, model->roles().first()).toString(), QString("Tiny"));
+ QCOMPARE(spyRemove[0][0].toInt(), 0);
+ QCOMPARE(spyRemove[0][1].toInt(), 9);
delete model;
}
@@ -415,15 +416,15 @@ void tst_qdeclarativexmllistmodel::useKeys()
QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int)));
QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int)));
QSignalSpy spyCount(model, SIGNAL(countChanged()));
- QSignalSpy spyReset(model, SIGNAL(modelReset()));
model->setXml(newXml);
- if (insertRanges.isEmpty() && removeRanges.isEmpty()) {
- QTRY_COMPARE(spyReset.count(), 1);
+ if (oldCount != newData.count()) {
+ QTRY_COMPARE(model->count(), newData.count());
+ QCOMPARE(spyCount.count(), 1);
} else {
QTRY_VERIFY(spyInsert.count() > 0 || spyRemove.count() > 0);
- QCOMPARE(spyCount.count() == 0, oldCount == newData.count());
+ QCOMPARE(spyCount.count(), 0);
}
QList<int> roles = model->roles();
@@ -512,14 +513,21 @@ void tst_qdeclarativexmllistmodel::useKeys_data()
<< makeItemXmlAndData("", &modelData)
<< modelData
<< QList<QDeclarativeXmlListRange>()
- << QList<QDeclarativeXmlListRange>();
+ << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 3));
QTest::newRow("replace item")
<< makeItemXmlAndData("name=A,age=25,sport=Football") << 1
<< makeItemXmlAndData("name=ZZZ,age=25,sport=Football", &modelData)
<< modelData
- << QList<QDeclarativeXmlListRange>()
- << QList<QDeclarativeXmlListRange>();
+ << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1))
+ << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1));
+
+ QTest::newRow("add and remove simultaneously, in different spots")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4
+ << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData)
+ << modelData
+ << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 1))
+ << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1) << qMakePair(2,2));
QTest::newRow("insert at start, remove at end i.e. rss feed")
<< makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 3
@@ -539,8 +547,8 @@ void tst_qdeclarativexmllistmodel::useKeys_data()
<< makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35") << 2
<< makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData)
<< modelData
- << QList<QDeclarativeXmlListRange>()
- << QList<QDeclarativeXmlListRange>();
+ << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 2))
+ << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 2));
}
void tst_qdeclarativexmllistmodel::noKeysValueChanges()
@@ -600,14 +608,20 @@ void tst_qdeclarativexmllistmodel::keysChanged()
QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int)));
QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int)));
QSignalSpy spyCount(model, SIGNAL(countChanged()));
- QSignalSpy spyReset(model, SIGNAL(modelReset()));
QVERIFY(QMetaObject::invokeMethod(model, "disableNameKey"));
model->setXml(xml);
- QTRY_COMPARE(spyReset.count(), 1);
- QCOMPARE(spyInsert.count(), 0);
- QCOMPARE(spyRemove.count(), 0);
+ QTRY_VERIFY(spyInsert.count() > 0 && spyRemove.count() > 0);
+
+ QCOMPARE(spyInsert.count(), 1);
+ QCOMPARE(spyInsert[0][0].toInt(), 0);
+ QCOMPARE(spyInsert[0][1].toInt(), 2);
+
+ QCOMPARE(spyRemove.count(), 1);
+ QCOMPARE(spyRemove[0][0].toInt(), 0);
+ QCOMPARE(spyRemove[0][1].toInt(), 2);
+
QCOMPARE(spyCount.count(), 0);
delete model;