blob: a06e360e35abab467c1f5f0bb7f34f4cc29cf3a7 (
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
53
54
55
56
57
58
59
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtGui/QRasterWindow>
#include <QTest>
#include <QtGui/QPainter>
class tst_QRasterWindow : public QObject
{
Q_OBJECT
private slots:
void create();
void basic();
};
void tst_QRasterWindow::create()
{
QRasterWindow w;
w.resize(640, 480);
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
}
class PainterWindow : public QRasterWindow
{
public:
void reset() { paintCount = 0; }
void paintEvent(QPaintEvent*) override {
++paintCount;
QPainter p(this);
p.fillRect(QRect(0, 0, 100, 100), Qt::blue);
p.end();
}
int paintCount;
};
void tst_QRasterWindow::basic()
{
PainterWindow w;
w.reset();
w.resize(400, 400);
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
QVERIFY(w.paintCount >= 1);
w.reset();
w.update();
QTRY_VERIFY(w.paintCount >= 1);
}
#include <tst_qrasterwindow.moc>
QTEST_MAIN(tst_QRasterWindow)
|