summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdirmodel
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-03-22 04:09:20 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-03-22 04:09:20 (GMT)
commitc1958338bb94f045c846147bdb7224377a2122a6 (patch)
treebab76e1baed0fcc5f49697378c9d5e07bdec0b42 /tests/auto/qdirmodel
parent44660e6d34ce969069a82fe26f5e4b13d4d5ec78 (diff)
downloadQt-c1958338bb94f045c846147bdb7224377a2122a6.zip
Qt-c1958338bb94f045c846147bdb7224377a2122a6.tar.gz
Qt-c1958338bb94f045c846147bdb7224377a2122a6.tar.bz2
Set role names for QFileSystemModel and QDirModel
Task-number: QTBUG-7479 Reviewed-by: Alexis Menard
Diffstat (limited to 'tests/auto/qdirmodel')
-rw-r--r--tests/auto/qdirmodel/tst_qdirmodel.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qdirmodel/tst_qdirmodel.cpp b/tests/auto/qdirmodel/tst_qdirmodel.cpp
index d7f0112..1bc5b7f 100644
--- a/tests/auto/qdirmodel/tst_qdirmodel.cpp
+++ b/tests/auto/qdirmodel/tst_qdirmodel.cpp
@@ -106,6 +106,9 @@ private slots:
void filter();
void task244669_remove();
+
+ void roleNames_data();
+ void roleNames();
};
// Testing get/set functions
@@ -681,5 +684,30 @@ void tst_QDirModel::task244669_remove()
QCOMPARE(parent.data() , model.index(SRCDIR "dirtest").data());
}
+void tst_QDirModel::roleNames_data()
+{
+ QTest::addColumn<int>("role");
+ QTest::addColumn<QByteArray>("roleName");
+ QTest::newRow("decoration") << int(Qt::DecorationRole) << QByteArray("decoration");
+ QTest::newRow("display") << int(Qt::DisplayRole) << QByteArray("display");
+ QTest::newRow("fileIcon") << int(QDirModel::FileIconRole) << QByteArray("fileIcon");
+ QTest::newRow("filePath") << int(QDirModel::FilePathRole) << QByteArray("filePath");
+ QTest::newRow("fileName") << int(QDirModel::FileNameRole) << QByteArray("fileName");
+}
+
+void tst_QDirModel::roleNames()
+{
+ QDirModel model;
+ QHash<int, QByteArray> roles = model.roleNames();
+
+ QFETCH(int, role);
+ QVERIFY(roles.contains(role));
+
+ QFETCH(QByteArray, roleName);
+ QList<QByteArray> values = roles.values(role);
+ QVERIFY(values.contains(roleName));
+}
+
+
QTEST_MAIN(tst_QDirModel)
#include "tst_qdirmodel.moc"