diff options
| author | Alex Richardson <arichardson.kde@gmail.com> | 2014-05-07 20:47:28 +0200 | 
|---|---|---|
| committer | Alex Richardson <arichardson.kde@gmail.com> | 2014-05-07 20:48:16 +0200 | 
| commit | 80ffcf3b1679cc1f48c04a88583c4673d3c2ea47 (patch) | |
| tree | 9c9fd2712abdc6a9cb73f2ed7204c8d4a6313177 | |
| parent | 94419b6f0cd469dc7cb0184a6fb48c1fe304c4d8 (diff) | |
| download | kconfig-80ffcf3b1679cc1f48c04a88583c4673d3c2ea47.tar.gz kconfig-80ffcf3b1679cc1f48c04a88583c4673d3c2ea47.tar.bz2 | |
Test that kconfig always uses native line endings in the created files
| -rw-r--r-- | autotests/kconfigtest.cpp | 18 | ||||
| -rw-r--r-- | autotests/kconfigtest.h | 1 | 
2 files changed, 19 insertions, 0 deletions
| diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp index 2768318b..4f29ea87 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp @@ -1626,6 +1626,24 @@ void KConfigTest::testAnonymousConfig()      QCOMPARE(general.readEntry("Foo"), QString("Bar"));  } +void KConfigTest::testNewlines() +{ +    // test that kconfig always uses the native line endings +    QTemporaryFile file; +    file.open(); +    KConfig anonConfig(file.fileName(), KConfig::SimpleConfig); +    KConfigGroup general(&anonConfig, "General"); +    general.writeEntry("Foo", "Bar"); +    general.writeEntry("Bar", "Foo"); +    anonConfig.sync(); +#ifndef Q_OS_WIN +    QCOMPARE(file.readAll(), QByteArrayLiteral("[General]\nBar=Foo\nFoo=Bar\n")); +#else +    QCOMPARE(file.readAll(), QByteArrayLiteral("[General]\r\nBar=Foo\r\nFoo=Bar\r\n")); +#endif + +} +  #include <QThreadPool>  #include <qtconcurrentrun.h> diff --git a/autotests/kconfigtest.h b/autotests/kconfigtest.h index 6e947929..f2897a8f 100644 --- a/autotests/kconfigtest.h +++ b/autotests/kconfigtest.h @@ -75,6 +75,7 @@ private Q_SLOTS:      void testLocaleConfig();      void testDirtyAfterRevert();      void testKdeGlobals(); +    void testNewlines();      void testThreads(); | 
