tst_QTextStream::textModeOnEmptyRead(): Create file in temporary directory.

A test should not write to its directory. Amends change
d0b54cede8d8ea0b8431c64abb51d0cd1a71327b.

Task-number: QTBUG-47176
Change-Id: If15258b4aed199792fab422b7ac1d74e22a9e322
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2016-03-10 16:35:53 +01:00 committed by Jędrzej Nowacki
parent a2d58025b6
commit a8c72b7671

View File

@ -3049,12 +3049,10 @@ void tst_QTextStream::int_write_with_locale()
void tst_QTextStream::textModeOnEmptyRead()
{
const QString filename("textmodetest.txt");
QFile::remove(filename); // Remove file if exists
const QString filename(tempDir.path() + QLatin1String("/textmodetest.txt"));
QFile file(filename);
QVERIFY(file.open(QIODevice::ReadWrite | QIODevice::Text));
QVERIFY2(file.open(QIODevice::ReadWrite | QIODevice::Text), qPrintable(file.errorString()));
QTextStream stream(&file);
QVERIFY(file.isTextModeEnabled());
QString emptyLine = stream.readLine(); // Text mode flag cleared here