aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/tools/tst_tools.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-05-22 15:15:00 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-05-23 16:41:22 +0200
commit8917e0cecd80a5d673ac4a6d6586b472aa019d1b (patch)
tree62308ccda4de90a3aed9f8eb882cfa4344f4d604 /src/lib/corelib/tools/tst_tools.cpp
parent427f5e07fd05a2f4ca855054fae640646b63c800 (diff)
Do not let the autotests pollute the profiles namespace.
Introduce and use the new class TemporaryProfile whenever profiles need to be created as part of a test. Change-Id: I3d91f112342b1cb2861cbe9d2c96deac7f762cd4 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/corelib/tools/tst_tools.cpp')
-rw-r--r--src/lib/corelib/tools/tst_tools.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/corelib/tools/tst_tools.cpp b/src/lib/corelib/tools/tst_tools.cpp
index 6fe604925..e29997c82 100644
--- a/src/lib/corelib/tools/tst_tools.cpp
+++ b/src/lib/corelib/tools/tst_tools.cpp
@@ -83,8 +83,10 @@ void TestTools::fileCaseCheck()
void TestTools::testProfiles()
{
- Profile parentProfile("parent", m_settings);
- Profile childProfile("child", m_settings);
+ TemporaryProfile tpp("parent", m_settings);
+ Profile parentProfile = tpp.p;
+ TemporaryProfile tpc("child", m_settings);
+ Profile childProfile = tpc.p;
parentProfile.removeBaseProfile();
parentProfile.remove("testKey");
QCOMPARE(parentProfile.value("testKey", "none").toString(), QLatin1String("none"));
@@ -98,7 +100,8 @@ void TestTools::testProfiles()
QCOMPARE(childProfile.value("testKey").toString(), QLatin1String("testValue"));
// Change base profile and check if the inherited value also changes.
- Profile fooProfile("foo", m_settings);
+ TemporaryProfile tpf("foo", m_settings);
+ Profile fooProfile = tpf.p;
fooProfile.setValue("testKey", "gnampf");
childProfile.setBaseProfile("foo");
QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("gnampf"));
@@ -124,7 +127,8 @@ void TestTools::testProfiles()
void TestTools::testBuildConfigMerging()
{
Settings settings((QString()));
- Profile profile(QLatin1String("tst_tools_profile"), &settings); // TODO: Make sure it's removed afterwards.
+ TemporaryProfile tp(QLatin1String("tst_tools_profile"), &settings);
+ Profile profile = tp.p;
profile.setValue(QLatin1String("topLevelKey"), QLatin1String("topLevelValue"));
profile.setValue(QLatin1String("qbs.toolchain"), QLatin1String("gcc"));
profile.setValue(QLatin1String("qbs.architecture"),