mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-05 00:35:27 +08:00
qt 6.5.1 original
This commit is contained in:
15
tests/auto/gui/kernel/qrasterwindow/CMakeLists.txt
Normal file
15
tests/auto/gui/kernel/qrasterwindow/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## tst_qrasterwindow Test:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_test(tst_qrasterwindow
|
||||
SOURCES
|
||||
tst_qrasterwindow.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
)
|
59
tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
Normal file
59
tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#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)
|
Reference in New Issue
Block a user