diff options
author | Antti Piira <apiira@blackberry.com> | 2013-10-23 13:53:38 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-25 21:35:29 +0200 |
commit | 214d4a70bec89b640a35bbdec7fdd4e5d32e5873 (patch) | |
tree | d47f18c97963cbf76c0e9901d549d613a821bdaf /tests/auto/qml/qqmllanguage | |
parent | 5bd00073b814c080a70ded90472bd0e4f1d4157b (diff) |
Use finalUrl in QQmlTypeLoader::Blob::addPragma to fix a bug.
There was a bug in addPragma where url() was being used instead of
finalUrl(). This resulted in an error finding the type if selectors
were used. This patch includes the fix and adds a unit test to cover
the use case.
Change-Id: I18b6c73e96af2e1464931de76f1f8fd804746d82
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml | 10 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 20 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml b/tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml new file mode 100644 index 0000000000..3e289aed1a --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/singleton/+basicSelector/SingletonType.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +pragma Singleton + +Item { + id: singletonId + + property int testProp1: 625 + property int testProp2: 525 + property int testProp3: 455 +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 65afdb06d2..bd66fc88fc 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -49,6 +49,8 @@ #include <QtCore/qdir.h> #include <QSignalSpy> #include <QFont> +#include <QQmlFileSelector> +#include <QFileSelector> #include <private/qqmlproperty_p.h> #include <private/qqmlmetatype_p.h> @@ -209,6 +211,7 @@ private slots: void compositeSingletonQmlDirError(); void compositeSingletonRemote(); void compositeSingletonJavaScriptPragma(); + void compositeSingletonSelectors(); private: QQmlEngine engine; @@ -3501,6 +3504,23 @@ void tst_qqmllanguage::compositeSingletonJavaScriptPragma() verifyCompositeSingletonPropertyValues(o, "value1", 99, "value2", 333); } +// Reads values from a Singleton accessed through selectors. +void tst_qqmllanguage::compositeSingletonSelectors() +{ + QFileSelector selector; + selector.setExtraSelectors(QStringList() << "basicSelector"); + QQmlFileSelector qmlSelector; + qmlSelector.setSelector(&selector); + QQmlEngine e2; + e2.setUrlInterceptor(&qmlSelector); + QQmlComponent component(&e2, testFile("singletonTest1.qml")); + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + verifyCompositeSingletonPropertyValues(o, "value1", 625, "value2", 455); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |