aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfigtest.cpp
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2014-06-28 00:19:31 +0200
committerDavid Faure <faure@kde.org>2014-07-01 10:26:54 +0200
commit054d849879647fd4cf90c4f622877d3a11720bb2 (patch)
tree1d416f76dab387122f5eb45ffb0aad309bdd57cc /autotests/kconfigtest.cpp
parent55c055470aa4f8e153688c7720811c6413d71346 (diff)
downloadkconfig-054d849879647fd4cf90c4f622877d3a11720bb2.tar.gz
kconfig-054d849879647fd4cf90c4f622877d3a11720bb2.tar.bz2
KSharedConfig: move mainConfig and wasTestEnabled to the thread storage.
This enables the mainConfig optimization in all threads, and ensures the user warning only happens in the main thread. The test-mode-enabled logic is only really useful in the main thread, but it's simpler to just do it in all threads. REVIEW: 118985
Diffstat (limited to 'autotests/kconfigtest.cpp')
-rw-r--r--autotests/kconfigtest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp
index b621ac55..3156aa5e 100644
--- a/autotests/kconfigtest.cpp
+++ b/autotests/kconfigtest.cpp
@@ -95,6 +95,9 @@ void KConfigTest::initTestCase()
// to make sure all files from a previous failed run are deleted
cleanupTestCase();
+ KSharedConfigPtr mainConfig = KSharedConfig::openConfig();
+ mainConfig->group("Main").writeEntry("Key", "Value");
+
KConfig sc(TEST_SUBDIR "kconfigtest");
KConfigGroup cg(&sc, "AAA");
@@ -1411,6 +1414,11 @@ void KConfigTest::testSharedConfig()
myConfigGroup = KConfigGroup(config, "Hello");
}
QCOMPARE(myConfigGroup.readEntry("stringEntry1"), QString(STRINGENTRY1));
+
+ // Get the main config
+ KSharedConfigPtr mainConfig = KSharedConfig::openConfig();
+ KConfigGroup mainGroup(mainConfig, "Main");
+ QCOMPARE(mainGroup.readEntry("Key", QString()), QString("Value"));
}
void KConfigTest::testLocaleConfig()
@@ -1676,6 +1684,8 @@ void KConfigTest::testThreads()
futures << QtConcurrent::run(this, &KConfigTest::testAddConfigSources);
futures << QtConcurrent::run(this, &KConfigTest::testSimple);
futures << QtConcurrent::run(this, &KConfigTest::testDefaults);
+ futures << QtConcurrent::run(this, &KConfigTest::testSharedConfig);
+ futures << QtConcurrent::run(this, &KConfigTest::testSharedConfig);
// QEXPECT_FAIL triggers race conditions, it should be fixed to use QThreadStorage...
//futures << QtConcurrent::run(this, &KConfigTest::testDeleteWhenLocalized);
//futures << QtConcurrent::run(this, &KConfigTest::testEntryMap);