aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfigtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'autotests/kconfigtest.cpp')
-rw-r--r--autotests/kconfigtest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp
index 5f2c7989..7cb3f903 100644
--- a/autotests/kconfigtest.cpp
+++ b/autotests/kconfigtest.cpp
@@ -1672,6 +1672,33 @@ void KConfigTest::testNewlines()
}
+void KConfigTest::testXdgListEntry()
+{
+ QTemporaryFile file;
+ QVERIFY(file.open());
+ QTextStream out(&file);
+ out << "[General]" << endl
+ << "Key1=" << endl // empty list
+ // emtpty entries
+ << "Key2=;" << endl
+ << "Key3=;;" << endl
+ << "Key4=;;;" << endl
+ << "Key5=\\;" << endl
+ << "Key6=1;2\\;3;;" << endl;
+ out.flush();
+ file.close();
+ KConfig anonConfig(file.fileName(), KConfig::SimpleConfig);
+ KConfigGroup grp = anonConfig.group("General");
+ QStringList invalidList; // use this as a default when an empty list is expected
+ invalidList << "Error! Default value read!";
+ QCOMPARE(grp.readXdgListEntry("Key1", invalidList), QStringList());
+ QCOMPARE(grp.readXdgListEntry("Key2", invalidList), QStringList() << QString());
+ QCOMPARE(grp.readXdgListEntry("Key3", invalidList), QStringList() << QString() << QString());
+ QCOMPARE(grp.readXdgListEntry("Key4", invalidList), QStringList()<< QString() << QString() << QString());
+ QCOMPARE(grp.readXdgListEntry("Key5", invalidList), QStringList() << ";");
+ QCOMPARE(grp.readXdgListEntry("Key6", invalidList), QStringList() << "1" << "2;3" << QString());
+}
+
#include <QThreadPool>
#include <qtconcurrentrun.h>