QDirListing: extend unit tests
Add the tests for the (move-)constructors and move-assignment. Change-Id: I795a314a0e6d1795006fe152397eb6d9eeb3c712 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit b6466275c27f9ec4ec8b09641e203f7afef3f7e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
cb6a3fe53e
commit
d4d2636e5e
@ -64,6 +64,7 @@ private: // convenience functions
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void constructorsAndAssignment();
|
||||
void iterateRelativeDirectory_data();
|
||||
void iterateRelativeDirectory();
|
||||
void iterateResource_data();
|
||||
@ -182,6 +183,41 @@ void tst_QDirListing::initTestCase()
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QDirListing::constructorsAndAssignment()
|
||||
{
|
||||
using F = QDirListing::IteratorFlag;
|
||||
const QString path = "entrylist"_L1;
|
||||
const auto flags = QDirListing::IteratorFlags{F::IncludeDotAndDotDot | F::IncludeHidden};
|
||||
const QStringList nameFilters = {"*.cpp"_L1, "*.h"_L1};
|
||||
{
|
||||
const QDirListing dl{path, flags};
|
||||
QCOMPARE_EQ(dl.iteratorPath(), path);
|
||||
QCOMPARE_EQ(dl.iteratorFlags(), flags);
|
||||
QVERIFY(dl.nameFilters().isEmpty());
|
||||
}
|
||||
{
|
||||
const QDirListing dl{path, nameFilters, flags};
|
||||
QCOMPARE_EQ(dl.iteratorPath(), path);
|
||||
QCOMPARE_EQ(dl.iteratorFlags(), flags);
|
||||
QCOMPARE_EQ(dl.nameFilters(), nameFilters);
|
||||
}
|
||||
{
|
||||
QDirListing other{path, nameFilters, flags};
|
||||
QDirListing dl{std::move(other)};
|
||||
QCOMPARE_EQ(dl.iteratorPath(), path);
|
||||
QCOMPARE_EQ(dl.iteratorFlags(), flags);
|
||||
QCOMPARE_EQ(dl.nameFilters(), nameFilters);
|
||||
}
|
||||
{
|
||||
QDirListing dl{"foo"_L1};
|
||||
QDirListing other{path, nameFilters, flags};
|
||||
dl = std::move(other);
|
||||
QCOMPARE_EQ(dl.iteratorPath(), path);
|
||||
QCOMPARE_EQ(dl.iteratorFlags(), flags);
|
||||
QCOMPARE_EQ(dl.nameFilters(), nameFilters);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QDirListing::iterateRelativeDirectory_data()
|
||||
{
|
||||
QTest::addColumn<QString>("dirName"); // relative from current path or abs
|
||||
|
Loading…
x
Reference in New Issue
Block a user