diff options
| author | Alex Richardson <arichardson.kde@gmail.com> | 2014-05-07 21:02:31 +0200 | 
|---|---|---|
| committer | Alex Richardson <arichardson.kde@gmail.com> | 2014-05-07 21:02:31 +0200 | 
| commit | 7f585fc4b95997018babe68d2e19c1bad172373e (patch) | |
| tree | c5cfab556664da6eb94f8f9db072b1cd113850f7 | |
| parent | 80ffcf3b1679cc1f48c04a88583c4673d3c2ea47 (diff) | |
| download | kconfig-7f585fc4b95997018babe68d2e19c1bad172373e.tar.gz kconfig-7f585fc4b95997018babe68d2e19c1bad172373e.tar.bz2  | |
Apparently calling readAll() on the temporary file doesn't work
Open a new QFile for reading after calling close() on the temp file
| -rw-r--r-- | autotests/kconfigtest.cpp | 11 | 
1 files changed, 8 insertions, 3 deletions
diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp index 4f29ea87..d82d8ca4 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp @@ -1630,16 +1630,21 @@ void KConfigTest::testNewlines()  {      // test that kconfig always uses the native line endings      QTemporaryFile file; -    file.open(); +    QVERIFY(file.open()); +    qWarning() << file.fileName();      KConfig anonConfig(file.fileName(), KConfig::SimpleConfig);      KConfigGroup general(&anonConfig, "General");      general.writeEntry("Foo", "Bar");      general.writeEntry("Bar", "Foo");      anonConfig.sync(); +    file.flush(); +    file.close(); +    QFile readFile(file.fileName()); +    QVERIFY(readFile.open(QFile::ReadOnly));  #ifndef Q_OS_WIN -    QCOMPARE(file.readAll(), QByteArrayLiteral("[General]\nBar=Foo\nFoo=Bar\n")); +    QCOMPARE(readFile.readAll(), QByteArrayLiteral("[General]\nBar=Foo\nFoo=Bar\n"));  #else -    QCOMPARE(file.readAll(), QByteArrayLiteral("[General]\r\nBar=Foo\r\nFoo=Bar\r\n")); +    QCOMPARE(readFile.readAll(), QByteArrayLiteral("[General]\r\nBar=Foo\r\nFoo=Bar\r\n"));  #endif  }  | 
