aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-04-20 14:50:03 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-26 03:33:13 +0200
commitf29c5732f6dbb2c928a088bb14dfb63b600ca9c8 (patch)
tree938ab6533d309abcc706369680248db31a6a3da3 /tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
parent1d0368335d25b70d3cecbbcea224feb9ac0d6e59 (diff)
Remove relative directory elements in import paths
Avoid unnecessary conversions to/from QUrl. Change-Id: If52e78cfdaf4fe344f34d961e300b21dd4a11fb2 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp')
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index eebb558bce..b534d0c788 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -323,10 +323,9 @@ void tst_qqmlcomponent::componentUrlCanonicalization()
// load components via import
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != 0);
QVERIFY(object->property("success").toBool());
- delete object;
}
{
@@ -334,20 +333,36 @@ void tst_qqmlcomponent::componentUrlCanonicalization()
// import of the other if it were not already loaded.
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.2.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != 0);
QVERIFY(object->property("success").toBool());
- delete object;
}
{
// load components with more deeply nested imports
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.3.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != 0);
QVERIFY(object->property("success").toBool());
- delete object;
+ }
+
+ {
+ // load components with unusually specified import paths
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.4.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ }
+
+ {
+ // Do not crash with various nonsense import paths
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.5.qml"));
+ QTest::ignoreMessage(QtWarningMsg, QLatin1String("QQmlComponent: Component is not ready").data());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object == 0);
}
}