Test that kconfig always uses native line endings in the created files

wilder
Alex Richardson 12 years ago
parent 94419b6f0c
commit 80ffcf3b16
  1. 18
      autotests/kconfigtest.cpp
  2. 1
      autotests/kconfigtest.h

@ -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>

@ -75,6 +75,7 @@ private Q_SLOTS:
void testLocaleConfig();
void testDirtyAfterRevert();
void testKdeGlobals();
void testNewlines();
void testThreads();

Loading…
Cancel
Save