diff options
author | Kai Uwe Broulik <kde@privat.broulik.de> | 2019-04-01 10:28:02 +0200 |
---|---|---|
committer | Kai Uwe Broulik <kde@privat.broulik.de> | 2019-04-01 10:28:02 +0200 |
commit | cad4889e490f4376849744ec6ab3c84c71807706 (patch) | |
tree | 71ef0ac3eda821e0fe24475ed99e9ccbe3d97b84 /autotests | |
parent | 998982a47cbc4ab8779c85a28052fb96195fd2a1 (diff) | |
download | kconfig-cad4889e490f4376849744ec6ab3c84c71807706.tar.gz kconfig-cad4889e490f4376849744ec6ab3c84c71807706.tar.bz2 |
Add Notify capability to revertToDefault
This enables KConfigWatcher to detect those changes, too.
Differential Revision: https://phabricator.kde.org/D20039
Diffstat (limited to 'autotests')
-rw-r--r-- | autotests/kconfigtest.cpp | 9 | ||||
-rw-r--r-- | autotests/kentrymaptest.cpp | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp index 32d3eef8..410b5b80 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp @@ -1926,6 +1926,15 @@ void KConfigTest::testNotify() QCOMPARE(watcherSpy[0][0].value<KConfigGroup>().name(), QStringLiteral("TopLevelGroup")); QCOMPARE(watcherSpy[0][1].value<QByteArrayList>(), QByteArrayList({"entryA"})); + //revert to default an entry + watcherSpy.clear(); + myConfigGroup.revertToDefault("entryA", KConfig::Persistent | KConfig::Notify); + config.sync(); + watcherSpy.wait(); + QCOMPARE(watcherSpy.count(), 1); + QCOMPARE(watcherSpy[0][0].value<KConfigGroup>().name(), QStringLiteral("TopLevelGroup")); + QCOMPARE(watcherSpy[0][1].value<QByteArrayList>(), QByteArrayList({"entryA"})); + //deleting a group, should notify that every entry in that group has changed watcherSpy.clear(); myConfigGroup.deleteGroup("aSubGroup", KConfig::Persistent | KConfig::Notify); diff --git a/autotests/kentrymaptest.cpp b/autotests/kentrymaptest.cpp index 5e39df54..090e497a 100644 --- a/autotests/kentrymaptest.cpp +++ b/autotests/kentrymaptest.cpp @@ -123,11 +123,11 @@ void KEntryMapTest::testDefault() QCOMPARE(entry1->mValue, entry2->mValue); // revert entry1 - map.revertEntry(group1, key1); + map.revertEntry(group1, key1, EntryOptions()); QCOMPARE(defaultEntry->mValue, entry1->mValue); // revert entry2, no default --> should be marked as deleted - map.revertEntry(group1, key2); + map.revertEntry(group1, key2, EntryOptions()); QCOMPARE(entry2->mValue, QByteArray()); QVERIFY(entry2->bDirty); QVERIFY(entry2->bReverted); |