summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2012-03-13 16:36:38 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-15 06:00:52 +0100
commit07764b9c15ff9be15730252c9f930cb0b2efe15a (patch)
treed86e63d87a63fc9ffd1c22ee955424d72264fe93 /tests/auto
parent8a79e8b645bfaa2f9ed00976466198223f6db6dd (diff)
Verify expected warnings in QSettings autotest.
Use QTest::ignoreMessage() so that the warnings don't appear in the test output and so that the test will fail if the warnings are not produced. Change-Id: I418d78819fc9dbfd7da2a8b6c0a1ebfa967347e2 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index b9ade8e7c8..d294eec248 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -880,8 +880,10 @@ void tst_QSettings::beginGroup()
QCOMPARE(settings1.value("geometry").toInt(), 777);
// endGroup() should do nothing if group() is empty
- for (int i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i) {
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endGroup: No matching beginGroup()");
settings2.endGroup();
+ }
QCOMPARE(settings2.value("geometry").toInt(), 5);
QCOMPARE(settings2.value("alpha/geometry").toInt(), 66);
QCOMPARE(settings2.value("alpha/beta/geometry").toInt(), 777);
@@ -2167,6 +2169,16 @@ void tst_QSettings::testArrays()
endArray() and vice versa. This is not documented, but this
is the behavior that we have chosen.
*/
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::setArrayIndex: Missing beginArray()");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endArray: Expected endGroup() instead");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endGroup: Expected endArray() instead");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endArray: Expected endGroup() instead");
+ QTest::ignoreMessage(QtWarningMsg, "QSettings::endGroup: No matching beginGroup()");
+
QSettings settings1(format, QSettings::UserScope, "software.org", "KillerAPP");
settings1.clear();
settings1.beginGroup("/alpha");
@@ -2217,7 +2229,6 @@ void tst_QSettings::testArrays()
QCOMPARE(settings1.group(), QString());
settings1.endGroup();
QCOMPARE(settings1.group(), QString());
-
/*
Now, let's make sure that things work well if an array
is spread across multiple files.