summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qaddpostroutine/tst_qaddpostroutine.cpp
blob: c56eb3ff4cfc3fb0e16b7cf043a180c445402c0b (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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0


#include <QTest>
#include <QTimer>

static bool done = false;

static void cleanup()
{
     done = true;
     QEventLoop loop;
     QTimer::singleShot(100,&loop, &QEventLoop::quit);
     loop.exec();
}

struct tst_qAddPostRoutine : public QObject
{
public:
    tst_qAddPostRoutine();
    ~tst_qAddPostRoutine();
};

tst_qAddPostRoutine::tst_qAddPostRoutine()
{
    qAddPostRoutine(cleanup);
}

tst_qAddPostRoutine::~tst_qAddPostRoutine()
{
    Q_ASSERT(done);
}
int main(int argc, char *argv[])
{
    tst_qAddPostRoutine tc;
    QGuiApplication app(argc, argv);
    app.setAttribute(Qt::AA_Use96Dpi, true);
    QTEST_SET_MAIN_SOURCE_PATH
    return QTest::qExec(&tc, argc, argv);
}