summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 501ad6f415..2c9868cd10 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -166,6 +166,7 @@ private slots:
void testByteArray_data();
void testByteArray();
+ void iniCodec();
private:
const bool m_canWriteNativeSystemSettings;
@@ -695,6 +696,28 @@ void tst_QSettings::testByteArray()
}
}
+void tst_QSettings::iniCodec()
+{
+ {
+ QSettings settings("QtProject", "tst_qsettings");
+ settings.setIniCodec("cp1251");
+ QByteArray ba;
+ ba.resize(256);
+ for (int i = 0; i < ba.size(); i++)
+ ba[i] = i;
+ settings.setValue("array",ba);
+ }
+ {
+ QSettings settings("QtProject", "tst_qsettings");
+ settings.setIniCodec("cp1251");
+ QByteArray ba = settings.value("array").toByteArray();
+ QCOMPARE(ba.size(), 256);
+ for (int i = 0; i < ba.size(); i++)
+ QCOMPARE((uchar)ba.at(i), (uchar)i);
+ }
+
+}
+
void tst_QSettings::testErrorHandling_data()
{
QTest::addColumn<int>("filePerms"); // -1 means file should not exist