GUITESTS: Add tests for adding directory.
This commit is contained in:
parent
d5652ee3cc
commit
8b70046a42
|
@ -0,0 +1 @@
|
|||
Dummy test file.
|
|
@ -0,0 +1 @@
|
|||
Dummy test file.
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include <QtTest>
|
||||
#include <QObject>
|
||||
#include <QDir>
|
||||
#include "testfilelist.h"
|
||||
#include "filelist.h"
|
||||
|
||||
|
@ -53,5 +54,24 @@ void TestFileList::addFile_unknown()
|
|||
QCOMPARE(files.size(), 0);
|
||||
}
|
||||
|
||||
void TestFileList::addDirectory()
|
||||
{
|
||||
FileList list;
|
||||
list.AddDirectory(QString(SRCDIR) + "/../data/files");
|
||||
QStringList files = list.GetFileList();
|
||||
QCOMPARE(files.size(), 7);
|
||||
}
|
||||
|
||||
void TestFileList::addDirectory_recursive()
|
||||
{
|
||||
FileList list;
|
||||
list.AddDirectory(QString(SRCDIR) + "/../data/files", true);
|
||||
QStringList files = list.GetFileList();
|
||||
QCOMPARE(files.size(), 9);
|
||||
QDir dir(QString(SRCDIR) + "/../data/files");
|
||||
QString base = dir.canonicalPath();
|
||||
QVERIFY(files.contains(base + "/dir1/foo1.cpp"));
|
||||
QVERIFY(files.contains(base + "/dir1/dir11/foo11.cpp"));
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestFileList)
|
||||
|
|
|
@ -27,4 +27,6 @@ private slots:
|
|||
void addFile();
|
||||
void addFile_notexist();
|
||||
void addFile_unknown();
|
||||
void addDirectory();
|
||||
void addDirectory_recursive();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue