equal
deleted
inserted
replaced
104 void fileName_data(); |
104 void fileName_data(); |
105 void task196768_sorting(); |
105 void task196768_sorting(); |
106 void filter(); |
106 void filter(); |
107 |
107 |
108 void task244669_remove(); |
108 void task244669_remove(); |
|
109 |
|
110 void roleNames_data(); |
|
111 void roleNames(); |
109 }; |
112 }; |
110 |
113 |
111 // Testing get/set functions |
114 // Testing get/set functions |
112 void tst_QDirModel::getSetCheck() |
115 void tst_QDirModel::getSetCheck() |
113 { |
116 { |
608 void tst_QDirModel::task196768_sorting() |
611 void tst_QDirModel::task196768_sorting() |
609 { |
612 { |
610 //this task showed that the persistent model indexes got corrupted when sorting |
613 //this task showed that the persistent model indexes got corrupted when sorting |
611 QString path = SRCDIR; |
614 QString path = SRCDIR; |
612 |
615 |
|
616 #ifdef Q_OS_SYMBIAN |
|
617 if(!RProcess().HasCapability(ECapabilityAllFiles)) |
|
618 QEXPECT_FAIL("", "QTBUG-9746", Continue); |
|
619 #endif |
|
620 |
613 QDirModel model; |
621 QDirModel model; |
614 |
622 |
615 /* QDirModel has a bug if we show the content of the subdirectory inside a hidden directory |
623 /* QDirModel has a bug if we show the content of the subdirectory inside a hidden directory |
616 and we don't add QDir::Hidden. But as QDirModel is deprecated, we decided not to fix it. */ |
624 and we don't add QDir::Hidden. But as QDirModel is deprecated, we decided not to fix it. */ |
617 model.setFilter(QDir::AllEntries | QDir::Hidden | QDir::AllDirs); |
625 model.setFilter(QDir::AllEntries | QDir::Hidden | QDir::AllDirs); |
679 QVERIFY(!index2.isValid()); |
687 QVERIFY(!index2.isValid()); |
680 QVERIFY(!index1.isValid()); |
688 QVERIFY(!index1.isValid()); |
681 QCOMPARE(parent.data() , model.index(SRCDIR "dirtest").data()); |
689 QCOMPARE(parent.data() , model.index(SRCDIR "dirtest").data()); |
682 } |
690 } |
683 |
691 |
|
692 void tst_QDirModel::roleNames_data() |
|
693 { |
|
694 QTest::addColumn<int>("role"); |
|
695 QTest::addColumn<QByteArray>("roleName"); |
|
696 QTest::newRow("decoration") << int(Qt::DecorationRole) << QByteArray("decoration"); |
|
697 QTest::newRow("display") << int(Qt::DisplayRole) << QByteArray("display"); |
|
698 QTest::newRow("fileIcon") << int(QDirModel::FileIconRole) << QByteArray("fileIcon"); |
|
699 QTest::newRow("filePath") << int(QDirModel::FilePathRole) << QByteArray("filePath"); |
|
700 QTest::newRow("fileName") << int(QDirModel::FileNameRole) << QByteArray("fileName"); |
|
701 } |
|
702 |
|
703 void tst_QDirModel::roleNames() |
|
704 { |
|
705 QDirModel model; |
|
706 QHash<int, QByteArray> roles = model.roleNames(); |
|
707 |
|
708 QFETCH(int, role); |
|
709 QVERIFY(roles.contains(role)); |
|
710 |
|
711 QFETCH(QByteArray, roleName); |
|
712 QList<QByteArray> values = roles.values(role); |
|
713 QVERIFY(values.contains(roleName)); |
|
714 } |
|
715 |
|
716 |
684 QTEST_MAIN(tst_QDirModel) |
717 QTEST_MAIN(tst_QDirModel) |
685 #include "tst_qdirmodel.moc" |
718 #include "tst_qdirmodel.moc" |