summaryrefslogtreecommitdiff
path: root/tests/auto/declarativetestplugin/testhelper.h
blob: 6ec8a35f9fca6a8dcb14dead45184512d1161968 (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
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef TESTHELPER_H
#define TESTHELPER_H

#include <QObject>
#include <QSignalSpy>
#include <QQuickItem>
#include <QQuickWindow>
#include <QSysInfo>

QT_BEGIN_NAMESPACE

class TestHelper: public QObject
{
    Q_OBJECT
public:
    TestHelper(QObject *parent = nullptr):QObject(parent){}
    Q_INVOKABLE bool waitForPolished(QQuickItem *item, int timeout = 10000) const
    {
        QSignalSpy spy(item->window(), &QQuickWindow::afterAnimating);
        return spy.wait(timeout);
    }

    Q_INVOKABLE int x86Bits() const
    {
        if ( QSysInfo::currentCpuArchitecture() == "x86_64" )
            return 64;
        else
            return 32;
    }
};

QT_END_NAMESPACE

#endif // TESTHELPER_H