diff options
author | Alan Alpert <416365416c@gmail.com> | 2013-11-12 00:11:43 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-13 09:32:27 +0100 |
commit | 87f90a43f450cda5e8ce7bf34145f251dfaa5682 (patch) | |
tree | d18ea8855dc7262b6091fc874c6eade22895e228 /tests/auto/qml/qqmlfileselector | |
parent | 60d86d531811e0ef5a4819395418aaec9f651315 (diff) |
Polish up QQmlFileSelector
Incorporate beta feedback, and hide QQmlAbstractUrlInterceptor as the
implementation (instead of making that "the API").
Change-Id: Ib7b14afeb9205fb8a87ed16a6d38b1f468b2aaaa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlfileselector')
-rw-r--r-- | tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp index a583fd0c4c..a9c1c11549 100644 --- a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp +++ b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp @@ -43,6 +43,7 @@ #include <QQmlEngine> #include <QQmlComponent> #include <QQmlFileSelector> +#include <QQmlApplicationEngine> #include <QFileSelector> #include <QQmlContext> #include <qqmlinfo.h> @@ -56,17 +57,30 @@ public: private slots: void basicTest(); + void applicationEngineTest(); }; void tst_qqmlfileselector::basicTest() { QQmlEngine engine; - QFileSelector selector; + QQmlFileSelector selector(&engine); selector.setExtraSelectors(QStringList() << "basic"); - QQmlFileSelector qmlSelector; - qmlSelector.setSelector(&selector); - engine.setUrlInterceptor(&qmlSelector); + + QQmlComponent component(&engine, testFileUrl("basicTest.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toString(), QString("selected")); + + delete object; +} + +void tst_qqmlfileselector::applicationEngineTest() +{ + QQmlApplicationEngine engine; + QQmlFileSelector* selector = QQmlFileSelector::get(&engine); + QVERIFY(selector != 0); + selector->setExtraSelectors(QStringList() << "basic"); QQmlComponent component(&engine, testFileUrl("basicTest.qml")); QObject *object = component.create(); |