blob: 32e5c984acc7e13e21982892a2cb8a962b85b0e2 (
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
|
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [2]
// src_qmltest_qquicktest.cpp
#include <QtQuickTest>
#include <QQmlEngine>
#include <QQmlContext>
#include <QGuiApplication>
class Setup : public QObject
{
Q_OBJECT
public:
Setup() {}
public slots:
void applicationAvailable()
{
// Initialization that only requires the QGuiApplication object to be available
}
void qmlEngineAvailable(QQmlEngine *engine)
{
// Initialization requiring the QQmlEngine to be constructed
engine->rootContext()->setContextProperty("myContextProperty", QVariant(true));
}
void cleanupTestCase()
{
// Implement custom resource cleanup
}
};
QUICK_TEST_MAIN_WITH_SETUP(mytest, Setup)
#include "src_qmltest_qquicktest.moc"
//! [2]
|