GUITESTS: Add tests for adding directory.

This commit is contained in:
Kimmo Varis 2011-06-17 14:54:04 +03:00
parent d5652ee3cc
commit 8b70046a42
4 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1 @@
Dummy test file.

View File

@ -0,0 +1 @@
Dummy test file.

View 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)

View File

@ -27,4 +27,6 @@ private slots:
void addFile();
void addFile_notexist();
void addFile_unknown();
void addDirectory();
void addDirectory_recursive();
};