Changeset View
Standalone View
autotests/kconfigtest.cpp
Show First 20 Lines • Show All 1943 Lines • ▼ Show 20 Line(s) | 1911 | //delete an entry | |||
---|---|---|---|---|---|
1944 | QCOMPARE(watcherSpy[0][0].value<KConfigGroup>().name(), QStringLiteral("TopLevelGroup")); | 1944 | QCOMPARE(watcherSpy[0][0].value<KConfigGroup>().name(), QStringLiteral("TopLevelGroup")); | ||
1945 | QCOMPARE(watcherSpy[0][1].value<QByteArrayList>(), QByteArrayList({"someGlobalEntry"})); | 1945 | QCOMPARE(watcherSpy[0][1].value<QByteArrayList>(), QByteArrayList({"someGlobalEntry"})); | ||
1946 | 1946 | | |||
1947 | //watching another file should have only triggered from the kdeglobals change | 1947 | //watching another file should have only triggered from the kdeglobals change | ||
1948 | QCOMPARE(otherWatcherSpy.count(), 1); | 1948 | QCOMPARE(otherWatcherSpy.count(), 1); | ||
1949 | QCOMPARE(otherWatcherSpy[0][0].value<KConfigGroup>().name(), QStringLiteral("TopLevelGroup")); | 1949 | QCOMPARE(otherWatcherSpy[0][0].value<KConfigGroup>().name(), QStringLiteral("TopLevelGroup")); | ||
1950 | QCOMPARE(otherWatcherSpy[0][1].value<QByteArrayList>(), QByteArrayList({"someGlobalEntry"})); | 1950 | QCOMPARE(otherWatcherSpy[0][1].value<QByteArrayList>(), QByteArrayList({"someGlobalEntry"})); | ||
1951 | } | 1951 | } | ||
1952 | | ||||
1953 | void KConfigTest::testKdeglobalsVSDefault() | ||||
ervin: Seeing how this test confuses everyone (including me and I knew the problem before hand...), I… | |||||
1954 | { | ||||
1955 | KConfig glob(QStringLiteral("kdeglobals")); | ||||
1956 | KConfigGroup generalGlob(&glob, "General"); | ||||
1957 | generalGlob.writeEntry("testRestore", "global"); | ||||
1958 | QVERIFY(glob.sync()); | ||||
1959 | | ||||
1960 | KConfig local(QStringLiteral(TEST_SUBDIR "restorerc")); | ||||
1961 | KConfigGroup generalLocal(&local, "General"); | ||||
1962 | QCOMPARE(generalLocal.readEntry("testRestore", "defaultcpp"), "global"); | ||||
1963 | generalLocal.writeEntry("testRestore", "restore"); | ||||
1964 | QVERIFY(local.sync()); | ||||
1965 | QCOMPARE(generalLocal.readEntry("testRestore", "defaultcpp"), "restore"); | ||||
This would pass no matter in which file the write happened, no, due to caching? dfaure: This would pass no matter in which file the write happened, no, due to caching?
Doesn't this… | |||||
bport: yes indeed | |||||
1966 | | ||||
1967 | generalLocal.revertToDefault("testRestore"); | ||||
1968 | local.sync(); | ||||
1969 | local.reparseConfiguration(); | ||||
1970 | QCOMPARE(generalLocal.readEntry("testRestore", "defaultcpp"), "defaultcpp"); | ||||
Hmm, so this is what this is all about? This contradicts the documentation for revertToDefault().
The value in the global config file is 10, that's what this is supposed to revert to. dfaure: Hmm, so this is what this is all about?
This contradicts the documentation for revertToDefault… | |||||
This is a global local file, not system wide and so not considered as default It will be reverted to the default value specified in the file bport: This is a global local file, not system wide and so not considered as default
cf. https://lxr. | |||||
Oh I see. ~/.config/kdeglobals is still stuff that was set by the user, as opposed to system-wide settings that the user cannot modify. dfaure: Oh I see.
~/.config/kdeglobals is still stuff that was set by the user, as opposed to system… | |||||
1971 | } |
Seeing how this test confuses everyone (including me and I knew the problem before hand...), I think it'd benefit greatly from getting comments at the most important points in its execution (similarly to other tests in that file).