diff options
author | Ilya Kotov <i.kotov@rusbitech.ru> | 2018-01-10 16:32:27 +0300 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-01-28 09:43:02 +0000 |
commit | e29047555be764d59c52801553e23767ed367cec (patch) | |
tree | d98647b57e29d28c7250b9d7ea581854a167b985 /tests | |
parent | e8f3f37bc2d05190c4f16c372a487901e0d2e03d (diff) |
FolderListModel: add status property
This allows to track directory loading
Task-number: QTBUG-48708
Change-Id: If79a325ef1bfc831d3bc2a205e3127a571fcb0c1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp index f19e82032a..1a23286ede 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -42,6 +42,7 @@ // From qquickfolderlistmodel.h const int FileNameRole = Qt::UserRole+1; enum SortField { Unsorted, Name, Time, Size, Type }; +enum Status { Null, Ready, Loading }; class tst_qquickfolderlistmodel : public QQmlDataTest { @@ -58,6 +59,7 @@ public slots: private slots: void initTestCase(); void basicProperties(); + void status(); void showFiles(); void resetFiltering(); void nameFilters(); @@ -141,6 +143,20 @@ void tst_qquickfolderlistmodel::basicProperties() QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile("")); } +void tst_qquickfolderlistmodel::status() +{ + QQmlComponent component(&engine, testFileUrl("basic.qml")); + checkNoErrors(component); + + QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); + QVERIFY(flm != 0); + QTRY_COMPARE(flm->property("status").toInt(), int(Ready)); + flm->setProperty("folder", QUrl::fromLocalFile("")); + QTRY_COMPARE(flm->property("status").toInt(), int(Null)); + flm->setProperty("folder", QUrl::fromLocalFile(QDir::currentPath())); + QTRY_COMPARE(flm->property("status").toInt(), int(Ready)); +} + void tst_qquickfolderlistmodel::showFiles() { QQmlComponent component(&engine, testFileUrl("basic.qml")); |