summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qdialog
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs/qdialog')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/CMakeLists.txt11
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp14
2 files changed, 18 insertions, 7 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/CMakeLists.txt b/tests/auto/widgets/dialogs/qdialog/CMakeLists.txt
index 61ec486cea..d69310541d 100644
--- a/tests/auto/widgets/dialogs/qdialog/CMakeLists.txt
+++ b/tests/auto/widgets/dialogs/qdialog/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
-# Generated from qdialog.pro.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qdialog Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qdialog LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qdialog
SOURCES
tst_qdialog.cpp
@@ -15,4 +19,5 @@ qt_internal_add_test(tst_qdialog
Qt::Gui
Qt::GuiPrivate
Qt::Widgets
+ Qt::WidgetsPrivate
)
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index b18a5c9d12..13f971f5f0 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -1,5 +1,5 @@
// 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 "../../../shared/highdpi.h"
@@ -22,6 +22,8 @@
#include <qpa/qplatformtheme.h>
#include <qpa/qplatformtheme_p.h>
+#include <QtWidgets/private/qapplication_p.h>
+
QT_FORWARD_DECLARE_CLASS(QDialog)
// work around function being protected
@@ -133,7 +135,7 @@ void tst_QDialog::defaultButtons()
pushThree->setAutoDefault(false);
testWidget.show();
- QApplication::setActiveWindow(&testWidget);
+ QApplicationPrivate::setActiveWindow(&testWidget);
QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
push->setDefault(true);
@@ -284,6 +286,10 @@ void tst_QDialog::showAsTool()
{
if (QStringList{"xcb", "offscreen"}.contains(QGuiApplication::platformName()))
QSKIP("activeWindow() is not respected by all Xcb window managers and the offscreen plugin");
+
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("QWindow::requestActivate() is not supported.");
+
DummyDialog testWidget;
testWidget.resize(200, 200);
testWidget.setWindowTitle(QTest::currentTestFunction());
@@ -689,7 +695,7 @@ void tst_QDialog::virtualsOnClose()
// Qt doesn't deliver events to QWidgets closed during destruction
QCOMPARE(filter.closeEventCount, 0);
// QDialog doesn't emit signals when closed by destruction
- QCOMPARE(rejectedSpy.count(), 0);
+ QCOMPARE(rejectedSpy.size(), 0);
}
}
@@ -742,7 +748,7 @@ void tst_QDialog::quitOnDone()
// also quit with a timer in case the test fails
QTimer::singleShot(1000, QApplication::instance(), &QApplication::quit);
QApplication::exec();
- QCOMPARE(quitSpy.count(), 1);
+ QCOMPARE(quitSpy.size(), 1);
}
void tst_QDialog::focusWidgetAfterOpen()