blob: f9f960a1717f8ef12d9214a94ab897346575066f (
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
|
// test_ui.cpp
#include <QtQuickTest>
#include <QQmlEngine>
#include <QQmlContext>
#include "../gui/qjsonmodel.h"
#include "../lib/libgoshim.h"
class Helper : public QObject
{
Q_OBJECT
public:
explicit Helper(QObject *parent = 0);
public slots:
Q_INVOKABLE QString refreshContext();
};
Helper::Helper(QObject *parent) : QObject(parent)
{
}
Q_INVOKABLE QString Helper::refreshContext()
{
return QString(RefreshContext());
}
class Setup : public QObject
{
Q_OBJECT
public:
Setup() {}
public slots:
void qmlEngineAvailable(QQmlEngine *engine)
{
QQmlContext *ctx = engine->rootContext();
QJsonModel *model = new QJsonModel;
Helper *helper = new Helper(this);
InitializeTestBitmaskContext();
ctx->setContextProperty("jsonModel", model);
ctx->setContextProperty("helper", helper);
}
};
QUICK_TEST_MAIN_WITH_SETUP(ui, Setup)
#include "test_ui.moc"
|