summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtemporaryfile
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-04-02 17:17:16 +0200
committerJoão Abecasis <joao@abecasis.name>2009-04-02 19:13:35 +0200
commitb2b11265d9cf20706eadca61c37d931886eb35cf (patch)
tree759504fdafd6462a6e9febadaa9626942f54978c /tests/auto/qtemporaryfile
parentfb5790e1b1d4ddeac19a2996c806744509de4ac8 (diff)
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 d2a2546da8..9364af45f6 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"