Fix temporary file leak in tst_qfiledialog2.

Change-Id: I5a1e601e3aa6e84300efa09bfbd9232fecab903e
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Friedemann Kleint 2013-10-02 11:37:33 +02:00 committed by The Qt Project
parent 7d4236d281
commit cdf0c5905b

View File

@ -1199,10 +1199,9 @@ void tst_QFileDialog2::task259105_filtersCornerCases()
void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
{
QString tempPath = tempDir.path();
QTemporaryFile *t;
t = new QTemporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
t->open();
QNonNativeFileDialog fd(0, "TestFileDialog", t->fileName());
QTemporaryFile temporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
QVERIFY(temporaryFile.open());
QNonNativeFileDialog fd(0, "TestFileDialog", temporaryFile.fileName());
fd.setDirectory(tempPath);
fd.setViewMode(QFileDialog::List);
@ -1218,8 +1217,8 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
QVERIFY(lineEdit);
QTRY_COMPARE(tempPath + QChar('/') + lineEdit->text(), t->fileName());
QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName());
QTRY_COMPARE(tempPath + QChar('/') + lineEdit->text(), temporaryFile.fileName());
QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), temporaryFile.fileName());
}
void tst_QFileDialog2::QTBUG6558_showDirsOnly()