summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcompleter/tst_qcompleter.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2010-12-16 15:31:34 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2010-12-17 11:59:50 (GMT)
commita97cf9553ff841dcfd45bbc85ff05b0aafd4a548 (patch)
tree288a7f6c4427466eab48d4f75dd484500dd2b535 /tests/auto/qcompleter/tst_qcompleter.cpp
parent5daf1ab79e3dd906664a7af00b311ba7c3f51138 (diff)
downloadQt-a97cf9553ff841dcfd45bbc85ff05b0aafd4a548.zip
Qt-a97cf9553ff841dcfd45bbc85ff05b0aafd4a548.tar.gz
Qt-a97cf9553ff841dcfd45bbc85ff05b0aafd4a548.tar.bz2
tst_QCompleter: Clean up after one's self
The utility class FileSystem uses the RAII idiom to clean up directories created for the purpose of the test. Rubber-stamped-by: Oswald Buddenhagen
Diffstat (limited to 'tests/auto/qcompleter/tst_qcompleter.cpp')
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index abc86ec..62e64be 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -49,6 +49,7 @@
#include <QPointer>
#include "../../shared/util.h"
+#include "../../shared/filesystem.h"
//TESTED_CLASS=
//TESTED_FILES=
@@ -1455,24 +1456,16 @@ void tst_QCompleter::task247560_keyboardNavigation()
void tst_QCompleter::QTBUG_14292_filesystem()
{
+ FileSystem fs;
QDir tmpDir = QDir::currentPath();
+
qsrand(QTime::currentTime().msec());
QString d = "tst_QCompleter_" + QString::number(qrand());
- QVERIFY(tmpDir.mkdir(d));
-
-#if 0
- struct Cleanup {
- QString dir;
- ~Cleanup() {
- qDebug() << dir <<
- QFile::remove(dir); }
- } cleanup;
- cleanup.dir = tmpDir.absolutePath()+"/" +d;
-#endif
+ QVERIFY(fs.createDirectory(tmpDir.filePath(d)));
QVERIFY(tmpDir.cd(d));
- QVERIFY(tmpDir.mkdir("hello"));
- QVERIFY(tmpDir.mkdir("holla"));
+ QVERIFY(fs.createDirectory(tmpDir.filePath("hello")));
+ QVERIFY(fs.createDirectory(tmpDir.filePath("holla")));
QLineEdit edit;
QCompleter comp;
@@ -1500,12 +1493,12 @@ void tst_QCompleter::QTBUG_14292_filesystem()
QCOMPARE(comp.popup()->model()->rowCount(), 1);
QTest::keyClick(&edit, 'r');
QTRY_VERIFY(!comp.popup()->isVisible());
- QVERIFY(tmpDir.mkdir("hero"));
+ QVERIFY(fs.createDirectory(tmpDir.filePath("hero")));
QTRY_VERIFY(comp.popup()->isVisible());
QCOMPARE(comp.popup()->model()->rowCount(), 1);
QTest::keyClick(comp.popup(), Qt::Key_Escape);
QTRY_VERIFY(!comp.popup()->isVisible());
- QVERIFY(tmpDir.mkdir("nothingThere"));
+ QVERIFY(fs.createDirectory(tmpDir.filePath("nothingThere")));
//there is no reason creating a file should open a popup, it did in Qt 4.7.0
QTest::qWait(60);
QVERIFY(!comp.popup()->isVisible());
@@ -1522,7 +1515,7 @@ void tst_QCompleter::QTBUG_14292_filesystem()
QTest::qWaitForWindowShown(&w);
QTRY_VERIFY(!edit.hasFocus() && !comp.popup()->hasFocus());
- QVERIFY(tmpDir.mkdir("hemo"));
+ QVERIFY(fs.createDirectory(tmpDir.filePath("hemo")));
//there is no reason creating a file should open a popup, it did in Qt 4.7.0
QTest::qWait(60);
QVERIFY(!comp.popup()->isVisible());