tst_qdesktopservices: Use regular expression to suppress error message.
The error return has been observed to vary. Task-number: QTBUG-48566 Change-Id: Iecfe7819898a6a8a482c1b2251543193ecfa4841 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>bb10
parent
0addf25bd7
commit
bbb2c95d7a
|
|
@ -35,6 +35,7 @@
|
|||
#include <QtTest/QtTest>
|
||||
#include <qdebug.h>
|
||||
#include <qdesktopservices.h>
|
||||
#include <qregularexpression.h>
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue