diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-01-13 17:57:59 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-01-13 18:04:11 +0100 |
commit | 1bd973e88639588de56b88835670915642481020 (patch) | |
tree | b6e3641ef2e75937ca16238010bbda3b2db4b052 /src/lib/corelib/tools/tst_tools.cpp | |
parent | 81af9acaa295a574c1cb5e6714725197dac7f530 (diff) | |
parent | fce20ac83943d94e3bd465c41b03bd1e5d0c756f (diff) |
Merge remote-tracking branch 'origin/1.1'
Change-Id: I7319a1deea008c9f4df077eaecf3147872fc4a21
Diffstat (limited to 'src/lib/corelib/tools/tst_tools.cpp')
-rw-r--r-- | src/lib/corelib/tools/tst_tools.cpp | 81 |
1 files changed, 28 insertions, 53 deletions
diff --git a/src/lib/corelib/tools/tst_tools.cpp b/src/lib/corelib/tools/tst_tools.cpp index c1af58f70..34571d7e3 100644 --- a/src/lib/corelib/tools/tst_tools.cpp +++ b/src/lib/corelib/tools/tst_tools.cpp @@ -83,67 +83,42 @@ void TestTools::fileCaseCheck() void TestTools::testProfiles() { - bool exceptionCaught; Profile parentProfile("parent", m_settings); Profile childProfile("child", m_settings); - try { - parentProfile.removeBaseProfile(); - parentProfile.remove("testKey"); - QCOMPARE(parentProfile.value("testKey", "none").toString(), QLatin1String("none")); - parentProfile.setValue("testKey", "testValue"); - QCOMPARE(parentProfile.value("testKey").toString(), QLatin1String("testValue")); + parentProfile.removeBaseProfile(); + parentProfile.remove("testKey"); + QCOMPARE(parentProfile.value("testKey", "none").toString(), QLatin1String("none")); + parentProfile.setValue("testKey", "testValue"); + QCOMPARE(parentProfile.value("testKey").toString(), QLatin1String("testValue")); - childProfile.remove("testKey"); - childProfile.removeBaseProfile(); - QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("none")); - childProfile.setBaseProfile("parent"); - QCOMPARE(childProfile.value("testKey").toString(), QLatin1String("testValue")); + childProfile.remove("testKey"); + childProfile.removeBaseProfile(); + QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("none")); + childProfile.setBaseProfile("parent"); + QCOMPARE(childProfile.value("testKey").toString(), QLatin1String("testValue")); - // Change base profile and check if the inherited value also changes. - Profile fooProfile("foo", m_settings); - fooProfile.setValue("testKey", "gnampf"); - childProfile.setBaseProfile("foo"); - QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("gnampf")); - exceptionCaught = false; - } catch (ErrorInfo &) { - exceptionCaught = true; - } - QVERIFY(!exceptionCaught); + // Change base profile and check if the inherited value also changes. + Profile fooProfile("foo", m_settings); + fooProfile.setValue("testKey", "gnampf"); + childProfile.setBaseProfile("foo"); + QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("gnampf")); - try { - childProfile.setBaseProfile("SmurfAlongWithMe"); - childProfile.value("blubb"); - exceptionCaught = false; - } catch (ErrorInfo &) { - exceptionCaught = true; - } - QVERIFY(exceptionCaught); + ErrorInfo errorInfo; + childProfile.setBaseProfile("SmurfAlongWithMe"); + childProfile.value("blubb", QString(), &errorInfo); + QVERIFY(errorInfo.hasError()); - try { - childProfile.setBaseProfile("parent"); - parentProfile.setBaseProfile("child"); - QVERIFY(!childProfile.value("blubb").isValid()); - exceptionCaught = false; - } catch (ErrorInfo &) { - exceptionCaught = true; - } - QVERIFY(exceptionCaught); + errorInfo.clear(); + childProfile.setBaseProfile("parent"); + parentProfile.setBaseProfile("child"); + QVERIFY(!childProfile.value("blubb", QString(), &errorInfo).isValid()); + QVERIFY(errorInfo.hasError()); - try { - QVERIFY(!childProfile.allKeys(Profile::KeySelectionNonRecursive).isEmpty()); - exceptionCaught = false; - } catch (ErrorInfo &) { - exceptionCaught = true; - } - QVERIFY(!exceptionCaught); + QVERIFY(!childProfile.allKeys(Profile::KeySelectionNonRecursive).isEmpty()); - try { - QVERIFY(!childProfile.allKeys(Profile::KeySelectionRecursive).isEmpty()); - exceptionCaught = false; - } catch (ErrorInfo &) { - exceptionCaught = true; - } - QVERIFY(exceptionCaught); + errorInfo.clear(); + QVERIFY(childProfile.allKeys(Profile::KeySelectionRecursive, &errorInfo).isEmpty()); + QVERIFY(errorInfo.hasError()); } void TestTools::testBuildConfigMerging() |