Reduce dependencies on QtGraphicalEffects

- Make QtGraphicalEffects optional in tests
- Mention that QtGraphicalEffects is required for relevant examples

Change-Id: I3ac7d06add931e0a10c3df7edc4e458ba5519c75
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Mitch Curtis 2020-05-12 13:46:06 +02:00
parent 5e46b5bb61
commit 5a61d637e0
5 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -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"));

View File

@ -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;

View File

@ -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;

View File

@ -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();