summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/macgui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/other/macgui')
-rw-r--r--tests/auto/other/macgui/BLACKLIST3
-rw-r--r--tests/auto/other/macgui/CMakeLists.txt20
-rw-r--r--tests/auto/other/macgui/guitest.cpp30
-rw-r--r--tests/auto/other/macgui/guitest.h29
-rw-r--r--tests/auto/other/macgui/tst_macgui.cpp91
5 files changed, 42 insertions, 131 deletions
diff --git a/tests/auto/other/macgui/BLACKLIST b/tests/auto/other/macgui/BLACKLIST
index 05e529e519..a6dc56611b 100644
--- a/tests/auto/other/macgui/BLACKLIST
+++ b/tests/auto/other/macgui/BLACKLIST
@@ -1,5 +1,2 @@
-[nonModalOrder]
-osx
-
[scrollbarPainting]
macos
diff --git a/tests/auto/other/macgui/CMakeLists.txt b/tests/auto/other/macgui/CMakeLists.txt
index 348d7f1241..afa3f0b8df 100644
--- a/tests/auto/other/macgui/CMakeLists.txt
+++ b/tests/auto/other/macgui/CMakeLists.txt
@@ -1,9 +1,16 @@
-# Generated from macgui.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_macgui LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
if(NOT APPLE)
return()
endif()
-if(NOT TARGET Qt::Widgets) # special case
+if(NOT TARGET Qt::Widgets)
return()
endif()
@@ -15,18 +22,17 @@ qt_internal_add_test(tst_macgui
SOURCES
guitest.cpp guitest.h
tst_macgui.cpp
- PUBLIC_LIBRARIES
+ NO_PCH_SOURCES
+ guitest.cpp # undef QT_NO_FOREACH
+ LIBRARIES
Qt::CorePrivate
Qt::WidgetsPrivate
)
-#### Keys ignored in scope 1:.:.:macgui.pro:<TRUE>:
-# _REQUIREMENTS = "mac" "widgets"
-
## Scopes:
#####################################################################
qt_internal_extend_target(tst_macgui CONDITION MACOS
- PUBLIC_LIBRARIES
+ LIBRARIES
${FWApplicationServices}
)
diff --git a/tests/auto/other/macgui/guitest.cpp b/tests/auto/other/macgui/guitest.cpp
index 2effce7393..fbae891065 100644
--- a/tests/auto/other/macgui/guitest.cpp
+++ b/tests/auto/other/macgui/guitest.cpp
@@ -1,31 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include "guitest.h"
#include <QDebug>
diff --git a/tests/auto/other/macgui/guitest.h b/tests/auto/other/macgui/guitest.h
index 74f4292a6b..80a2103fc9 100644
--- a/tests/auto/other/macgui/guitest.h
+++ b/tests/auto/other/macgui/guitest.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef GUITEST_H
#define GUITEST_H
diff --git a/tests/auto/other/macgui/tst_macgui.cpp b/tests/auto/other/macgui/tst_macgui.cpp
index ab0114fc6c..efcecef9ad 100644
--- a/tests/auto/other/macgui/tst_macgui.cpp
+++ b/tests/auto/other/macgui/tst_macgui.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QApplication>
@@ -94,7 +69,6 @@ void tst_MacGui::scrollbarPainting()
QPixmap pixmap = grabWindowContents(&colorWidget);
- QEXPECT_FAIL("", "QTBUG-26371", Abort);
QVERIFY(isContent(pixmap.toImage(), verticalScrollbar.geometry(), GuiTester::Horizontal));
QVERIFY(isContent(pixmap.toImage(), horizontalScrollbar.geometry(), GuiTester::Vertical));
}
@@ -152,40 +126,6 @@ void tst_MacGui::splashScreenModality()
QVERIFY(!QTestEventLoop::instance().timeout());
}
-class PrimaryWindowDialog : public QDialog
-{
-Q_OBJECT
-public:
- PrimaryWindowDialog();
- QWidget *secondaryWindow;
- QWidget *frontWidget;
-public slots:
- void showSecondaryWindow();
- void test();
-};
-
-PrimaryWindowDialog::PrimaryWindowDialog() : QDialog(0)
-{
- frontWidget = 0;
- secondaryWindow = new ColorWidget(this);
- secondaryWindow->setWindowFlags(Qt::Window);
- secondaryWindow->resize(400, 400);
- secondaryWindow->move(100, 100);
- QTimer::singleShot(1000, this, SLOT(showSecondaryWindow()));
- QTimer::singleShot(2000, this, SLOT(test()));
- QTimer::singleShot(3000, this, SLOT(close()));
-}
-
-void PrimaryWindowDialog::showSecondaryWindow()
-{
- secondaryWindow->show();
-}
-
-void PrimaryWindowDialog::test()
-{
- frontWidget = QApplication::widgetAt(secondaryWindow->mapToGlobal(QPoint(100, 100)));
-}
-
/*
Test that a non-modal child window of a modal dialog is shown in front
of the dialog even if the dialog becomes modal after the child window
@@ -194,11 +134,28 @@ void PrimaryWindowDialog::test()
void tst_MacGui::nonModalOrder()
{
clearSequence();
- PrimaryWindowDialog primary;
- primary.resize(400, 400);
- primary.move(100, 100);
- primary.exec();
- QCOMPARE(primary.frontWidget, primary.secondaryWindow);
+
+ QDialog dialog;
+ dialog.resize(400, 400);
+ dialog.move(100, 100);
+
+ ColorWidget child(&dialog);
+ // The child window needs to be a dialog, as only subclasses of NSPanel
+ // are allowed to override worksWhenModal, which is needed to mark the
+ // transient child as working within the modal session of the parent.
+ child.setWindowFlags(Qt::Window | Qt::Dialog);
+ child.resize(400, 400);
+ child.move(100, 100);
+
+ QTimer::singleShot(0, [&]{
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
+ child.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&child));
+ QCOMPARE(QApplication::widgetAt(child.mapToGlobal(QPoint(100, 100))), &child);
+ dialog.close();
+ });
+
+ dialog.exec();
}
/*