From 5a61d637e08647045b26a96b51a0df3c2c35a47b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 12 May 2020 13:46:06 +0200 Subject: Reduce dependencies on QtGraphicalEffects - Make QtGraphicalEffects optional in tests - Mention that QtGraphicalEffects is required for relevant examples Change-Id: I3ac7d06add931e0a10c3df7edc4e458ba5519c75 Reviewed-by: Laszlo Agocs --- .../imagine/automotive/doc/src/qtquickcontrols2-automotive.qdoc | 2 ++ .../auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp | 3 +++ tests/auto/qquickpopup/tst_qquickpopup.cpp | 3 +++ tests/auto/shared/util.cpp | 8 ++++++++ tests/auto/shared/util.h | 2 ++ 5 files changed, 18 insertions(+) diff --git a/examples/quickcontrols2/imagine/automotive/doc/src/qtquickcontrols2-automotive.qdoc b/examples/quickcontrols2/imagine/automotive/doc/src/qtquickcontrols2-automotive.qdoc index 4e3d3352..f3d0f81d 100644 --- a/examples/quickcontrols2/imagine/automotive/doc/src/qtquickcontrols2-automotive.qdoc +++ b/examples/quickcontrols2/imagine/automotive/doc/src/qtquickcontrols2-automotive.qdoc @@ -36,6 +36,8 @@ This example demonstrates how custom Imagine style assets can be used to style an automotive user interface. + \note This example requires \l {Qt Graphical Effects}. + \image qtquickcontrols2-automotive.png \include examples-run.qdocinc diff --git a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 80124230..b2c0c272 100644 --- a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp +++ b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -763,6 +763,9 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() void tst_QQuickApplicationWindow::clearFocusOnDestruction() { + if (!canImportModule("import QtGraphicalEffects 1.15; DropShadow {}")) + QSKIP("Test requires QtGraphicalEffects"); + QQmlEngine engine; QQmlComponent component(&engine); component.loadUrl(testFileUrl("clearfocusondestruction.qml")); diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp index 0ec7870b..fbe44991 100644 --- a/tests/auto/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp @@ -1266,6 +1266,9 @@ void tst_QQuickPopup::countChanged() // QTBUG-73243 void tst_QQuickPopup::toolTipCrashOnClose() { + if (!canImportModule("import QtGraphicalEffects 1.15; DropShadow {}")) + QSKIP("Test requires QtGraphicalEffects"); + QQuickApplicationHelper helper(this, "toolTipCrashOnClose.qml"); QQuickWindow *window = helper.window; diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp index 2f6b7f54..31647d69 100644 --- a/tests/auto/shared/util.cpp +++ b/tests/auto/shared/util.cpp @@ -108,6 +108,14 @@ QByteArray QQmlDataTest::msgComponentError(const QQmlComponent &c, return result.toLocal8Bit(); } +bool QQmlDataTest::canImportModule(const QString &importTestQmlSource) const +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData(importTestQmlSource.toLatin1(), QUrl()); + return !component.isError(); +} + Q_GLOBAL_STATIC(QMutex, qQmlTestMessageHandlerMutex) QQmlTestMessageHandler *QQmlTestMessageHandler::m_instance = 0; diff --git a/tests/auto/shared/util.h b/tests/auto/shared/util.h index 4295d798..50d161e0 100644 --- a/tests/auto/shared/util.h +++ b/tests/auto/shared/util.h @@ -72,6 +72,8 @@ public: static QByteArray msgComponentError(const QQmlComponent &, const QQmlEngine *engine = 0); + bool canImportModule(const QString &importTestQmlSource) const; + public slots: virtual void initTestCase(); -- cgit v1.2.3