aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp')
-rw-r--r--tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index 316ac50c5e..4668af408f 100644
--- a/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/qtquick2/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -66,7 +66,7 @@ Q_DECLARE_METATYPE(QList<QDeclarativeXmlListRange>)
Q_DECLARE_METATYPE(QDeclarativeXmlModelData)
Q_DECLARE_METATYPE(QDeclarativeXmlListModel::Status)
-class tst_qdeclarativexmllistmodel : public QObject
+class tst_qdeclarativexmllistmodel : public QDeclarativeDataTest
{
Q_OBJECT
@@ -75,6 +75,7 @@ public:
private slots:
void initTestCase() {
+ QDeclarativeDataTest::initTestCase();
qRegisterMetaType<QDeclarativeXmlListModel::Status>();
}
@@ -194,7 +195,7 @@ QNetworkAccessManager *CustomNetworkAccessManagerFactory::create(QObject *parent
void tst_qdeclarativexmllistmodel::buildModel()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
@@ -213,7 +214,7 @@ void tst_qdeclarativexmllistmodel::testTypes()
QFETCH(QString, roleName);
QFETCH(QVariant, expectedValue);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("testtypes.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("testtypes.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
model->setProperty("xml",xml.toUtf8());
@@ -273,7 +274,7 @@ void tst_qdeclarativexmllistmodel::testTypes_data()
void tst_qdeclarativexmllistmodel::cdata()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("recipes.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("recipes.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 5);
@@ -285,7 +286,7 @@ void tst_qdeclarativexmllistmodel::cdata()
void tst_qdeclarativexmllistmodel::attributes()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("recipes.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("recipes.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 5);
@@ -296,7 +297,7 @@ void tst_qdeclarativexmllistmodel::attributes()
void tst_qdeclarativexmllistmodel::roles()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
@@ -313,9 +314,9 @@ void tst_qdeclarativexmllistmodel::roles()
void tst_qdeclarativexmllistmodel::roleErrors()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleErrors.qml")));
- QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("roleErrors.qml")).toString() + ":7:5: QML XmlRole: An XmlRole query must not start with '/'").toUtf8().constData());
- QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("roleErrors.qml")).toString() + ":10:5: QML XmlRole: invalid query: \"age/\"").toUtf8().constData());
+ QDeclarativeComponent component(&engine, testFileUrl("roleErrors.qml"));
+ QTest::ignoreMessage(QtWarningMsg, (testFileUrl("roleErrors.qml").toString() + ":7:5: QML XmlRole: An XmlRole query must not start with '/'").toUtf8().constData());
+ QTest::ignoreMessage(QtWarningMsg, (testFileUrl("roleErrors.qml").toString() + ":10:5: QML XmlRole: invalid query: \"age/\"").toUtf8().constData());
//### make sure we receive all expected warning messages.
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
@@ -336,8 +337,8 @@ void tst_qdeclarativexmllistmodel::roleErrors()
void tst_qdeclarativexmllistmodel::uniqueRoleNames()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("unique.qml")));
- QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("unique.qml")).toString() + ":8:5: QML XmlRole: \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData());
+ QDeclarativeComponent component(&engine, testFileUrl("unique.qml"));
+ QTest::ignoreMessage(QtWarningMsg, (testFileUrl("unique.qml").toString() + ":8:5: QML XmlRole: \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData());
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
@@ -354,7 +355,7 @@ void tst_qdeclarativexmllistmodel::xml()
QFETCH(QString, xml);
QFETCH(int, count);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)));
@@ -409,7 +410,7 @@ void tst_qdeclarativexmllistmodel::headers()
CustomNetworkAccessManagerFactory factory;
qmlEng.setNetworkAccessManagerFactory(&factory);
- QDeclarativeComponent component(&qmlEng, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&qmlEng, testFileUrl("model.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(qvariant_cast<QDeclarativeXmlListModel::Status>(model->property("status")),
@@ -433,7 +434,7 @@ void tst_qdeclarativexmllistmodel::source()
QFETCH(int, count);
QFETCH(QDeclarativeXmlListModel::Status, status);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)));
@@ -489,7 +490,7 @@ void tst_qdeclarativexmllistmodel::source_data()
QTest::addColumn<int>("count");
QTest::addColumn<QDeclarativeXmlListModel::Status>("status");
- QTest::newRow("valid") << QUrl::fromLocalFile(TESTDATA("model2.xml")) << 2
+ QTest::newRow("valid") << testFileUrl("model2.xml") << 2
<< QDeclarativeXmlListModel::Ready;
QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0
<< QDeclarativeXmlListModel::Error;
@@ -504,7 +505,7 @@ void tst_qdeclarativexmllistmodel::source_data()
void tst_qdeclarativexmllistmodel::data()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
@@ -520,7 +521,7 @@ void tst_qdeclarativexmllistmodel::data()
void tst_qdeclarativexmllistmodel::get()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("get.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("get.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
@@ -541,7 +542,7 @@ void tst_qdeclarativexmllistmodel::reload()
// If no keys are used, the model should be rebuilt from scratch when
// reload() is called.
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
@@ -581,7 +582,7 @@ void tst_qdeclarativexmllistmodel::useKeys()
QFETCH(QList<QDeclarativeXmlListRange>, insertRanges);
QFETCH(QList<QDeclarativeXmlListRange>, removeRanges);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("roleKeys.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
@@ -732,7 +733,7 @@ void tst_qdeclarativexmllistmodel::noKeysValueChanges()
// If a 'sport' value is changed, the model should not be reloaded,
// since 'sport' is not marked as a key.
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("roleKeys.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
@@ -770,7 +771,7 @@ void tst_qdeclarativexmllistmodel::keysChanged()
// delete all its data and build a clean model (i.e. same behaviour as
// if no keys are set).
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("roleKeys.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
@@ -806,7 +807,7 @@ void tst_qdeclarativexmllistmodel::threading()
{
QFETCH(int, xmlDataCount);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("roleKeys.qml"));
QListModelInterface *m1 = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(m1 != 0);
@@ -879,7 +880,7 @@ void tst_qdeclarativexmllistmodel::threading_data()
void tst_qdeclarativexmllistmodel::propertyChanges()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("propertychanges.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("propertychanges.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
QTRY_COMPARE(model->count(), 9);
@@ -950,7 +951,7 @@ void tst_qdeclarativexmllistmodel::propertyChanges()
void tst_qdeclarativexmllistmodel::roleCrash()
{
// don't crash
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleCrash.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("roleCrash.qml"));
QListModelInterface *model = qobject_cast<QListModelInterface*>(component.create());
QVERIFY(model != 0);
delete model;