From bbb2c95d7ad329a05a8f74d80ac69b3ca5851db1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 2 Oct 2015 09:43:17 +0200 Subject: tst_qdesktopservices: Use regular expression to suppress error message. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error return has been observed to vary. Task-number: QTBUG-48566 Change-Id: Iecfe7819898a6a8a482c1b2251543193ecfa4841 Reviewed-by: Liang Qi Reviewed-by: Jędrzej Nowacki Reviewed-by: Oliver Wolff --- tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp index c8964eb02c..db4b15530c 100644 --- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp @@ -35,6 +35,7 @@ #include #include #include +#include class tst_qdesktopservices : public QObject { @@ -74,7 +75,9 @@ void tst_qdesktopservices::openUrl() QCOMPARE(QDesktopServices::openUrl(QUrl()), false); #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // this test is only valid on windows on other systems it might mean open a new document in the application handling .file - QTest::ignoreMessage(QtWarningMsg, "ShellExecute 'file://invalid.file' failed (error 3)."); + const QRegularExpression messagePattern("ShellExecute 'file://invalid\\.file' failed \\(error \\d+\\)\\."); + QVERIFY(messagePattern.isValid()); + QTest::ignoreMessage(QtWarningMsg, messagePattern); QCOMPARE(QDesktopServices::openUrl(QUrl("file://invalid.file")), false); #endif } -- cgit v1.2.3