summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-01-20 09:34:42 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-01-22 08:31:54 +0100
commit508b1fa173e135c839f07e0e4cd6009ac63a577c (patch)
treedde8a0dbf1d1e168897607666f01645084a08666 /tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
parent9e4ef3539a5770f1b422b73b41dc3218ff4efc81 (diff)
QTemporaryDir: Remove directories on failure
When creating a temporary directory but failing to set its permissions, we need to remove the directory we created to avoid leaving 256 empty, unused directories in the destination folder. This happens on Android if you try creating a QTemporaryDir in the download path on the sdcard. Task-number: QTBUG-43352 Change-Id: Ic88fb7572f1abd65e5c7d8882b59c95f4b22ed72 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp')
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index a68a1185b8..e909b90a12 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -70,6 +70,8 @@ private slots:
void QTBUG_4796_data();
void QTBUG_4796();
+ void QTBUG43352_failedSetPermissions();
+
public:
};
@@ -419,5 +421,17 @@ void tst_QTemporaryDir::QTBUG_4796() // unicode support
cleaner.reset();
}
+void tst_QTemporaryDir::QTBUG43352_failedSetPermissions()
+{
+ QString path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QStringLiteral("/");
+ int count = QDir(path).entryList().size();
+
+ {
+ QTemporaryDir dir(path);
+ }
+
+ QCOMPARE(QDir(path).entryList().size(), count);
+}
+
QTEST_MAIN(tst_QTemporaryDir)
#include "tst_qtemporarydir.moc"