blob: 4d6265a9e609c7509450216cd673c01106208c3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/QtGlobal>
#include <QtCore/QScopeGuard>
#include <QtCore/QTimer>
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlEngine>
#include <QtQuick/QQuickView>
#include <QtTest/QTest>
#include <QtQuickTestUtils/private/viewtestutils_p.h>
static bool gotShaderErrorMessage = false;
QtMessageHandler oldHandler = nullptr;
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
// If QuickShapesPrivate's resource object files that contain shaders are not linked to the
// the final executable, QRhiImplementation::sanityCheckGraphicsPipeline will issue a warning
// that we intercept.
if (type == QtWarningMsg && msg == QLatin1String("Empty shader passed to graphics pipeline")) {
gotShaderErrorMessage = true;
}
if (oldHandler)
oldHandler(type, context, msg);
}
class tstImportStaticShapesPluginResources : public QObject
{
Q_OBJECT
private slots:
void cleanup();
void loadApp();
};
void tstImportStaticShapesPluginResources::cleanup()
{
if (oldHandler) {
qInstallMessageHandler(oldHandler);
oldHandler = nullptr;
}
}
void tstImportStaticShapesPluginResources::loadApp()
{
gotShaderErrorMessage = false;
oldHandler = qInstallMessageHandler(messageHandler);
QQuickView view;
QVERIFY(QQuickTest::showView(view, QUrl("qrc:///app.qml")));
QCOMPARE(gotShaderErrorMessage, false);
}
QTEST_MAIN(tstImportStaticShapesPluginResources)
#include "tst_main.moc"
|