Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
quicktest_p.h
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
ifndef
QUICKTEST_P_H
6
#
define
QUICKTEST_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtQuickTest
/
private
/
quicktestglobal_p
.
h
>
20
#
include
<
QtQuickTest
/
quicktest
.
h
>
21
22
#
include
<
QtQml
/
qqmlpropertymap
.
h
>
23
#
include
<
QtQml
/
qqml
.
h
>
24
25
#
include
<
QtCore
/
qpointer
.
h
>
26
27
QT_BEGIN_NAMESPACE
28
29
class
Q_QMLTEST_EXPORT
QTestRootObject
:
public
QObject
30
{
31
Q_OBJECT
32
Q_PROPERTY(
bool
windowShown READ windowShown NOTIFY windowShownChanged)
33
Q_PROPERTY(
bool
hasTestCase READ hasTestCase WRITE setHasTestCase NOTIFY hasTestCaseChanged)
34
Q_PROPERTY(QObject *defined READ defined)
35
36
QML_SINGLETON
37
QML_ELEMENT
38
QML_ADDED_IN_VERSION(1, 0)
39
40
public
:
41
static
QTestRootObject *create(QQmlEngine *q, QJSEngine *)
42
{
43
QTestRootObject *result = instance();
44
QQmlEngine *engine = qmlEngine(result);
45
// You can only test on one engine at a time
46
return
(engine ==
nullptr
|| engine == q) ? result :
nullptr
;
47
}
48
49
static
QTestRootObject *instance() {
50
static
QPointer<QTestRootObject> object =
new
QTestRootObject;
51
if
(!object) {
52
// QTestRootObject was deleted when previous test ended, create a new one
53
object =
new
QTestRootObject;
54
}
55
return
object;
56
}
57
58
bool
hasQuit:1;
59
bool
hasTestCase()
const
{
return
m_hasTestCase; }
60
void
setHasTestCase(
bool
value) { m_hasTestCase = value; Q_EMIT hasTestCaseChanged(); }
61
62
bool
windowShown()
const
{
return
m_windowShown; }
63
void
setWindowShown(
bool
value) { m_windowShown = value; Q_EMIT windowShownChanged(); }
64
QQmlPropertyMap *defined()
const
{
return
m_defined; }
65
66
void
init() { setWindowShown(
false
); setHasTestCase(
false
); hasQuit =
false
; }
67
68
Q_SIGNALS:
69
void
windowShownChanged();
70
void
hasTestCaseChanged();
71
72
private
Q_SLOTS:
73
void
quit() { hasQuit =
true
; }
74
75
private
:
76
QTestRootObject(QObject *parent =
nullptr
)
77
: QObject(parent), hasQuit(
false
), m_windowShown(
false
), m_hasTestCase(
false
) {
78
m_defined = QQmlPropertyMap::create(
this
);
79
#
if
defined
(
QT_OPENGL_ES_2_ANGLE
)
80
m_defined->insert(QLatin1String(
"QT_OPENGL_ES_2_ANGLE"
), QVariant(
true
));
81
#
endif
82
}
83
84
bool
m_windowShown : 1;
85
bool
m_hasTestCase :1;
86
QQmlPropertyMap *m_defined;
87
};
88
89
bool
qWaitForSignal
(QObject *obj,
const
char
* signal,
int
timeout = 5000);
90
91
QT_END_NAMESPACE
92
93
#
endif
// QUICKTEST_P_H
QTestRootObject
Definition
quicktest_p.h:30
QuickTestResult
Definition
quicktestresult_p.h:33
SimpleReceiver
Definition
quicktest.cpp:227
TestCaseCollector
Definition
quicktest.cpp:285
TestCaseCollector::TestCaseList
QList< QString > TestCaseList
Definition
quicktest.cpp:287
TestCaseCollector::errors
QList< QQmlError > errors() const
Definition
quicktest.cpp:309
TestCaseCollector::testCases
TestCaseList testCases() const
Definition
quicktest.cpp:308
TestCaseCollector::TestCaseCollector
TestCaseCollector(const QFileInfo &fileInfo, QQmlEngine *engine)
Definition
quicktest.cpp:289
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qWaitForSignal
bool qWaitForSignal(QObject *obj, const char *signal, int timeout)
Definition
quicktest.cpp:235
stripQuotes
static QString stripQuotes(const QString &s)
Definition
quicktest.cpp:169
quick_test_main
int quick_test_main(int argc, char **argv, const char *name, const char *sourceDir)
Definition
quicktest.cpp:432
handleCompileErrors
static void handleCompileErrors(const QFileInfo &fi, const QList< QQmlError > &errors, QQmlEngine *engine, QQuickView *view=nullptr)
Definition
quicktest.cpp:177
maybeInvokeSetupMethod
void maybeInvokeSetupMethod(QObject *setupObject, const char *member, Args &&... args)
Definition
quicktest.cpp:269
quick_test_main_with_setup
int quick_test_main_with_setup(int argc, char **argv, const char *name, const char *sourceDir, QObject *setup)
Definition
quicktest.cpp:437
qtdeclarative
src
qmltest
quicktest_p.h
Generated on
for Qt by
1.18.0