summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtemporaryfile
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-04-02 15:17:16 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-04-02 17:13:35 (GMT)
commitb2b11265d9cf20706eadca61c37d931886eb35cf (patch)
tree759504fdafd6462a6e9febadaa9626942f54978c /tests/auto/qtemporaryfile
parentfb5790e1b1d4ddeac19a2996c806744509de4ac8 (diff)
downloadQt-b2b11265d9cf20706eadca61c37d931886eb35cf.zip
Qt-b2b11265d9cf20706eadca61c37d931886eb35cf.tar.gz
Qt-b2b11265d9cf20706eadca61c37d931886eb35cf.tar.bz2
Adding auto-tests for commits a2fcc4a5 and 8d500381
Task-number: 244500 Task-number: 244485 Reviewed-by: ossi Reviewed-by: thiago
Diffstat (limited to 'tests/auto/qtemporaryfile')
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index d2a2546..9364af4 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -77,6 +77,7 @@ private slots:
void resize();
void openOnRootDrives();
void stressTest();
+ void rename();
public:
};
@@ -335,5 +336,30 @@ void tst_QTemporaryFile::stressTest()
}
}
+void tst_QTemporaryFile::rename()
+{
+ // This test checks that the temporary file is deleted, even after a
+ // rename.
+
+ QDir dir;
+ QVERIFY(!dir.exists("temporary-file.txt"));
+
+ QString tempname;
+ {
+ QTemporaryFile file(dir.filePath("temporary-file.XXXXXX"));
+
+ QVERIFY(file.open());
+ tempname = file.fileName();
+ QVERIFY(dir.exists(tempname));
+
+ QVERIFY(file.rename("temporary-file.txt"));
+ QVERIFY(!dir.exists(tempname));
+ QVERIFY(dir.exists("temporary-file.txt"));
+ }
+
+ QVERIFY(!dir.exists(tempname));
+ QVERIFY(!dir.exists("temporary-file.txt"));
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"