summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qloggingregistry
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2018-07-23 11:49:19 +0200
committerKai Koehne <kai.koehne@qt.io>2018-07-28 14:43:40 +0000
commitbd0279c4173eb627d432d9a05411bbc725240d4e (patch)
tree4bcd3bb9f3dd1f8882fc71fd2ffa2dda3ec37891 /tests/auto/corelib/io/qloggingregistry
parent01d2f35b6988edacc741b358703d16d4cd8c199a (diff)
Logging: Accept .ini files written by QSettings
For keys, QSettings escapes all characters outside of [-a-zA-Z0-9_.] by using percent encoding, and changes '/' to '\'. That is, settings.setValue("qt.*", true) will be written to an .ini file as qt.%2A=true This means that QSettings can not be used to write general-purpose qtlogging.ini files. Fix this by applying the reverse transformation method from QSettings when reading in the .ini file. [ChangeLog][Logging] Qt will now accept qtlogging.ini files written by QSettings. Task-number: QTBUG-69548 Change-Id: I55b7a8b433291268dc6855901f72b1c04f8ee6d3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/io/qloggingregistry')
-rw-r--r--tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
index 5b61a6007d..a10e706ed7 100644
--- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
+++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
@@ -187,6 +187,13 @@ private slots:
"default=false");
QCOMPARE(parser.rules().size(), 1);
+ // QSettings escapes * to %2A when writing.
+ parser.setContent("[Rules]\n"
+ "module.%2A=false");
+ QCOMPARE(parser.rules().size(), 1);
+ QCOMPARE(parser.rules().first().category, QString("module."));
+ QCOMPARE(parser.rules().first().flags, QLoggingRule::LeftFilter);
+
parser.setContent("[OtherSection]\n"
"default=false");
QCOMPARE(parser.rules().size(), 0);