diff --git a/tests/auto/testlib/selftests/expected_expectfail.lightxml b/tests/auto/testlib/selftests/expected_expectfail.lightxml
index a2bf6fa5aa2..d2659fab0ca 100644
--- a/tests/auto/testlib/selftests/expected_expectfail.lightxml
+++ b/tests/auto/testlib/selftests/expected_expectfail.lightxml
@@ -9,7 +9,7 @@
-
+
@@ -21,31 +21,36 @@
-
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
diff --git a/tests/auto/testlib/selftests/expected_expectfail.txt b/tests/auto/testlib/selftests/expected_expectfail.txt
index ad1d1f29d02..4fe3b511dad 100644
--- a/tests/auto/testlib/selftests/expected_expectfail.txt
+++ b/tests/auto/testlib/selftests/expected_expectfail.txt
@@ -3,25 +3,27 @@ Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE
PASS : tst_ExpectFail::initTestCase()
QDEBUG : tst_ExpectFail::expectAndContinue() begin
XFAIL : tst_ExpectFail::expectAndContinue() This should xfail
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(65)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(66)]
QDEBUG : tst_ExpectFail::expectAndContinue() after
PASS : tst_ExpectFail::expectAndContinue()
QDEBUG : tst_ExpectFail::expectAndAbort() begin
XFAIL : tst_ExpectFail::expectAndAbort() This should xfail
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(73)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(74)]
PASS : tst_ExpectFail::expectAndAbort()
+FAIL! : tst_ExpectFail::expectTwice() Already expecting a fail
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(83)]
XFAIL : tst_ExpectFail::xfailWithQString() A string
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(82)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(93)]
XFAIL : tst_ExpectFail::xfailWithQString() Bug 5 (The message)
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(87)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(98)]
PASS : tst_ExpectFail::xfailWithQString()
XPASS : tst_ExpectFail::xpass() 'true' returned FALSE. ()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(93)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(104)]
XFAIL : tst_ExpectFail::dataDrivenTest(Abort) This test should xfail
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(126)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(137)]
XFAIL : tst_ExpectFail::dataDrivenTest(Continue) This test should xfail
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(126)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp(137)]
PASS : tst_ExpectFail::dataDrivenTest()
PASS : tst_ExpectFail::cleanupTestCase()
-Totals: 6 passed, 1 failed, 0 skipped
+Totals: 6 passed, 2 failed, 0 skipped
********* Finished testing of tst_ExpectFail *********
diff --git a/tests/auto/testlib/selftests/expected_expectfail.xml b/tests/auto/testlib/selftests/expected_expectfail.xml
index 4380e06fada..a7199282dcc 100644
--- a/tests/auto/testlib/selftests/expected_expectfail.xml
+++ b/tests/auto/testlib/selftests/expected_expectfail.xml
@@ -11,7 +11,7 @@
-
+
@@ -23,31 +23,36 @@
-
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
diff --git a/tests/auto/testlib/selftests/expected_expectfail.xunitxml b/tests/auto/testlib/selftests/expected_expectfail.xunitxml
index 6d3642a63b3..e93cb033183 100644
--- a/tests/auto/testlib/selftests/expected_expectfail.xunitxml
+++ b/tests/auto/testlib/selftests/expected_expectfail.xunitxml
@@ -1,5 +1,5 @@
-
+
@@ -14,6 +14,9 @@
+
+
+
diff --git a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
index 8f67afc5aef..73d3e0c96a2 100644
--- a/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
+++ b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp
@@ -52,6 +52,7 @@ class tst_ExpectFail: public QObject
private slots:
void expectAndContinue() const;
void expectAndAbort() const;
+ void expectTwice() const;
void xfailWithQString() const;
void xpass() const;
void dataDrivenTest_data() const;
@@ -76,6 +77,16 @@ void tst_ExpectFail::expectAndAbort() const
QVERIFY2(false, "This should not be reached");
}
+void tst_ExpectFail::expectTwice() const
+{
+ QEXPECT_FAIL("", "Calling QEXPECT_FAIL once is fine", Abort);
+ QEXPECT_FAIL("", "Calling QEXPECT_FAIL when already expecting a failure is "
+ "an error and should abort this test function", Abort);
+
+ // If we get here the test did not correctly abort on the double call to QEXPECT_FAIL.
+ QVERIFY2(false, "This should not be reached");
+}
+
void tst_ExpectFail::xfailWithQString() const
{
QEXPECT_FAIL("", QString("A string").toLatin1().constData(), Continue);