#ifndef TESTDIR_H
#define TESTDIR_H
-#include <KTempDir>
-#include <KUrl>
-
+#include <QUrl>
+#include <QTemporaryDir>
#include <QDateTime>
/**
- * TestDir provides a temporary directory. In addition to KTempDir, it has
+ * TestDir provides a temporary directory. In addition to QTemporaryDir, it has
* methods that create files and subdirectories inside the directory.
*/
-
-class TestDir : public KTempDir
+class TestDir : public QTemporaryDir
{
public:
+ TestDir(const QString& directoryPrefix = QString());
+ virtual ~TestDir();
- TestDir() {}
- ~TestDir() {}
-
- KUrl url() const { return KUrl(name()); }
+ QUrl url() const;
/**
* The following functions create either a file, a list of files, or a directory.
* The paths may be absolute or relative to the test directory. Any missing parent
* directories will be created automatically.
*/
-
- void createFile(const QString& path, const QByteArray& data = QByteArray("test"), const QDateTime& time = QDateTime());
+ void createFile(const QString& path,
+ const QByteArray& data = QByteArray("test"),
+ const QDateTime& time = QDateTime());
void createFiles(const QStringList& files);
void createDir(const QString& path, const QDateTime& time = QDateTime());
-private:
+ void removeFile(const QString& path);
+ void removeFiles(const QStringList& files);
+private:
void makePathAbsoluteAndCreateParents(QString& path);
};