diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-11-16 16:56:20 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-11-16 18:36:05 (GMT) |
commit | bc6d6b99981f5abf4d8f4059f86f0441156b6700 (patch) | |
tree | a0cc4279f7421c638e54f48ac0dcf6f57a0008fb /tests/auto/qdir | |
parent | c7e569802ac4d547482d529e910232a80347fc67 (diff) | |
download | Qt-bc6d6b99981f5abf4d8f4059f86f0441156b6700.zip Qt-bc6d6b99981f5abf4d8f4059f86f0441156b6700.tar.gz Qt-bc6d6b99981f5abf4d8f4059f86f0441156b6700.tar.bz2 |
test coverage: add test for QDir::match static functions
Reviewed-By: joao
Diffstat (limited to 'tests/auto/qdir')
-rw-r--r-- | tests/auto/qdir/tst_qdir.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 4f6c784..62f45e8 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -183,6 +183,11 @@ private slots: void isRoot_data(); void isRoot(); #endif + +#ifndef QT_NO_REGEXP + void match_data(); + void match(); +#endif }; // Testing get/set functions @@ -1738,6 +1743,31 @@ void tst_QDir::isRoot() } #endif +#ifndef QT_NO_REGEXP +void tst_QDir::match_data() +{ + QTest::addColumn<QString>("filter"); + QTest::addColumn<QString>("filename"); + QTest::addColumn<bool>("match"); + + QTest::newRow("single, matching") << "*.cpp" << "tst_qdir.cpp" << true; + QTest::newRow("single, not matching") << "*.cpp" << "tst_qdir.h" << false; + QTest::newRow("multi, matching") << "*.cpp;*.h" << "tst_qdir.cpp" << true; + QTest::newRow("multi, matching2") << "*.cpp;*.h" << "tst_qdir.h" << true; + QTest::newRow("multi, not matching") << "*.cpp;*.h" << "readme.txt" << false; +} + +void tst_QDir::match() +{ + QFETCH(QString, filter); + QFETCH(QString, filename); + QFETCH(bool, match); + + QCOMPARE(QDir::match(filter, filename), match); + QCOMPARE(QDir::match(filter.split(QLatin1Char(';')), filename), match); +} +#endif + QTEST_MAIN(tst_QDir) #include "tst_qdir.moc" |