blob: 9ffe3c0acaca561ef620381961ad00ba7e94b14f (
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
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtTest/qtest.h>
#include <QtTest/qsignalspy.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
#include <QtQuick/qsgrendererinterface.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
class tst_QQuickGraphicsInfo : public QQmlDataTest
{
Q_OBJECT
public:
tst_QQuickGraphicsInfo();
private slots:
void testProperties();
};
tst_QQuickGraphicsInfo::tst_QQuickGraphicsInfo()
: QQmlDataTest(QT_QMLTEST_DATADIR)
{
}
void tst_QQuickGraphicsInfo::testProperties()
{
QQuickView view;
view.setSource(testFileUrl("basic.qml"));
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
QSignalSpy spy(&view, SIGNAL(sceneGraphInitialized()));
spy.wait();
QObject* obj = view.rootObject();
QVERIFY(obj);
QSGRendererInterface *rif = view.rendererInterface();
const int expectedAPI = rif ? rif->graphicsApi() : QSGRendererInterface::Unknown;
QCOMPARE(obj->property("api").toInt(), expectedAPI);
}
QTEST_MAIN(tst_QQuickGraphicsInfo)
#include "tst_qquickgraphicsinfo.moc"
|