summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp')
-rw-r--r--tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
index f397777065..f57634152a 100644
--- a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
+++ b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
@@ -1,9 +1,10 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QSplashScreen>
+#include <QTimer>
class tst_QSplashScreen : public QObject
{
@@ -11,7 +12,7 @@ class tst_QSplashScreen : public QObject
private slots:
void checkCloseTime();
- void checkScreenConstructor();
+ void checkConstructorAndShow();
};
class CloseEventSplash : public QSplashScreen
@@ -20,7 +21,7 @@ public:
CloseEventSplash(const QPixmap &pix) : QSplashScreen(pix), receivedCloseEvent(false) {}
bool receivedCloseEvent;
protected:
- void closeEvent(QCloseEvent *event)
+ void closeEvent(QCloseEvent *event) override
{
receivedCloseEvent = true;
QSplashScreen::closeEvent(event);
@@ -35,23 +36,26 @@ void tst_QSplashScreen::checkCloseTime()
QVERIFY(!splash.receivedCloseEvent);
QWidget w;
splash.show();
- QTimer::singleShot(500, &w, SLOT(show()));
+ QTimer::singleShot(10, &w, &QWidget::show);
QVERIFY(!splash.receivedCloseEvent);
splash.finish(&w);
QVERIFY(splash.receivedCloseEvent);
// We check the window handle because if this is not valid, then
// it can't have been exposed
QVERIFY(w.windowHandle());
- QVERIFY(w.windowHandle()->isExposed());
+ QVERIFY(w.windowHandle()->isVisible());
}
-void tst_QSplashScreen::checkScreenConstructor()
+void tst_QSplashScreen::checkConstructorAndShow()
{
- for (const auto screen : QGuiApplication::screens()) {
- QSplashScreen splash(screen);
+ QPixmap pix(100, 100);
+ pix.fill(Qt::red);
+ for (auto *screen : QGuiApplication::screens()) {
+ QSplashScreen splash(screen, pix);
splash.show();
QCOMPARE(splash.screen(), screen);
QVERIFY(splash.windowHandle());
+ QVERIFY(splash.windowHandle()->isVisible());
QCOMPARE(splash.windowHandle()->screen(), screen);
}
}