summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/CMakeLists.txt4
-rw-r--r--tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp29
-rw-r--r--tests/auto/widgets/dialogs/qdialog/BLACKLIST3
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp32
-rw-r--r--tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp29
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/BLACKLIST8
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp49
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp33
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt28
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp29
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm29
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp29
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp30
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp29
-rw-r--r--tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp29
-rw-r--r--tests/auto/widgets/dialogs/qwizard/CMakeLists.txt23
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp69
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp29
-rw-r--r--tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp29
-rw-r--r--tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/CMakeLists.txt5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp34
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST8
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt44
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp147
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST10
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp102
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp37
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST5
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp70
-rw-r--r--tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp129
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp34
-rw-r--r--tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qitemview/viewstotest.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qtableview/BLACKLIST7
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp126
-rw-r--r--tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/BLACKLIST5
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp35
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp31
-rw-r--r--tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp29
-rw-r--r--tests/auto/widgets/kernel/CMakeLists.txt5
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp29
-rw-r--r--tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp29
-rw-r--r--tests/auto/widgets/kernel/qapplication/BLACKLIST1
-rw-r--r--tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp29
-rw-r--r--tests/auto/widgets/kernel/qapplication/modal/base.cpp29
-rw-r--r--tests/auto/widgets/kernel/qapplication/modal/base.h29
-rw-r--r--tests/auto/widgets/kernel/qapplication/modal/main.cpp29
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp83
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp29
-rw-r--r--tests/auto/widgets/kernel/qformlayout/BLACKLIST3
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp186
-rw-r--r--tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp31
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp29
-rw-r--r--tests/auto/widgets/kernel/qlayout/CMakeLists.txt17
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp29
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp29
-rw-r--r--tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp31
-rw-r--r--tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp29
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp29
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST26
-rw-r--r--tests/auto/widgets/kernel/qwidget/CMakeLists.txt26
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp280
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h29
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm29
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp65
-rw-r--r--tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp29
-rw-r--r--tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp29
-rw-r--r--tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp29
-rw-r--r--tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.cpp29
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp54
-rw-r--r--tests/auto/widgets/styles/CMakeLists.txt4
-rw-r--r--tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp29
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp137
-rw-r--r--tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp29
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt26
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp88
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp61
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp29
-rw-r--r--tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp29
-rw-r--r--tests/auto/widgets/widgets/CMakeLists.txt9
-rw-r--r--tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp67
-rw-r--r--tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp29
-rw-r--r--tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp29
-rw-r--r--tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp116
-rw-r--r--tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp29
-rw-r--r--tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp32
-rw-r--r--tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp29
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp94
-rw-r--r--tests/auto/widgets/widgets/qcommandlinkbutton/CMakeLists.txt1
-rw-r--r--tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp47
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp29
-rw-r--r--tests/auto/widgets/widgets/qdial/tst_qdial.cpp37
-rw-r--r--tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp29
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/BLACKLIST24
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/CMakeLists.txt1
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp611
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp29
-rw-r--r--tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp29
-rw-r--r--tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp29
-rw-r--r--tests/auto/widgets/widgets/qframe/BLACKLIST3
-rw-r--r--tests/auto/widgets/widgets/qframe/tst_qframe.cpp42
-rw-r--r--tests/auto/widgets/widgets/qgroupbox/CMakeLists.txt1
-rw-r--r--tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp50
-rw-r--r--tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp29
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp32
-rw-r--r--tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.cpp29
-rw-r--r--tests/auto/widgets/widgets/qlineedit/BLACKLIST6
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp40
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp56
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp32
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp67
-rw-r--r--tests/auto/widgets/widgets/qmenu/BLACKLIST7
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp44
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm29
-rw-r--r--tests/auto/widgets/widgets/qmenubar/BLACKLIST1
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp60
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm29
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp153
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/BLACKLIST15
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp144
-rw-r--r--tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp29
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt1
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp47
-rw-r--r--tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp29
-rw-r--r--tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp29
-rw-r--r--tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp38
-rw-r--r--tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp29
-rw-r--r--tests/auto/widgets/widgets/qslider/tst_qslider.cpp29
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp29
-rw-r--r--tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp29
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp93
-rw-r--r--tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp29
-rw-r--r--tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp29
-rw-r--r--tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp103
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp29
-rw-r--r--tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp29
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp129
-rw-r--r--tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp29
-rw-r--r--tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp29
-rw-r--r--tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp29
165 files changed, 2802 insertions, 4100 deletions
diff --git a/tests/auto/widgets/dialogs/CMakeLists.txt b/tests/auto/widgets/dialogs/CMakeLists.txt
index c21c65dbe3..fad973c55d 100644
--- a/tests/auto/widgets/dialogs/CMakeLists.txt
+++ b/tests/auto/widgets/dialogs/CMakeLists.txt
@@ -8,9 +8,9 @@ add_subdirectory(qfontdialog)
add_subdirectory(qinputdialog)
add_subdirectory(qprogressdialog)
add_subdirectory(qwizard)
-# QTBUG-87671 # special case
+add_subdirectory(qfiledialog)
+# QTBUG-101217, qmessagebox hangs on Android
if(NOT ANDROID)
- add_subdirectory(qfiledialog)
add_subdirectory(qmessagebox)
endif()
if(QT_FEATURE_private_tests)
diff --git a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
index b3aeaa81f8..7d2f59dc83 100644
--- a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
+++ b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/dialogs/qdialog/BLACKLIST b/tests/auto/widgets/dialogs/qdialog/BLACKLIST
index 02eb64cb8b..ad86386895 100644
--- a/tests/auto/widgets/dialogs/qdialog/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qdialog/BLACKLIST
@@ -2,6 +2,3 @@
macos
[showFullScreen]
macos ci
-# QTBUG-87389
-[snapToDefaultButton]
-android
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index d4fbc548bd..b18a5c9d12 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.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 WITH Qt-GPL-exception-1.0
#include "../../../shared/highdpi.h"
@@ -503,6 +478,9 @@ void tst_QDialog::snapToDefaultButton()
#else
if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("This platform does not support setting the cursor position.");
+#ifdef Q_OS_ANDROID
+ QSKIP("Android does not support cursor");
+#endif
const QRect dialogGeometry(QGuiApplication::primaryScreen()->availableGeometry().topLeft()
+ QPoint(100, 100), QSize(200, 200));
diff --git a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp
index 711bb6fe35..97dad396e5 100644
--- a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp
+++ b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QErrorMessage>
#include <QDebug>
diff --git a/tests/auto/widgets/dialogs/qfiledialog/BLACKLIST b/tests/auto/widgets/dialogs/qfiledialog/BLACKLIST
new file mode 100644
index 0000000000..38c40c6211
--- /dev/null
+++ b/tests/auto/widgets/dialogs/qfiledialog/BLACKLIST
@@ -0,0 +1,8 @@
+[filesSelectedSignal]
+android # QTBUG-101194
+[historyForward]
+android # QTBUG-101194
+[historyBack]
+android # QTBUG-101194
+[completer]
+android # QTBUG-101194
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index c05c72213a..f236779eb5 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -530,7 +505,7 @@ void tst_QFiledialog::completer()
}
// press 'keys' for the input
- for (int i = 0; i < input.count(); ++i)
+ for (int i = 0; i < input.size(); ++i)
QTest::keyPress(lineEdit, input[i].toLatin1());
QStringList expectedFiles;
@@ -1452,6 +1427,10 @@ void tst_QFiledialog::widgetlessNativeDialog()
{
if (!QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog))
QSKIP("This platform always uses widgets to realize its QFileDialog, instead of the native file dialog.");
+#ifdef Q_OS_ANDROID
+ // QTBUG-101194
+ QSKIP("Android: This keeeps the window open. Figure out why.");
+#endif
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, false);
QFileDialog fd;
fd.setWindowModality(Qt::ApplicationModal);
@@ -1568,6 +1547,10 @@ void tst_QFiledialog::rejectModalDialogs()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This freezes. Figure out why.");
+#ifdef Q_OS_ANDROID
+ // QTBUG-101194
+ QSKIP("Android: This freezes. Figure out why.");
+#endif
// QTBUG-38672 , static functions should return empty Urls
DialogRejecter dr;
@@ -1599,6 +1582,12 @@ void tst_QFiledialog::QTBUG49600_nativeIconProviderCrash()
{
if (!QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog))
QSKIP("This platform always uses widgets to realize its QFileDialog, instead of the native file dialog.");
+
+#ifdef Q_OS_ANDROID
+ // QTBUG-101194
+ QSKIP("Android: This hangs. Figure out why.");
+#endif
+
QFileDialog fd;
fd.iconProvider();
}
@@ -1630,6 +1619,10 @@ void tst_QFiledialog::focusObjectDuringDestruction()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This freezes. Figure out why.");
+#ifdef Q_OS_ANDROID
+ // QTBUG-101194
+ QSKIP("Android: This freezes. Figure out why.");
+#endif
QTRY_VERIFY(QGuiApplication::topLevelWindows().isEmpty());
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index cecf7dbdcf..6e98eb06ac 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -333,7 +308,7 @@ static bool openContextMenu(QFileDialog &fd)
MenuCloser closer(&fd);
QObject::connect(&timer, &QTimer::timeout, &closer, &MenuCloser::close);
timer.start();
- QContextMenuEvent cme(QContextMenuEvent::Mouse, QPoint(10, 10));
+ QContextMenuEvent cme(QContextMenuEvent::Mouse, QPoint(10, 10), list->viewport()->mapToGlobal(QPoint(10, 10)));
qApp->sendEvent(list->viewport(), &cme); // blocks until menu is closed again.
return true;
}
@@ -825,7 +800,7 @@ void tst_QFileDialog2::task203703_returnProperSeparator()
QVERIFY(button);
QTest::keyClick(button, Qt::Key_Return);
QString result = fd.selectedFiles().first();
- QVERIFY(result.at(result.count() - 1) != '/');
+ QVERIFY(result.at(result.size() - 1) != '/');
QVERIFY(!result.contains('\\'));
current.rmdir("aaaaaaaaaaaaaaaaaa");
}
diff --git a/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt b/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt
index 4e231cc6cc..cc19461d7a 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt
+++ b/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt
@@ -4,17 +4,6 @@
## tst_qfontdialog Test:
#####################################################################
-qt_internal_add_test(tst_qfontdialog
- SOURCES
- tst_qfontdialog.cpp
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::Widgets
- Qt::WidgetsPrivate
-)
-
# Resources:
set_source_files_properties("../../../shared/resources/test.ttf"
PROPERTIES QT_RESOURCE_ALIAS "test.ttf"
@@ -27,13 +16,18 @@ set(testfonts_resource_files
"../../../shared/resources/testfont.ttf"
)
-qt_internal_add_resource(tst_qfontdialog "testfonts"
- PREFIX
- "/"
- FILES
- ${testfonts_resource_files}
+qt_internal_add_test(tst_qfontdialog
+ SOURCES
+ tst_qfontdialog.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Widgets
+ Qt::WidgetsPrivate
+ TESTDATA ${testfonts_resource_files}
+ BUILTIN_TESTDATA
)
-
## Scopes:
#####################################################################
diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
index 4b02a36f24..828eaa7214 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm
index 00cc6a879f..f035888f6c 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm
+++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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 WITH Qt-GPL-exception-1.0
#include <AppKit/AppKit.h>
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
index db44597401..357bb4b6ad 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 1363479897..5dbb47ce59 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -1,36 +1,12 @@
-/****************************************************************************
-**
-** 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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QMessageBox>
#include <QDebug>
#include <QPair>
+#include <QSet>
#include <QList>
#include <QPointer>
#include <QTimer>
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 86963ce24a..12ab1201ee 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
index 81bd77fda6..c4a2ffa2fd 100644
--- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
+++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt b/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
index 81dc9e85b2..32fc41f5c9 100644
--- a/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
+++ b/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt
@@ -4,15 +4,6 @@
## tst_qwizard Test:
#####################################################################
-qt_internal_add_test(tst_qwizard
- SOURCES
- tst_qwizard.cpp
- tst_qwizard_2.cpp
- PUBLIC_LIBRARIES
- Qt::Gui
- Qt::Widgets
-)
-
# Resources:
set(qwizard_resource_files
"images/background.png"
@@ -21,10 +12,14 @@ set(qwizard_resource_files
"images/watermark.png"
)
-qt_internal_add_resource(tst_qwizard "qwizard"
- PREFIX
- "/"
- FILES
- ${qwizard_resource_files}
+qt_internal_add_test(tst_qwizard
+ SOURCES
+ tst_qwizard.cpp
+ tst_qwizard_2.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Widgets
+ TESTDATA ${qwizard_resource_files}
+ BUILTIN_TESTDATA
)
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 8f655490e1..2a0ba93803 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.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 WITH Qt-GPL-exception-1.0
#include <QFont>
@@ -89,6 +64,7 @@ private slots:
void sideWidget();
void objectNames_data();
void objectNames();
+ void changePages();
// task-specific tests below me:
void task177716_disableCommitButton();
@@ -2720,6 +2696,45 @@ void tst_QWizard::taskQTBUG_46894_nextButtonShortcut()
}
}
+/* setCurrentId(int) method was added in QTBUG99488 */
+void tst_QWizard::changePages()
+{
+ QWizard wizard;
+
+ QList<QWizardPage*> pages;
+ for (int i = 0; i < 4; ++i) {
+ QWizardPage *page = new QWizardPage;
+ wizard.addPage(page);
+ pages.append(page);
+ }
+
+ wizard.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&wizard));
+
+ // Verify default page
+ QCOMPARE(wizard.currentPage(), pages.at(0));
+
+ wizard.next();
+ QVERIFY(wizard.currentId() == 1);
+ wizard.back();
+ QVERIFY(wizard.currentId() == 0);
+
+ // Test illegal page
+ QTest::ignoreMessage(QtMsgType::QtWarningMsg, "QWizard::setCurrentId: No such page: 5");
+ wizard.setCurrentId(5);
+ QCOMPARE(wizard.currentId(), 0);
+
+ for (int i = 0; i < 4; ++i) {
+ wizard.setCurrentId(i);
+ QCOMPARE(wizard.currentPage(), pages.at(i));
+ }
+
+ for (int i = 3; i >= 0; --i) {
+ wizard.setCurrentId(i);
+ QCOMPARE(wizard.currentPage(), pages.at(i));
+ }
+}
+
#endif // QT_CONFIG(shortcut)
QTEST_MAIN(tst_QWizard)
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp
index 1b8ef9ad0f..042ef983c3 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.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 WITH Qt-GPL-exception-1.0
#include <QComboBox>
diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
index 3ea4a100bb..fc7205faf6 100644
--- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.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 WITH Qt-GPL-exception-1.0
#include <QtTest/QtTestWidgets>
diff --git a/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp
index 10e6ec63e6..804c3389df 100644
--- a/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp
+++ b/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/CMakeLists.txt b/tests/auto/widgets/graphicsview/CMakeLists.txt
index df3c4d4369..b480a04a8c 100644
--- a/tests/auto/widgets/graphicsview/CMakeLists.txt
+++ b/tests/auto/widgets/graphicsview/CMakeLists.txt
@@ -19,7 +19,4 @@ add_subdirectory(qgraphicspolygonitem)
add_subdirectory(qgraphicstransform)
add_subdirectory(qgraphicsproxywidget)
add_subdirectory(qgraphicswidget)
-# QTBUG-87671 # special case
-if(NOT ANDROID)
- add_subdirectory(qgraphicsview)
-endif()
+add_subdirectory(qgraphicsview)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 92cffa0226..d8fa17280a 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtWidgets/qgraphicsanchorlayout.h>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index 9e0293d875..8b4d8b0b68 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.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 WITH Qt-GPL-exception-1.0
#include <QtGui>
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index ba8a309674..10c550efc0 100644
--- a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtWidgets/qgraphicseffect.h>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index effd8a28c1..04d1d0da59 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index bc8369e284..e848fa627d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -5362,8 +5337,9 @@ void tst_QGraphicsItem::deleteItemInEventHandlers()
#ifndef QT_NO_CONTEXTMENU
if (!HarakiriItem::dead) {
- QContextMenuEvent event(QContextMenuEvent::Other,
- view.mapFromScene(item->scenePos()));
+ auto viewPos = view.mapFromScene(item->scenePos());
+ QContextMenuEvent event(QContextMenuEvent::Other, viewPos,
+ view.mapToGlobal(viewPos));
QCoreApplication::sendEvent(view.viewport(), &event);
}
#endif // QT_NO_CONTEXTMENU
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp
index 46e834afdb..5f86ee4149 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
index 167f418c3d..b5ba1d8787 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp
index 7e0a8b6033..2389d7668b 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index eef554ad87..ff625dbc00 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp
index 58c965a7d0..849ac19d25 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
index 22b81773b9..44d38f0172 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp
index 90d69ca853..5360249186 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
index afb6dd5e2d..731b3ae253 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
@@ -1,7 +1,11 @@
[scrollUpdate]
android
b2qt
-[hoverEnterLeaveEvent]
-macos ci
[windowOpacity]
macos ci
+[wheelEventPropagation]
+android
+[forwardTouchEvent]
+android
+[touchEventPropagation]
+android
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index cd4a30c9bf..43522e325a 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
index 3c870e473e..ce4d6de7cd 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
@@ -4,32 +4,10 @@
## tst_qgraphicsscene Test:
#####################################################################
-qt_internal_add_test(tst_qgraphicsscene
- LOWDPI # special case
- SOURCES
- tst_qgraphicsscene.cpp
- DEFINES
- QT_NO_CAST_TO_ASCII
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::Widgets
- Qt::WidgetsPrivate
-)
-
# Resources:
-set(images_resource_files
- "Ash_European.jpg"
-)
-qt_internal_add_resource(tst_qgraphicsscene "images"
- PREFIX
- "/"
- FILES
- ${images_resource_files}
-)
set(testdata_resource_files
+ "Ash_European.jpg"
"testData/render/all-all-45-deg-left.png"
"testData/render/all-all-45-deg-right.png"
"testData/render/all-all-scale-2x.png"
@@ -60,14 +38,22 @@ set(testdata_resource_files
"testData/render/topright-topleft-untransformed.png"
)
-qt_internal_add_resource(tst_qgraphicsscene "testdata"
- PREFIX
- "/"
- FILES
- ${testdata_resource_files}
+qt_internal_add_test(tst_qgraphicsscene
+ LOWDPI # special case
+ SOURCES
+ tst_qgraphicsscene.cpp
+ DEFINES
+ QT_NO_CAST_TO_ASCII
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Widgets
+ Qt::WidgetsPrivate
+ TESTDATA ${testdata_resource_files}
+ BUILTIN_TESTDATA
)
-
## Scopes:
#####################################################################
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index b8991b5a9a..e639da3e7c 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtWidgets/QApplication>
#include <QtWidgets/QDial>
@@ -278,6 +253,7 @@ private slots:
void focusItemChangedSignal();
void minimumRenderSize();
void focusOnTouch();
+ void clearSelection();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -294,6 +270,8 @@ private slots:
void taskQTBUG_42915_focusNextPrevChild();
void taskQTBUG_85088_previewTextfailWhenLostFocus();
+ void deleteItemsOnChange();
+
private:
QRect m_availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QSize m_testSize;
@@ -4857,6 +4835,53 @@ void tst_QGraphicsScene::focusOnTouch()
QVERIFY(rect->hasFocus());
}
+void tst_QGraphicsScene::clearSelection()
+{
+ class AlwaysSelectedItem : public QGraphicsRectItem
+ {
+ public:
+ using QGraphicsRectItem::QGraphicsRectItem;
+ protected:
+ QVariant itemChange(GraphicsItemChange change, const QVariant& value)
+ {
+ if (change == ItemSelectedChange)
+ return true;
+ return QGraphicsRectItem::itemChange(change, value);
+ }
+ };
+ QGraphicsScene scene;
+ QSignalSpy spy(&scene, &QGraphicsScene::selectionChanged);
+
+ QGraphicsRectItem *regularRect = new QGraphicsRectItem;
+ regularRect->setFlag(QGraphicsItem::ItemIsSelectable);
+ regularRect->setRect(0, 0, 50, 50);
+ regularRect->setSelected(true);
+ AlwaysSelectedItem *selectedRect = new AlwaysSelectedItem;
+ selectedRect->setFlag(QGraphicsItem::ItemIsSelectable);
+ selectedRect->setRect(50, 50, 50, 50);
+ selectedRect->setSelected(true);
+ scene.addItem(regularRect);
+ scene.addItem(selectedRect);
+
+ QCOMPARE(spy.count(), 2);
+
+ QCOMPARE(scene.selectedItems().count(), 2);
+ scene.clearSelection();
+ QVERIFY(!regularRect->isSelected());
+ QVERIFY(selectedRect->isSelected());
+ QCOMPARE(scene.selectedItems().count(), 1);
+ QCOMPARE(spy.count(), 3);
+
+ delete regularRect;
+ QCOMPARE(spy.count(), 3);
+
+ scene.clearSelection();
+ QCOMPARE(spy.count(), 3);
+
+ delete selectedRect;
+ QCOMPARE(spy.count(), 4);
+}
+
void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache()
{
QGraphicsScene scene;
@@ -4960,6 +4985,7 @@ void tst_QGraphicsScene::taskQTBUG_85088_previewTextfailWhenLostFocus()
// focusItem will lose focus
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPointF(0, 0),
+ view.viewport()->mapToGlobal(QPointF()),
Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
QApplication::sendEvent(view.viewport(), &pressEvent);
@@ -4969,5 +4995,72 @@ void tst_QGraphicsScene::taskQTBUG_85088_previewTextfailWhenLostFocus()
QCOMPARE(simpleTextItem->toPlainText(), str + str);
}
+void tst_QGraphicsScene::deleteItemsOnChange()
+{
+ QGraphicsScene scene;
+
+ class SelectionItem : public QGraphicsRectItem {
+ public:
+ QRectF boundingRect() const override { return QRectF(); }
+ };
+
+ class ChangeItem : public QGraphicsItem
+ {
+ public:
+ ChangeItem()
+ {
+ setFlag(QGraphicsItem::ItemIsSelectable, true);
+ setFlag(QGraphicsItem::ItemIsMovable, true);
+ }
+ QRectF boundingRect() const override
+ {
+ return QRectF(0,0,100,100);
+ }
+
+ protected:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
+ {
+ painter->fillRect(boundingRect().toRect(), isSelected() ? Qt::yellow : Qt::cyan);
+ }
+
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
+ {
+ if (change != QGraphicsItem::ItemSelectedHasChanged)
+ return QGraphicsItem::itemChange(change, value);
+ if (value.toBool()) {
+ selectionRect = new SelectionItem;
+ scene()->addItem(selectionRect);
+ } else {
+ // this recreates the selectedItems QSet inside of QGraphicsScene,
+ // invalidating iterators. See QTBUG-101651.
+ scene()->selectedItems();
+ delete selectionRect;
+ selectionRect = nullptr;
+ }
+ return QGraphicsItem::itemChange(change, value);
+ }
+ private:
+ SelectionItem *selectionRect = nullptr;
+ };
+
+ ChangeItem item1;
+ item1.setPos(0, 0);
+ ChangeItem item2;
+ item1.setPos(50, 50);
+
+ scene.addItem(&item1);
+ scene.addItem(&item2);
+
+ QGraphicsView view;
+ view.setScene(&scene);
+ view.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ // this should not crash - see QTBUG-101651
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, QPoint(120, 120));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, QPoint(25, 25));
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
index 9645b9a7fb..4cad9906bb 100644
--- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp
index 5d5323a3a2..114444ebb9 100644
--- a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
index fe3d929e9e..a18b54ff89 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
@@ -1,7 +1,3 @@
-[task255529_transformationAnchorMouseAndViewportMargins]
-opensuse-leap
-[cursor]
-opensuse-leap
[cursor2]
ubuntu-16.04
[sendEvent]
@@ -45,3 +41,9 @@ android
android
[update_ancestorClipsChildrenToShape2]
android
+[QTBUG_70255_scrollTo]
+android # QTBUG-87397
+[embeddedViewsWithFocus]
+android # QTBUG-87397
+[viewportUpdateMode2]
+android # QTBUG-87397
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 8e44912d37..849e290351 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -743,8 +718,9 @@ void tst_QGraphicsView::dragMode_scrollHand()
int verticalScrollBarValue = view.verticalScrollBar()->value();
{
// Press
- QMouseEvent event(QEvent::MouseButtonPress,
- view.viewport()->rect().center(),
+ auto pos = view.viewport()->rect().center();
+ QMouseEvent event(QEvent::MouseButtonPress, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -760,8 +736,9 @@ void tst_QGraphicsView::dragMode_scrollHand()
#endif
{
// Move
- QMouseEvent event(QEvent::MouseMove,
- view.viewport()->rect().center() + QPoint(10, 0),
+ auto pos = view.viewport()->rect().center() + QPoint(10, 0);
+ QMouseEvent event(QEvent::MouseMove, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -772,8 +749,9 @@ void tst_QGraphicsView::dragMode_scrollHand()
QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue);
{
// Move
- QMouseEvent event(QEvent::MouseMove,
- view.viewport()->rect().center() + QPoint(10, 10),
+ auto pos = view.viewport()->rect().center() + QPoint(10, 10);
+ QMouseEvent event(QEvent::MouseMove, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -786,8 +764,9 @@ void tst_QGraphicsView::dragMode_scrollHand()
{
// Release
- QMouseEvent event(QEvent::MouseButtonRelease,
- view.viewport()->rect().center() + QPoint(10, 10),
+ auto pos = view.viewport()->rect().center() + QPoint(10, 10);
+ QMouseEvent event(QEvent::MouseButtonRelease, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -808,15 +787,17 @@ void tst_QGraphicsView::dragMode_scrollHand()
// Check that a click will still unselect the item.
{
// Press
- QMouseEvent event(QEvent::MouseButtonPress,
- view.viewport()->rect().center() + QPoint(10, 10),
+ auto pos = view.viewport()->rect().center() + QPoint(10, 10);
+ QMouseEvent event(QEvent::MouseButtonPress, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
QApplication::sendEvent(view.viewport(), &event);
}
{
// Release
- QMouseEvent event(QEvent::MouseButtonRelease,
- view.viewport()->rect().center() + QPoint(10, 10),
+ auto pos = view.viewport()->rect().center() + QPoint(10, 10);
+ QMouseEvent event(QEvent::MouseButtonRelease, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
QApplication::sendEvent(view.viewport(), &event);
}
@@ -865,8 +846,9 @@ void tst_QGraphicsView::dragMode_rubberBand()
int verticalScrollBarValue = view.verticalScrollBar()->value();
{
// Press
- QMouseEvent event(QEvent::MouseButtonPress,
- view.viewport()->rect().center(),
+ auto pos = view.viewport()->rect().center();
+ QMouseEvent event(QEvent::MouseButtonPress, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -880,8 +862,9 @@ void tst_QGraphicsView::dragMode_rubberBand()
{
// Move
- QMouseEvent event(QEvent::MouseMove,
- view.viewport()->rect().center() + QPoint(100, 0),
+ auto pos = view.viewport()->rect().center() + QPoint(100, 0);
+ QMouseEvent event(QEvent::MouseMove, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -895,8 +878,9 @@ void tst_QGraphicsView::dragMode_rubberBand()
{
// Move
- QMouseEvent event(QEvent::MouseMove,
- view.viewport()->rect().center() + QPoint(100, 100),
+ auto pos = view.viewport()->rect().center() + QPoint(100, 100);
+ QMouseEvent event(QEvent::MouseMove, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -907,8 +891,9 @@ void tst_QGraphicsView::dragMode_rubberBand()
{
// Release
- QMouseEvent event(QEvent::MouseButtonRelease,
- view.viewport()->rect().center() + QPoint(100, 100),
+ auto pos = view.viewport()->rect().center() + QPoint(100, 100);
+ QMouseEvent event(QEvent::MouseButtonRelease, pos,
+ view.viewport()->mapToGlobal(pos),
Qt::LeftButton, Qt::LeftButton, {});
event.setAccepted(true);
QApplication::sendEvent(view.viewport(), &event);
@@ -3295,7 +3280,8 @@ void tst_QGraphicsView::task186827_deleteReplayedItem()
QCOMPARE(view.mouseMoves, 0);
{
- QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, {}, {});
+ auto pos = view.mapFromScene(25, 25);
+ QMouseEvent event(QEvent::MouseMove, pos, view.viewport()->mapToGlobal(pos), Qt::NoButton, {}, {});
QApplication::sendEvent(view.viewport(), &event);
}
QCOMPARE(view.mouseMoves, 1);
@@ -3303,7 +3289,8 @@ void tst_QGraphicsView::task186827_deleteReplayedItem()
QTRY_COMPARE(view.mouseMoves, 1);
QTest::qWait(25);
{
- QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, {}, {});
+ auto pos = view.mapFromScene(25, 25);
+ QMouseEvent event(QEvent::MouseMove, pos, view.viewport()->mapToGlobal(pos), Qt::NoButton, {}, {});
QApplication::sendEvent(view.viewport(), &event);
}
QCOMPARE(view.mouseMoves, 2);
@@ -3349,8 +3336,10 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
// Enable and do a drag
{
view.setDragMode(QGraphicsView::ScrollHandDrag);
- QMouseEvent press(QEvent::MouseButtonPress, origPos, Qt::LeftButton, {}, {});
- QMouseEvent move(QEvent::MouseMove, step1Pos, Qt::LeftButton, {}, {});
+ QMouseEvent press(QEvent::MouseButtonPress, origPos,
+ view.viewport()->mapToGlobal(origPos), Qt::LeftButton, {}, {});
+ QMouseEvent move(QEvent::MouseMove, step1Pos,
+ view.viewport()->mapToGlobal(step1Pos), Qt::LeftButton, {}, {});
QApplication::sendEvent(view.viewport(), &press);
QApplication::sendEvent(view.viewport(), &move);
}
@@ -3358,7 +3347,8 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
// unset drag and release mouse, inverse order
{
view.setDragMode(QGraphicsView::NoDrag);
- QMouseEvent release(QEvent::MouseButtonRelease, step1Pos, Qt::LeftButton, {}, {});
+ QMouseEvent release(QEvent::MouseButtonRelease, step1Pos,
+ view.viewport()->mapToGlobal(step1Pos), Qt::LeftButton, {}, {});
QApplication::sendEvent(view.viewport(), &release);
}
@@ -3367,7 +3357,8 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
// reset drag, and move mouse without holding button down.
{
view.setDragMode(QGraphicsView::ScrollHandDrag);
- QMouseEvent move(QEvent::MouseMove, step2Pos, Qt::LeftButton, {}, {});
+ QMouseEvent move(QEvent::MouseMove, step2Pos,
+ view.viewport()->mapToGlobal(step2Pos), Qt::LeftButton, {}, {});
QApplication::sendEvent(view.viewport(), &move);
}
@@ -3871,8 +3862,9 @@ void tst_QGraphicsView::mouseTracking2()
EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove);
QCOMPARE(spy.count(), 0);
- QMouseEvent event(QEvent::MouseMove,view.viewport()->rect().center(), Qt::NoButton,
- Qt::MouseButtons(Qt::NoButton), {});
+ auto pos = view.viewport()->rect().center();
+ QMouseEvent event(QEvent::MouseMove, pos, view.viewport()->mapToGlobal(pos),
+ Qt::NoButton, Qt::MouseButtons(Qt::NoButton), {});
QApplication::sendEvent(view.viewport(), &event);
QCOMPARE(spy.count(), 1);
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
index 42e9e6e2a3..9fd35b325b 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.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 WITH Qt-GPL-exception-1.0
#ifndef TST_QGRAPHICSVIEW_H
#define TST_QGRAPHICSVIEW_H
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp
index 72b5acc654..9e9a4093ba 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtCore/QSize>
#include <QtCore/QRectF>
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
index c49c0ea089..65a6f5b8b9 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
@@ -2,8 +2,10 @@
macos ci
android
b2qt
+# QTBUG-100930
[updateFocusChainWhenChildDie]
b2qt
+qnx
[initialShow]
macos ci
opensuse-leap
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 45aa0f567b..9553b939e2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -2962,11 +2937,9 @@ void tst_QGraphicsWidget::respectHFW()
view->grabMouse();
// move both mouse cursor and set correct event in order to emulate resize
QTest::mouseMove(view->viewport(), view->mapFromScene(60, 30), 200);
- QMouseEvent e = QMouseEvent(QEvent::MouseMove,
- view->mapFromScene(60, 20),
- Qt::NoButton,
- Qt::LeftButton,
- Qt::NoModifier);
+ auto pos = view->mapFromScene(60, 20);
+ QMouseEvent e(QEvent::MouseMove, pos, view->mapToGlobal(pos),
+ Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(view->viewport(), &e);
view->releaseMouse();
}
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST b/tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST
index 249c91c3c4..e69de29bb2 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST
+++ b/tests/auto/widgets/itemviews/qabstractitemview/BLACKLIST
@@ -1,5 +0,0 @@
-[task200665_itemEntered]
-macos # Can't move cursor (QTBUG-76312)
-# QTBUG-87400
-[task200665_itemEntered]
-android
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 5c52439859..6a99772c53 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.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 WITH Qt-GPL-exception-1.0
#include <private/qguiapplication_p.h>
@@ -730,8 +705,8 @@ void tst_QAbstractItemView::persistentEditorFocus()
const QPoint p(5, 5);
for (QSpinBox *sb : list) {
QTRY_VERIFY(sb->isVisible());
- QMouseEvent mouseEvent(QEvent::MouseButtonPress, p, Qt::LeftButton,
- Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent mouseEvent(QEvent::MouseButtonPress, p, sb->mapToGlobal(p),
+ Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QCoreApplication::sendEvent(sb, &mouseEvent);
if (!QApplication::focusWidget())
QSKIP("Some window managers don't handle focus that well");
@@ -1358,7 +1333,13 @@ void tst_QAbstractItemView::task200665_itemEntered()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
-
+ {
+ // skip if we can't move mouse
+ const QPoint cursorPos = QCursor::pos() + QPoint(10, 10);
+ QCursor::setPos(cursorPos);
+ if (!QTest::qWaitFor([cursorPos] { return QCursor::pos() == cursorPos; }, 500))
+ QSKIP("Can't move mouse");
+ }
//we test that view will emit entered
//when the scrollbar move but not the mouse itself
QStandardItemModel model(1000, 1);
@@ -1480,7 +1461,8 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection()
// The mouse move event has to be created manually because the QTest framework does not
// contain a function for mouse moves with buttons pressed
QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, pressPos);
- QMouseEvent moveEvent(QEvent::MouseMove, releasePos, Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent moveEvent(QEvent::MouseMove, releasePos, view.viewport()->mapToGlobal(releasePos),
+ Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
bool moveEventReceived = qApp->notify(view.viewport(), &moveEvent);
QVERIFY(moveEventReceived);
QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, releasePos);
@@ -1503,7 +1485,8 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection()
// Repeat the same steps as above, but with a Shift-Arrow selection
QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, pressPos);
- QMouseEvent moveEvent2(QEvent::MouseMove, releasePos, Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent moveEvent2(QEvent::MouseMove, releasePos, view.viewport()->mapToGlobal(releasePos),
+ Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
moveEventReceived = qApp->notify(view.viewport(), &moveEvent2);
QVERIFY(moveEventReceived);
QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, releasePos);
@@ -1553,7 +1536,8 @@ void tst_QAbstractItemView::ctrlRubberbandSelection()
QPoint pressPos = view.visualRect(index1).topLeft() - QPoint(1, 1);
QPoint releasePos = view.visualRect(index2).bottomRight() + QPoint(1, 1);
QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::ControlModifier, pressPos);
- QMouseEvent moveEvent(QEvent::MouseMove, releasePos, Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
+ QMouseEvent moveEvent(QEvent::MouseMove, releasePos, view.viewport()->mapToGlobal(releasePos),
+ Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
bool moveEventReceived = qApp->notify(view.viewport(), &moveEvent);
QVERIFY(moveEventReceived);
QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::ControlModifier, releasePos);
@@ -2658,8 +2642,8 @@ void tst_QAbstractItemView::dragSelectAfterNewPress()
const QPoint releasePos = view.visualRect(index5).center();
// The mouse move event has to be created manually because the QTest framework does not
// contain a function for mouse moves with buttons pressed
- QMouseEvent moveEvent2(QEvent::MouseMove, releasePos, Qt::NoButton, Qt::LeftButton,
- Qt::ShiftModifier);
+ QMouseEvent moveEvent2(QEvent::MouseMove, releasePos, view.viewport()->mapToGlobal(releasePos),
+ Qt::NoButton, Qt::LeftButton, Qt::ShiftModifier);
const bool moveEventReceived = qApp->notify(view.viewport(), &moveEvent2);
QVERIFY(moveEventReceived);
QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, releasePos);
@@ -2755,7 +2739,7 @@ void tst_QAbstractItemView::dragWithSecondClick()
const QPoint dragTo = view->visualRect(index1).center()
+ QPoint(2 * QApplication::startDragDistance(),
2 * QApplication::startDragDistance());
- QMouseEvent mouseMoveEvent(QEvent::MouseMove, dragTo,
+ QMouseEvent mouseMoveEvent(QEvent::MouseMove, dragTo, view->viewport()->mapToGlobal(dragTo),
Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
QVERIFY(QApplication::sendEvent(view->viewport(), &mouseMoveEvent));
// twice since the view will first enter dragging state, then start the drag
@@ -2880,9 +2864,17 @@ void tst_QAbstractItemView::mouseSelection_data()
QTest::addRow("Single:Shift+Click") << QAbstractItemView::SingleSelection << false
<< QList{SelectionEvent{SelectionEvent::Click, Qt::ShiftModifier, 2}}
<< QList{2};
+ QTest::addRow("Single:Press;Ctrl+Press") << QAbstractItemView::SingleSelection << false
+ << QList{SelectionEvent{SelectionEvent::Press, 3},
+ SelectionEvent{SelectionEvent::Press, Qt::ControlModifier, 3}}
+ << QList{3};
QTest::addRow("Single:Ctrl+Click") << QAbstractItemView::SingleSelection << false
<< QList{SelectionEvent{SelectionEvent::Click, Qt::ControlModifier, 3}}
<< QList{3};
+ QTest::addRow("Single:Click;Ctrl+Click") << QAbstractItemView::SingleSelection << false
+ << QList{SelectionEvent{SelectionEvent::Click, 3},
+ SelectionEvent{SelectionEvent::Click, Qt::ControlModifier, 3}}
+ << QList<int>{};
// multi selection mode - selection toggles on press, selection can be drag-extended
// modifiers ignored
@@ -3066,7 +3058,8 @@ void tst_QAbstractItemView::mouseSelection()
break;
case SelectionEvent::Move: {
QMouseEvent mouseMoveEvent(QEvent::MouseMove, targetPoint,
- Qt::NoButton, buttonDown, event.keyboardModifiers);
+ view->viewport()->mapToGlobal(targetPoint),
+ Qt::NoButton, buttonDown, event.keyboardModifiers);
QApplication::sendEvent(view->viewport(), &mouseMoveEvent);
}
break;
@@ -3315,7 +3308,8 @@ void tst_QAbstractItemView::selectionAutoScrolling()
}
QTest::mousePress(listview.viewport(), Qt::LeftButton, Qt::NoModifier, pressPoint);
- QMouseEvent mmEvent(QEvent::MouseMove, dragPoint, Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent mmEvent(QEvent::MouseMove, dragPoint, listview.viewport()->mapToGlobal(dragPoint),
+ Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(listview.viewport(), &mmEvent); // QTest::mouseMove is useless
// check that we scrolled to the end
diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
index 6dd39d5d2a..9c37e0af6d 100644
--- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.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 WITH Qt-GPL-exception-1.0
#include <QColumnView>
#include <QScrollBar>
diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
index 856672b957..41db835f0f 100644
--- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp
+++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.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 WITH Qt-GPL-exception-1.0
#include <QComboBox>
#include <QDataWidgetMapper>
diff --git a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp
index 39f6946b1d..6b1decf7fd 100644
--- a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp
+++ b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.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 WITH Qt-GPL-exception-1.0
#include <QFileIconProvider>
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 8856a8ef6a..93f991b0fe 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2012 Thorbjørn Lund Martsum - tmartsum[at]gmail.com
-** 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.
+// Copyright (C) 2012 Thorbjørn Lund Martsum - tmartsum[at]gmail.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QHeaderView>
#include <QProxyStyle>
@@ -171,7 +146,7 @@ private slots:
void moveSectionAndReset();
void moveSectionAndRemove();
void saveRestore();
- void restoreQt4State();
+ void QTBUG99487_saveRestoreQt5Compat();
void restoreToMoreColumns();
void restoreToMoreColumnsNoMovedColumns();
void restoreBeforeSetModel();
@@ -250,6 +225,7 @@ private slots:
void testResetCachedSizeHint();
void statusTips();
void testRemovingColumnsViaLayoutChanged();
+ void testModelMovingColumns();
protected:
void setupTestData(bool use_reset_model = false);
@@ -351,6 +327,12 @@ public:
endRemoveColumns();
}
+ void moveColumn(int from, int to)
+ {
+ beginMoveColumns(QModelIndex(), from, from, QModelIndex(), to);
+ endMoveColumns();
+ }
+
void cleanup()
{
emit layoutAboutToBeChanged();
@@ -1511,11 +1493,11 @@ void tst_QHeaderView::testEvent()
void protected_QHeaderView::testEvent()
{
// No crashy please
- QHoverEvent enterEvent(QEvent::HoverEnter, QPoint(), QPoint());
+ QHoverEvent enterEvent(QEvent::HoverEnter, QPoint(), QPoint(), QPoint());
event(&enterEvent);
- QHoverEvent eventLeave(QEvent::HoverLeave, QPoint(), QPoint());
+ QHoverEvent eventLeave(QEvent::HoverLeave, QPoint(), QPoint(), QPoint());
event(&eventLeave);
- QHoverEvent eventMove(QEvent::HoverMove, QPoint(), QPoint());
+ QHoverEvent eventMove(QEvent::HoverMove, QPoint(), QPoint(), QPoint());
event(&eventMove);
}
@@ -1735,16 +1717,24 @@ static QByteArray savedState()
return h1.saveState();
}
-void tst_QHeaderView::saveRestore()
+// As generated by savedState()
+static const QByteArray qt5SavedSate = QByteArrayLiteral("\x00\x00\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x02\x01\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x04\b\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00""d\x00\x00\x00\xD2\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00""d\x00\x00\x00\x00\x00\x00\x00\x84\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00""d\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00""d\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03\xE8\x00\x00\x00\x00\x00\x00\x00\x00\x00");
+
+enum class SaveRestoreOption
+{
+ CheckGeneratedState,
+ DoNotCheckGeneratedState,
+};
+
+static void saveRestoreImpl(const QByteArray &state, SaveRestoreOption option)
{
QStandardItemModel m(4, 4);
- const QByteArray s1 = savedState();
QHeaderView h2(Qt::Vertical);
QSignalSpy spy(&h2, &QHeaderView::sortIndicatorChanged);
h2.setModel(&m);
- QVERIFY(h2.restoreState(s1));
+ QVERIFY(h2.restoreState(state));
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toInt(), 2);
@@ -1759,50 +1749,28 @@ void tst_QHeaderView::saveRestore()
QVERIFY(h2.isSectionHidden(3));
QCOMPARE(h2.hiddenSectionCount(), 1);
- QByteArray s2 = h2.saveState();
- QCOMPARE(s1, s2);
+ switch (option) {
+ case SaveRestoreOption::CheckGeneratedState:
+ {
+ QByteArray s2 = h2.saveState();
+ QCOMPARE(state, s2);
+ break;
+ }
+ case SaveRestoreOption::DoNotCheckGeneratedState:
+ break;
+ };
QVERIFY(!h2.restoreState(QByteArrayLiteral("Garbage")));
}
-void tst_QHeaderView::restoreQt4State()
+void tst_QHeaderView::saveRestore()
+{
+ saveRestoreImpl(savedState(), SaveRestoreOption::CheckGeneratedState);
+}
+
+void tst_QHeaderView::QTBUG99487_saveRestoreQt5Compat()
{
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- // QTBUG-40462
- // Setting from Qt4, where information about multiple sections were grouped together in one
- // sectionItem object
- QStandardItemModel m(4, 10);
- QHeaderView h2(Qt::Vertical);
- QByteArray settings_qt4 =
- QByteArray::fromHex("000000ff00000000000000010000000100000000010000000000000000000000000000"
- "0000000003e80000000a0101000100000000000000000000000064ffffffff00000081"
- "0000000000000001000003e80000000a00000000");
- QVERIFY(h2.restoreState(settings_qt4));
- int sectionItemsLengthTotal = 0;
- for (int i = 0; i < h2.count(); ++i)
- sectionItemsLengthTotal += h2.sectionSize(i);
- QCOMPARE(sectionItemsLengthTotal, h2.length());
-
- // Buggy setting where sum(sectionItems) != length. Check false is returned and this corrupted
- // state isn't restored
- QByteArray settings_buggy_length =
- QByteArray::fromHex("000000ff000000000000000100000000000000050100000000000000000000000a4000"
- "000000010000000600000258000000fb0000000a010100010000000000000000000000"
- "0064ffffffff00000081000000000000000a000000d30000000100000000000000c800"
- "000001000000000000008000000001000000000000005c00000001000000000000003c"
- "0000000100000000000002580000000100000000000000000000000100000000000002"
- "580000000100000000000002580000000100000000000003c000000001000000000000"
- "03e8");
- int old_length = h2.length();
- QByteArray old_state = h2.saveState();
- // Check setting is correctly recognized as corrupted
- QVERIFY(!h2.restoreState(settings_buggy_length));
- // Check nothing has been actually restored
- QCOMPARE(h2.length(), old_length);
- QCOMPARE(h2.saveState(), old_state);
-#else
- QSKIP("Qt4 compatibility no longer needed in Qt6");
-#endif
+ saveRestoreImpl(qt5SavedSate, SaveRestoreOption::DoNotCheckGeneratedState);
}
void tst_QHeaderView::restoreToMoreColumns()
@@ -3676,5 +3644,18 @@ void tst_QHeaderView::testRemovingColumnsViaLayoutChanged()
// The main point of this test is that the section-size restoring code didn't go out of bounds.
}
+void tst_QHeaderView::testModelMovingColumns()
+{
+ QtTestModel model(10, 10);
+ QHeaderView hv(Qt::Horizontal);
+ hv.setModel(&model);
+ hv.resizeSections(QHeaderView::ResizeToContents);
+ hv.show();
+
+ QPersistentModelIndex index3 = model.index(0, 3);
+ model.moveColumn(3, 1);
+ QCOMPARE(index3.column(), 1);
+}
+
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index ad133b0422..68a7268473 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.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 WITH Qt-GPL-exception-1.0
#include "../../../shared/highdpi.h"
@@ -357,9 +332,8 @@ void tst_QItemDelegate::editorKeyPress()
QTest::keyClicks(editor, expected);
QTest::keyClick(editor, Qt::Key_Enter);
- QApplication::processEvents();
- QCOMPARE(index.data().toString(), expected);
+ QTRY_COMPARE(index.data().toString(), expected);
}
void tst_QItemDelegate::doubleEditorNegativeInput()
@@ -1245,7 +1219,7 @@ void tst_QItemDelegate::editorEvent()
QPoint pos = inCheck ? qApp->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0) : QPoint(200,200);
QEvent *event = new QMouseEvent((QEvent::Type)type,
- pos,
+ pos, pos,
(Qt::MouseButton)button,
(Qt::MouseButton)button,
Qt::NoModifier);
diff --git a/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp b/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp
index 6f176c4ba5..b11c64df6e 100644
--- a/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp
+++ b/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.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 WITH Qt-GPL-exception-1.0
#include <QDoubleSpinBox>
diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
index 244998eb1c..1b60328691 100644
--- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
+++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.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 WITH Qt-GPL-exception-1.0
#include <QRandomGenerator>
#include <QStack>
diff --git a/tests/auto/widgets/itemviews/qitemview/viewstotest.cpp b/tests/auto/widgets/itemviews/qitemview/viewstotest.cpp
index 19f0b80cc6..1a7e037248 100644
--- a/tests/auto/widgets/itemviews/qitemview/viewstotest.cpp
+++ b/tests/auto/widgets/itemviews/qitemview/viewstotest.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 WITH Qt-GPL-exception-1.0
#include <QHeaderView>
#include <QListView>
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 5ffcb5f80f..c2410d684a 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QListWidget>
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index b121766265..3fe14c682c 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.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 WITH Qt-GPL-exception-1.0
#include <QCompleter>
#include <QHBoxLayout>
diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
index c8fc59bc46..ff870915be 100644
--- a/tests/auto/widgets/itemviews/qtableview/BLACKLIST
+++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
@@ -3,10 +3,3 @@ osx
[mouseWheel:scroll down per pixel]
macos
-# QTBUG-87407
-[rowViewportPosition]
-android
-[columnViewportPosition]
-android
-[task191545_dragSelectRows]
-android
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 6ed3b4ecdd..edd5453259 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.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 WITH Qt-GPL-exception-1.0
#include <QIdentityProxyModel>
#include <QLabel>
@@ -2274,46 +2249,46 @@ void tst_QTableView::rowViewportPosition_data()
QTest::addColumn<int>("rowViewportPosition");
QTest::newRow("row 0, scroll per item 0")
- << 10 << 40 << 0 << QAbstractItemView::ScrollPerItem << 0 << 0;
+ << 100 << 40 << 0 << QAbstractItemView::ScrollPerItem << 0 << 0;
QTest::newRow("row 1, scroll per item, 0")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerItem << 0 << 1 * 40;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerItem << 0 << 1 * 40;
QTest::newRow("row 1, scroll per item, 1")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerItem << 1 << 0;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerItem << 1 << 0;
QTest::newRow("row 5, scroll per item, 0")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerItem << 0 << 5 * 40;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerItem << 0 << 5 * 40;
QTest::newRow("row 5, scroll per item, 5")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerItem << 5 << 0;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerItem << 5 << 0;
QTest::newRow("row 9, scroll per item, 0")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerItem << 0 << 9 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerItem << 0 << 9 * 40;
QTest::newRow("row 9, scroll per item, 5")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerItem << 5 << 4 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerItem << 5 << 4 * 40;
QTest::newRow("row 0, scroll per pixel 0")
- << 10 << 40 << 0 << QAbstractItemView::ScrollPerPixel << 0 << 0;
+ << 100 << 40 << 0 << QAbstractItemView::ScrollPerPixel << 0 << 0;
QTest::newRow("row 1, scroll per pixel, 0")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 0 << 1 * 40;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 0 << 1 * 40;
QTest::newRow("row 1, scroll per pixel, 1")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 1 * 40 << 0;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 1 * 40 << 0;
QTest::newRow("row 5, scroll per pixel, 0")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 0 << 5 * 40;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 0 << 5 * 40;
QTest::newRow("row 5, scroll per pixel, 5")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 0;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 0;
QTest::newRow("row 9, scroll per pixel, 0")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 0 << 9 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 0 << 9 * 40;
QTest::newRow("row 9, scroll per pixel, 5")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 4 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 4 * 40;
}
void tst_QTableView::rowViewportPosition()
@@ -2437,46 +2412,46 @@ void tst_QTableView::columnViewportPosition_data()
QTest::addColumn<int>("columnViewportPosition");
QTest::newRow("column 0, scroll per item 0")
- << 10 << 40 << 0 << QAbstractItemView::ScrollPerItem << 0 << 0;
+ << 100 << 40 << 0 << QAbstractItemView::ScrollPerItem << 0 << 0;
QTest::newRow("column 1, scroll per item, 0")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerItem << 0 << 1 * 40;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerItem << 0 << 1 * 40;
QTest::newRow("column 1, scroll per item, 1")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerItem << 1 << 0;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerItem << 1 << 0;
QTest::newRow("column 5, scroll per item, 0")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerItem << 0 << 5 * 40;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerItem << 0 << 5 * 40;
QTest::newRow("column 5, scroll per item, 5")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerItem << 5 << 0;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerItem << 5 << 0;
QTest::newRow("column 9, scroll per item, 0")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerItem << 0 << 9 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerItem << 0 << 9 * 40;
QTest::newRow("column 9, scroll per item, 5")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerItem << 5 << 4 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerItem << 5 << 4 * 40;
QTest::newRow("column 0, scroll per pixel 0")
- << 10 << 40 << 0 << QAbstractItemView::ScrollPerPixel << 0 << 0;
+ << 100 << 40 << 0 << QAbstractItemView::ScrollPerPixel << 0 << 0;
QTest::newRow("column 1, scroll per pixel 0")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 0 << 1 * 40;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 0 << 1 * 40;
QTest::newRow("column 1, scroll per pixel 1")
- << 10 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 1 * 40 << 0;
+ << 100 << 40 << 1 << QAbstractItemView::ScrollPerPixel << 1 * 40 << 0;
QTest::newRow("column 5, scroll per pixel 0")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 0 << 5 * 40;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 0 << 5 * 40;
QTest::newRow("column 5, scroll per pixel 5")
- << 10 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 0;
+ << 100 << 40 << 5 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 0;
QTest::newRow("column 9, scroll per pixel 0")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 0 << 9 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 0 << 9 * 40;
QTest::newRow("column 9, scroll per pixel 5")
- << 10 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 4 * 40;
+ << 100 << 40 << 9 << QAbstractItemView::ScrollPerPixel << 5 * 40 << 4 * 40;
}
void tst_QTableView::columnViewportPosition()
@@ -4355,15 +4330,18 @@ void tst_QTableView::task191545_dragSelectRows()
QHeaderView *vHeader = table.verticalHeader();
QWidget *vHeaderVp = vHeader->viewport();
QPoint rowPos(cellRect.center());
- QMouseEvent rowPressEvent(QEvent::MouseButtonPress, rowPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent rowPressEvent(QEvent::MouseButtonPress, rowPos, rowPos, vHeaderVp->mapToGlobal(rowPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(vHeaderVp, &rowPressEvent);
for (int i = 0; i < 4; ++i) {
rowPos.setY(rowPos.y() + cellRect.height());
- QMouseEvent moveEvent(QEvent::MouseMove, rowPos, Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
+ QMouseEvent moveEvent(QEvent::MouseMove, rowPos, rowPos, vHeaderVp->mapToGlobal(rowPos),
+ Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
QCoreApplication::sendEvent(vHeaderVp, &moveEvent);
}
- QMouseEvent rowReleaseEvent(QEvent::MouseButtonRelease, rowPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent rowReleaseEvent(QEvent::MouseButtonRelease, rowPos, vHeaderVp->mapToGlobal(rowPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(vHeaderVp, &rowReleaseEvent);
for (int i = 0; i < 4; ++i) {
@@ -4377,15 +4355,18 @@ void tst_QTableView::task191545_dragSelectRows()
QHeaderView *hHeader = table.horizontalHeader();
QWidget *hHeaderVp = hHeader->viewport();
QPoint colPos((cellRect.left() + cellRect.right()) / 2, 5);
- QMouseEvent colPressEvent(QEvent::MouseButtonPress, colPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent colPressEvent(QEvent::MouseButtonPress, colPos, hHeaderVp->mapToGlobal(colPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(hHeaderVp, &colPressEvent);
for (int i = 0; i < 4; ++i) {
colPos.setX(colPos.x() + cellRect.width());
- QMouseEvent moveEvent(QEvent::MouseMove, colPos, Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
+ QMouseEvent moveEvent(QEvent::MouseMove, colPos, hHeaderVp->mapToGlobal(colPos),
+ Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
QCoreApplication::sendEvent(hHeaderVp, &moveEvent);
}
- QMouseEvent colReleaseEvent(QEvent::MouseButtonRelease, colPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent colReleaseEvent(QEvent::MouseButtonRelease, colPos, hHeaderVp->mapToGlobal(colPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(hHeaderVp, &colReleaseEvent);
for (int i = 0; i < 4; ++i) {
@@ -4398,16 +4379,19 @@ void tst_QTableView::task191545_dragSelectRows()
QRect cellRect = table.visualRect(model.index(2, 2));
QWidget *tableVp = table.viewport();
QPoint cellPos = cellRect.center();
- QMouseEvent cellPressEvent(QEvent::MouseButtonPress, cellPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent cellPressEvent(QEvent::MouseButtonPress, cellPos, tableVp->mapToGlobal(cellPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(tableVp, &cellPressEvent);
for (int i = 0; i < 6; ++i) {
cellPos.setX(cellPos.x() + cellRect.width());
cellPos.setY(cellPos.y() + cellRect.height());
- QMouseEvent moveEvent(QEvent::MouseMove, cellPos, Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
+ QMouseEvent moveEvent(QEvent::MouseMove, cellPos, tableVp->mapToGlobal(cellPos),
+ Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
QCoreApplication::sendEvent(tableVp, &moveEvent);
}
- QMouseEvent cellReleaseEvent(QEvent::MouseButtonRelease, cellPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent cellReleaseEvent(QEvent::MouseButtonRelease, cellPos, tableVp->mapToGlobal(cellPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(tableVp, &cellReleaseEvent);
for (int i = 0; i < 6; ++i) {
@@ -4422,16 +4406,21 @@ void tst_QTableView::task191545_dragSelectRows()
QRect cellRect = table.visualRect(model.index(3, 3));
QWidget *tableVp = table.viewport();
QPoint cellPos = cellRect.center();
- QMouseEvent cellPressEvent(QEvent::MouseButtonPress, cellPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent cellPressEvent(QEvent::MouseButtonPress, cellPos, tableVp->mapToGlobal(cellPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(tableVp, &cellPressEvent);
for (int i = 0; i < 6; ++i) {
+ // cellPos might have been updated by scrolling, so refresh
+ cellPos = table.visualRect(model.index(3+i, 3+i)).center();
cellPos.setX(cellPos.x() + cellRect.width());
cellPos.setY(cellPos.y() + cellRect.height());
- QMouseEvent moveEvent(QEvent::MouseMove, cellPos, Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
+ QMouseEvent moveEvent(QEvent::MouseMove, cellPos, tableVp->mapToGlobal(cellPos),
+ Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
QCoreApplication::sendEvent(tableVp, &moveEvent);
}
- QMouseEvent cellReleaseEvent(QEvent::MouseButtonRelease, cellPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
+ QMouseEvent cellReleaseEvent(QEvent::MouseButtonRelease, cellPos, tableVp->mapToGlobal(cellPos),
+ Qt::LeftButton, Qt::NoButton, Qt::ControlModifier);
QCoreApplication::sendEvent(tableVp, &cellReleaseEvent);
QTest::qWait(200);
@@ -4795,7 +4784,8 @@ public:
{
return QTableView::selectionCommand(index, shiftPressed ? &mouseEvent : nullptr);
}
- QMouseEvent mouseEvent = QMouseEvent(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::ShiftModifier);
+ QMouseEvent mouseEvent = QMouseEvent(QEvent::MouseButtonPress, QPointF(), QPointF(),
+ Qt::LeftButton, Qt::LeftButton, Qt::ShiftModifier);
bool shiftPressed = false;
};
diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
index aa56376c4a..39cbe0ab66 100644
--- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.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 WITH Qt-GPL-exception-1.0
#include <QHeaderView>
#include <QLineEdit>
diff --git a/tests/auto/widgets/itemviews/qtreeview/BLACKLIST b/tests/auto/widgets/itemviews/qtreeview/BLACKLIST
index 3aaf1e4e64..e69de29bb2 100644
--- a/tests/auto/widgets/itemviews/qtreeview/BLACKLIST
+++ b/tests/auto/widgets/itemviews/qtreeview/BLACKLIST
@@ -1,5 +0,0 @@
-# QTBUG-87408
-[horizontalScrollMode]
-android
-[setSelection]
-android
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 0d6d80ad59..8fa942dd06 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../../../../shared/fakedirmodel.h"
@@ -890,8 +865,8 @@ void tst_QTreeView::horizontalScrollMode()
QTreeView view;
setFrameless(&view);
view.setModel(&model);
- view.setFixedSize(100, 100);
- view.header()->resizeSection(0, 200);
+ view.setFixedSize(100, 1000);
+ view.header()->resizeSection(0, 2000);
view.show();
QCOMPARE(view.horizontalScrollMode(), QAbstractItemView::ScrollPerPixel);
@@ -2050,7 +2025,7 @@ void tst_QTreeView::setSelection()
QFETCH(PointList, expectedItems);
QFETCH(int, verticalOffset);
- QtTestModel model(10, 5);
+ QtTestModel model(100, 5);
model.levels = 1;
model.setDecorationsEnabled(true);
QTreeView view;
diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
index 8b4fcd2459..652d6f76d9 100644
--- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QApplication>
#include <QHeaderView>
#include <QLineEdit>
+#include <QScopeGuard>
#include <QScrollBar>
#include <QSignalSpy>
#include <QStyledItemDelegate>
@@ -347,6 +323,7 @@ void tst_QTreeWidget::addTopLevelItem()
// invalid insert
{
tops.clear();
+ const auto sg = qScopeGuard([&] { qDeleteAll(std::exchange(tops, {})); });
for (int i = 0; i < 10; ++i)
tops << new TreeItem();
int count = tree.topLevelItemCount();
diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
index 68d149fc6e..7c1ce7c426 100644
--- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.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 WITH Qt-GPL-exception-1.0
#include <QTreeWidget>
diff --git a/tests/auto/widgets/kernel/CMakeLists.txt b/tests/auto/widgets/kernel/CMakeLists.txt
index e1b27b2417..2392997176 100644
--- a/tests/auto/widgets/kernel/CMakeLists.txt
+++ b/tests/auto/widgets/kernel/CMakeLists.txt
@@ -16,10 +16,7 @@ add_subdirectory(qsizepolicy)
if(NOT APPLE)
add_subdirectory(qgesturerecognizer)
endif()
-# QTBUG-87668 # special case
-if(NOT ANDROID)
- add_subdirectory(qwidget)
-endif()
+add_subdirectory(qwidget)
if(QT_FEATURE_shortcut)
add_subdirectory(qshortcut)
endif()
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 025cebb15f..49123c33d5 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.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 WITH Qt-GPL-exception-1.0
#include <QDialog>
#include <QMainWindow>
diff --git a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
index 7462fd8bbf..56d2feee47 100644
--- a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
+++ b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST
index cce10602e4..364a2abe4f 100644
--- a/tests/auto/widgets/kernel/qapplication/BLACKLIST
+++ b/tests/auto/widgets/kernel/qapplication/BLACKLIST
@@ -1,5 +1,6 @@
[sendEventsOnProcessEvents]
ubuntu-20.04
+ubuntu-22.04
[touchEventPropagation]
# QTBUG-66745
opensuse-leap
diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp
index 5e86bcb529..0584dbeab8 100644
--- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp
+++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.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 WITH Qt-GPL-exception-1.0
#include <QApplication>
diff --git a/tests/auto/widgets/kernel/qapplication/modal/base.cpp b/tests/auto/widgets/kernel/qapplication/modal/base.cpp
index 249d402f2e..0108c9c789 100644
--- a/tests/auto/widgets/kernel/qapplication/modal/base.cpp
+++ b/tests/auto/widgets/kernel/qapplication/modal/base.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 WITH Qt-GPL-exception-1.0
#include "base.h"
diff --git a/tests/auto/widgets/kernel/qapplication/modal/base.h b/tests/auto/widgets/kernel/qapplication/modal/base.h
index 153d9ca420..a78b2306ba 100644
--- a/tests/auto/widgets/kernel/qapplication/modal/base.h
+++ b/tests/auto/widgets/kernel/qapplication/modal/base.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 WITH Qt-GPL-exception-1.0
#ifndef BASE_H
#define BASE_H
diff --git a/tests/auto/widgets/kernel/qapplication/modal/main.cpp b/tests/auto/widgets/kernel/qapplication/modal/main.cpp
index 9dcb6732fa..be38c41786 100644
--- a/tests/auto/widgets/kernel/qapplication/modal/main.cpp
+++ b/tests/auto/widgets/kernel/qapplication/modal/main.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 WITH Qt-GPL-exception-1.0
#include <QApplication>
#include "base.h"
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index e5ac69a00b..59cc7f0884 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.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 WITH Qt-GPL-exception-1.0
#define QT_STATICPLUGIN
#include <QtWidgets/qstyleplugin.h>
@@ -125,6 +100,7 @@ private slots:
void desktopSettingsAware();
void setActiveWindow();
+ void activateDeactivateEvent();
void focusWidget();
void focusChanged();
@@ -1530,7 +1506,7 @@ void tst_QApplication::desktopSettingsAware()
environment += QLatin1String("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM=1");
testProcess.setEnvironment(environment);
#endif
- testProcess.start("desktopsettingsaware_helper");
+ testProcess.start("./desktopsettingsaware_helper");
QVERIFY2(testProcess.waitForStarted(),
qPrintable(QString::fromLatin1("Cannot start 'desktopsettingsaware_helper': %1").arg(testProcess.errorString())));
QVERIFY(testProcess.waitForFinished(10000));
@@ -1563,6 +1539,53 @@ void tst_QApplication::setActiveWindow()
delete w;
}
+void tst_QApplication::activateDeactivateEvent()
+{
+ // Ensure that QWindows (other than QWidgetWindow)
+ // are activated / deactivated.
+ class Window : public QWindow
+ {
+ public:
+ using QWindow::QWindow;
+
+ int activateCount = 0;
+ int deactivateCount = 0;
+ protected:
+ bool event(QEvent *e) override
+ {
+ switch (e->type()) {
+ case QEvent::WindowActivate:
+ ++activateCount;
+ break;
+ case QEvent::WindowDeactivate:
+ ++deactivateCount;
+ break;
+ default:
+ break;
+ }
+ return QWindow::event(e);
+ }
+ };
+
+ int argc = 0;
+ QApplication app(argc, nullptr);
+
+ Window w1;
+ Window w2;
+
+ w1.show();
+ w1.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&w1));
+ QCOMPARE(w1.activateCount, 1);
+ QCOMPARE(w1.deactivateCount, 0);
+
+ w2.show();
+ w2.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&w2));
+ QCOMPARE(w1.deactivateCount, 1);
+ QCOMPARE(w2.activateCount, 1);
+}
+
void tst_QApplication::focusWidget()
{
int argc = 0;
@@ -1865,7 +1888,7 @@ void tst_QApplication::focusMouseClick()
// front most widget has Qt::TabFocus, parent widget accepts clicks as well
// now send a mouse button press event and check what happens with the focus
// it should be given to the parent widget
- QMouseEvent ev(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent ev(QEvent::MouseButtonPress, QPointF(), w.mapToGlobal(QPointF()), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
@@ -2470,7 +2493,7 @@ void tst_QApplication::qtbug_12673()
#if QT_CONFIG(process)
QProcess testProcess;
QStringList arguments;
- testProcess.start("modal_helper", arguments);
+ testProcess.start("./modal_helper", arguments);
QVERIFY2(testProcess.waitForStarted(),
qPrintable(QString::fromLatin1("Cannot start 'modal_helper': %1").arg(testProcess.errorString())));
QVERIFY(testProcess.waitForFinished(20000));
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index a410a7bf00..fc4302b1ff 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qformlayout/BLACKLIST b/tests/auto/widgets/kernel/qformlayout/BLACKLIST
index 375682e788..e69de29bb2 100644
--- a/tests/auto/widgets/kernel/qformlayout/BLACKLIST
+++ b/tests/auto/widgets/kernel/qformlayout/BLACKLIST
@@ -1,3 +0,0 @@
-# QTBUG-87401
-[wrapping]
-android
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index 4aa9f8ac2d..bccd443092 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -135,6 +110,8 @@ private slots:
void takeRow_QLayout();
void setWidget();
void setLayout();
+ void hideShowRow();
+ void showWithHiddenRow();
/*
QLayoutItem *itemAt(int row, ItemRole role) const;
@@ -274,7 +251,9 @@ void tst_QFormLayout::wrapping()
fl->setRowWrapPolicy(QFormLayout::WrapLongRows);
QLineEdit *le = new QLineEdit;
- QLabel *lbl = new QLabel("A long label");
+ QLabel *lbl = new QLabel("A long label which is actually long enough to trigger wrapping,"
+ " even on Android and even if it is executed on a tiling window"
+ " manager which forces the window into fullscreen mode.");
le->setMinimumWidth(200);
fl->addRow(lbl, le);
@@ -814,6 +793,7 @@ void tst_QFormLayout::removeRow_QWidget()
QCOMPARE(layout->rowCount(), 0);
QWidget *w3 = new QWidget;
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayout::takeRow: Invalid widget");
layout->removeRow(w3);
delete w3;
}
@@ -854,6 +834,7 @@ void tst_QFormLayout::removeRow_QLayout()
QCOMPARE(layout->rowCount(), 0);
QHBoxLayout *l3 = new QHBoxLayout;
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayout::takeRow: Invalid layout");
layout->removeRow(l3);
delete l3;
}
@@ -893,6 +874,7 @@ void tst_QFormLayout::takeRow()
QCOMPARE(layout->rowCount(), 0);
QCOMPARE(result.fieldItem->widget(), w1.data());
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayout::takeRow: Invalid row 0");
result = layout->takeRow(0);
QVERIFY(!result.fieldItem);
@@ -933,6 +915,7 @@ void tst_QFormLayout::takeRow_QWidget()
QCOMPARE(layout->rowCount(), 0);
QWidget *w3 = new QWidget;
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayout::takeRow: Invalid widget");
result = layout->takeRow(w3);
delete w3;
@@ -980,6 +963,7 @@ void tst_QFormLayout::takeRow_QLayout()
QCOMPARE(layout->rowCount(), 0);
QHBoxLayout *l3 = new QHBoxLayout;
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayout::takeRow: Invalid layout");
result = layout->takeRow(l3);
delete l3;
@@ -1009,7 +993,9 @@ void tst_QFormLayout::setWidget()
QCOMPARE(layout.rowCount(), 6);
// should be ignored and generate warnings
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayoutPrivate::setItem: Cell (3, 1) already occupied");
layout.setWidget(3, QFormLayout::FieldRole, &w4);
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayoutPrivate::setItem: Invalid cell (-1, 1)");
layout.setWidget(-1, QFormLayout::FieldRole, &w4);
{
@@ -1077,7 +1063,9 @@ void tst_QFormLayout::setLayout()
QCOMPARE(layout.rowCount(), 6);
// should be ignored and generate warnings
+ QTest::ignoreMessage(QtWarningMsg, "QFormLayoutPrivate::setItem: Cell (3, 1) already occupied");
layout.setLayout(3, QFormLayout::FieldRole, &l4);
+ QTest::ignoreMessage(QtWarningMsg, "QLayout::addChildLayout: layout \"\" already has a parent");
layout.setLayout(-1, QFormLayout::FieldRole, &l4);
QCOMPARE(layout.count(), 3);
QCOMPARE(layout.rowCount(), 6);
@@ -1123,6 +1111,148 @@ void tst_QFormLayout::setLayout()
}
}
+void tst_QFormLayout::hideShowRow()
+{
+ QWidget topLevel;
+ QFormLayout layout;
+
+ const auto makeComplex = []{
+ QHBoxLayout *hboxField = new QHBoxLayout;
+ hboxField->addWidget(new QLineEdit("Left"));
+ hboxField->addWidget(new QLineEdit("Right"));
+ return hboxField;
+ };
+
+ layout.addRow("Label", new QLineEdit("one"));
+ layout.addRow("Label", new QLineEdit("two"));
+ layout.addRow("Label", new QLineEdit("three"));
+ layout.addRow("Label", makeComplex());
+ layout.addRow(new QLineEdit("five")); // spanning widget
+ layout.addRow(makeComplex()); // spanning layout
+
+ topLevel.setLayout(&layout);
+ topLevel.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
+
+ // returns the top-left position of the items in a row
+ const auto rowPosition = [&layout](int row) {
+ QRect rect;
+ if (QLayoutItem *spanningItem = layout.itemAt(row, QFormLayout::SpanningRole)) {
+ rect = spanningItem->geometry();
+ } else {
+ if (QLayoutItem *labelItem = layout.itemAt(row, QFormLayout::LabelRole)) {
+ rect = labelItem->geometry();
+ }
+ if (QLayoutItem *fieldItem = layout.itemAt(row, QFormLayout::FieldRole)) {
+ rect |= fieldItem->geometry();
+ }
+ }
+ return rect.topLeft();
+ };
+
+ // returns the first widget in a row, even if that row is taken by a layout
+ const auto rowInputWidget = [&layout](int row) -> QWidget* {
+ auto fieldItem = layout.itemAt(row, QFormLayout::FieldRole);
+ if (!fieldItem)
+ return nullptr;
+ QWidget *fieldWidget = fieldItem->widget();
+ // we happen to know our layout structure
+ if (!fieldWidget)
+ fieldWidget = fieldItem->layout()->itemAt(0)->widget();
+ return fieldWidget;
+ };
+
+ // record the reference positions for all rows
+ QList<QPoint> rowPositions(layout.rowCount());
+ for (int row = 0; row < layout.rowCount(); ++row)
+ rowPositions[row] = rowPosition(row);
+
+ // hide each row in turn, the next row should take the space of the hidden row
+ for (int row = 0; row < layout.rowCount(); ++ row) {
+ layout.setRowVisible(row, false);
+ QVERIFY(!layout.isRowVisible(row));
+ if (row < layout.rowCount() - 1)
+ QTRY_COMPARE(rowPosition(row + 1), rowPositions[row]);
+ layout.setRowVisible(row, true);
+ QVERIFY(layout.isRowVisible(row));
+ }
+
+ // Hiding only the label or only the field doesn't hide the row.
+ for (int row = 0; row < layout.rowCount() - 1; ++row) {
+ const auto labelItem = layout.itemAt(0, QFormLayout::LabelRole);
+ if (labelItem) {
+ labelItem->widget()->hide();
+ QVERIFY(layout.isRowVisible(row));
+ QCOMPARE(rowPosition(row), rowPositions[row]);
+ layout.itemAt(0, QFormLayout::LabelRole)->widget()->show();
+ }
+ const auto fieldItem = layout.itemAt(0, QFormLayout::FieldRole);
+ if (fieldItem) {
+ fieldItem->widget()->hide();
+ QVERIFY(layout.isRowVisible(row));
+ QCOMPARE(rowPosition(row), rowPositions[row]);
+ layout.itemAt(0, QFormLayout::FieldRole)->widget()->show();
+ }
+ }
+
+ // If we hide both label and field, then the row should be considered hidden and the
+ // following row should move up into the space of the hidden row. We can only test
+ // this if both label and field are widgets, or if there is a spanning widget.
+ for (int row = 0; row < layout.rowCount() - 1; ++row) {
+ QWidget *labelWidget = nullptr;
+ if (auto labelItem = layout.itemAt(row, QFormLayout::LabelRole))
+ labelWidget = labelItem->widget();
+ QWidget *fieldWidget = nullptr;
+ if (auto fieldItem = layout.itemAt(row, QFormLayout::FieldRole))
+ fieldWidget = fieldItem->widget();
+
+ if (!fieldWidget)
+ continue;
+ if (labelWidget)
+ labelWidget->hide();
+ fieldWidget->hide();
+ QVERIFY(!layout.isRowVisible(row));
+ QVERIFY(!layout.isRowVisible(fieldWidget));
+ if (labelWidget)
+ QVERIFY(!layout.isRowVisible(labelWidget));
+ QTRY_COMPARE(rowPosition(row + 1), rowPositions[row]);
+ if (labelWidget)
+ labelWidget->show();
+ fieldWidget->show();
+ }
+
+ // hiding a row where a widget has focus must move focus to a widget in the next row
+ for (int row = 0; row < layout.rowCount(); ++row) {
+ QWidget *inputWidget = rowInputWidget(row);
+ QVERIFY(inputWidget);
+ inputWidget->setFocus();
+ layout.setRowVisible(row, false);
+ QVERIFY(!inputWidget->hasFocus());
+ }
+
+ // Now hide all rows, hide the toplevel widget, and show the toplevel widget again.
+ // None of the widgets inside must be visible.
+ for (int row = 0; row < layout.rowCount(); ++row)
+ layout.setRowVisible(row, false);
+ topLevel.hide();
+ topLevel.show();
+ for (int row = 0; row < layout.rowCount(); ++row)
+ QVERIFY(rowInputWidget(row)->isHidden());
+}
+
+void tst_QFormLayout::showWithHiddenRow()
+{
+ QWidget topLevel;
+ QFormLayout layout;
+
+ for (int row = 0; row < 3; ++row)
+ layout.addRow(QString("Label %1").arg(row), new QLineEdit);
+ layout.setRowVisible(1, false);
+
+ topLevel.setLayout(&layout);
+ topLevel.show();
+}
+
void tst_QFormLayout::itemAt()
{
QWidget topLevel;
diff --git a/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
index 9687601158..87e0290473 100644
--- a/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
+++ b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.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 WITH Qt-GPL-exception-1.0
#include <QtTest/QTest>
@@ -294,7 +269,7 @@ void tst_QGestureRecognizer::swipeGesture()
// Press point #3
points.append(points.last() + fingerDistance);
- swipeSequence.press(points.size() - 1, points.last(), &widget);
+ swipeSequence.stationary(0).stationary(1).press(points.size() - 1, points.last(), &widget);
swipeSequence.commit();
Q_ASSERT(points.size() == swipePoints);
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 2cf2462fd5..fda88fcd83 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qlayout/CMakeLists.txt b/tests/auto/widgets/kernel/qlayout/CMakeLists.txt
index 049fab0f02..89cb2ce8e9 100644
--- a/tests/auto/widgets/kernel/qlayout/CMakeLists.txt
+++ b/tests/auto/widgets/kernel/qlayout/CMakeLists.txt
@@ -20,20 +20,3 @@ qt_internal_add_test(tst_qlayout
Qt::WidgetsPrivate
TESTDATA ${test_data}
)
-
-## Scopes:
-#####################################################################
-
-if(ANDROID)
- # Resources:
- set(testdata_resource_files
- "baseline/smartmaxsize"
- )
-
- qt_internal_add_resource(tst_qlayout "testdata"
- PREFIX
- "/"
- FILES
- ${testdata_resource_files}
- )
-endif()
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index 5c5869c738..9d5f7940cc 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index a9cd037b38..2beecc7112 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
index d6a5ec218d..f8c6779a83 100644
--- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
+++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qsizepolicy.h>
@@ -109,7 +84,7 @@ void tst_QSizePolicy::constExpr()
{
/* gcc < 4.8.0 has problems with init'ing variant members in constexpr ctors */
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54922 */
-#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) || defined(Q_CC_CLANG) || Q_CC_GNU >= 408
+#if !defined(Q_CC_GNU) || defined(Q_CC_CLANG) || Q_CC_GNU >= 408
// check that certain ctors are constexpr (compile-only):
{ constexpr QSizePolicy sp; Q_UNUSED(sp); }
{ constexpr QSizePolicy sp = QSizePolicy(); Q_UNUSED(sp); }
diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
index 711ffeda03..06e97e69b6 100644
--- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp
+++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index 8e4e2a0ea4..f1532ae3ac 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index 880ec6f9b4..24387635b4 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -22,9 +22,6 @@ osx
macos arm
[render_systemClip]
osx
-[maskedUpdate]
-opensuse
-opensuse-leap
[moveInResizeEvent]
ubuntu-16.04
[multipleToplevelFocusCheck]
@@ -33,12 +30,7 @@ centos
opensuse-leap
ubuntu
sles-15
-
# QTBUG-87668
-[reparent]
-android
-[windowState]
-android
[showMinimizedKeepsFocus]
android
[normalGeometry]
@@ -47,19 +39,23 @@ android
android
[optimizedResizeMove]
android
-[resizeEvent]
-android
[update]
android
[scroll]
android
-[setWindowGeometry]
+[moveChild]
android
-[windowMoveResize]
+[multipleToplevelFocusCheck]
android
-[moveChild]
+[renderInvisible]
android
-[showAndMoveChild]
+[updateWhileMinimized]
android
-[multipleToplevelFocusCheck]
+[doubleRepaint]
+android
+[setMaskInResizeEvent]
+android
+[activateWindow]
+android
+[optimizedResize_topLevel]
android
diff --git a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt
index d04db40e87..e2370a011a 100644
--- a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt
+++ b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt
@@ -4,6 +4,14 @@
## tst_qwidget Test:
#####################################################################
+# Resources:
+set(qwidget_resource_files
+ "geometry-fullscreen.dat"
+ "geometry-maximized.dat"
+ "geometry.dat"
+ "hellotr_la.qm"
+)
+
qt_internal_add_test(tst_qwidget
SOURCES
tst_qwidget.cpp
@@ -14,24 +22,10 @@ qt_internal_add_test(tst_qwidget
Qt::TestPrivate
Qt::Widgets
Qt::WidgetsPrivate
+ TESTDATA ${qwidget_resource_files}
+ BUILTIN_TESTDATA
)
-# Resources:
-set(qwidget_resource_files
- "geometry-fullscreen.dat"
- "geometry-maximized.dat"
- "geometry.dat"
- "hellotr_la.qm"
-)
-
-qt_internal_add_resource(tst_qwidget "qwidget"
- PREFIX
- "/"
- FILES
- ${qwidget_resource_files}
-)
-
-
#### Keys ignored in scope 1:.:.:qwidget.pro:<TRUE>:
# testcase.timeout = "600"
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index c2d00d003f..f65882611b 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.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 WITH Qt-GPL-exception-1.0
#include "../../../shared/highdpi.h"
@@ -83,6 +58,7 @@
#include <QtTest/private/qtesthelpers_p.h>
using namespace QTestPrivate;
+using namespace Qt::StringLiterals;
#if defined(Q_OS_WIN)
# include <QtCore/qt_windows.h>
@@ -204,6 +180,7 @@ private slots:
void reparent();
void setScreen();
void windowState();
+ void resizePropagation();
void showMaximized();
void showFullScreen();
void showMinimized();
@@ -335,6 +312,8 @@ private slots:
void resizeInPaintEvent();
void opaqueChildren();
+ void dumpObjectTree();
+
void setMaskInResizeEvent();
void moveInResizeEvent();
@@ -443,6 +422,10 @@ private slots:
void activateWhileModalHidden();
+#ifdef Q_OS_ANDROID
+ void showFullscreenAndroid();
+#endif
+
private:
const QString m_platform;
QSize m_testWidgetSize;
@@ -467,8 +450,8 @@ void tst_QWidget::getSetCheck()
QVERIFY(var1.data() != obj1.style());
QVERIFY(obj1.style() != nullptr); // style can never be 0 for a widget
- const QRegularExpression negativeNotPossible(u"^.*Negative sizes \\(.*\\) are not possible$"_qs);
- const QRegularExpression largestAllowedSize(u"^.*The largest allowed size is \\(.*\\)$"_qs);
+ const QRegularExpression negativeNotPossible(u"^.*Negative sizes \\(.*\\) are not possible$"_s);
+ const QRegularExpression largestAllowedSize(u"^.*The largest allowed size is \\(.*\\)$"_s);
// int QWidget::minimumWidth()
// void QWidget::setMinimumWidth(int)
obj1.setMinimumWidth(0);
@@ -2571,12 +2554,14 @@ void tst_QWidget::windowState()
QPoint pos;
QSize size = m_testWidgetSize;
- if (QGuiApplicationPrivate::platformIntegration()->defaultWindowState(Qt::Widget)
- == Qt::WindowFullScreen) {
+ const Qt::WindowState defaultWidgetState =
+ QGuiApplicationPrivate::platformIntegration()->defaultWindowState(Qt::Widget);
+ if (defaultWidgetState == Qt::WindowFullScreen)
size = QGuiApplication::primaryScreen()->size();
- } else {
+ else if (defaultWidgetState == Qt::WindowMaximized)
+ size = QGuiApplication::primaryScreen()->availableSize();
+ else
pos = QPoint(10, 10);
- }
QWidget widget1;
widget1.move(pos);
@@ -2691,6 +2676,102 @@ void tst_QWidget::windowState()
QTRY_COMPARE(widget1.size(), size);
}
+// Test propagation of size and state from platform window to QWidget
+// Windows and linux/XCB only
+void tst_QWidget::resizePropagation()
+{
+#if !defined(Q_OS_LINUX) && !defined(Q_OS_WIN)
+ QSKIP("resizePropagation test is designed for Linux/XCB and Windows only");
+#endif
+ const bool xcb = (m_platform == QStringLiteral("xcb"));
+#ifdef Q_OS_LINUX
+ if (!xcb)
+ QSKIP("resizePropagation test is designed for XCB only");
+#endif
+
+ // Platform specific notes:
+ // Linux/XCB:
+ // - Unless maximized, a widget and its corresponding window can have different sizes
+ // - windowStateChanged can be fired multiple times (QTBUG-102478) when widget is maximized
+ //
+ // Windows:
+ // When a widget is maximized after it has been resized, the widget retains its original size,
+ // while the window shows maximum size
+
+ // Initialize widget and signal spy for window handle
+ QWidget widget;
+ widget.showMaximized();
+ QWindow *window = widget.windowHandle();
+ QTRY_VERIFY(window);
+ QSignalSpy spy(window, &QWindow::windowStateChanged);
+ int count = 0;
+
+ const QSize screenSize = QGuiApplication::primaryScreen()->size();
+ const QSize size1 = QSize(screenSize.width() * 0.5, screenSize.height() * 0.5);
+ const QSize size2 = QSize(screenSize.width() * 0.625, screenSize.height() * 0.833);
+
+ auto verifyResize = [&](const QSize &size, Qt::WindowState windowState, bool checkCountIncrement, bool checkTargetSize)
+ {
+ // Capture count of latest async signals
+ if (!checkCountIncrement)
+ count = spy.count();
+
+ // Resize if required
+ if (size.isValid())
+ widget.resize(size);
+
+ // Wait for the widget anyway
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+
+ // Check signal count and qDebug output for fail analysis
+ if (checkCountIncrement) {
+ QTRY_VERIFY(spy.count() > count);
+ qDebug() << "spy count:" << spy.count() << "previous count:" << count;
+ count = spy.count();
+ } else {
+ qDebug() << spy << widget.windowState() << window->windowState();
+ QCOMPARE(spy.count(), count);
+ }
+
+ // QTRY necessary because state changes are propagated async
+ QTRY_COMPARE(widget.windowState(), windowState);
+ QTRY_COMPARE(window->windowState(), windowState);
+
+ // Check target size with fail or warning
+ if (checkTargetSize) {
+ QCOMPARE(widget.size(), window->size());
+ } else if (widget.size() != window->size()) {
+ qWarning() << m_platform << "size mismtach tolerated. Widget:"
+ << widget.size() << "Window:" << window->size();
+ }
+ };
+
+ // test state and size consistency of maximized window
+ verifyResize(QSize(), Qt::WindowMaximized, true, true);
+ if (QTest::currentTestFailed())
+ return;
+
+ // test state transition, state and size consistency after resize
+ verifyResize(size1, Qt::WindowNoState, true, !xcb );
+ if (QTest::currentTestFailed())
+ return;
+
+ // test unchanged state, state and size consistency after resize
+ verifyResize(size2, Qt::WindowNoState, false, !xcb);
+ if (QTest::currentTestFailed())
+ return;
+
+ // test state transition, state and size consistency after maximize
+ widget.showMaximized();
+ verifyResize(QSize(), Qt::WindowMaximized, true, xcb);
+ if (QTest::currentTestFailed())
+ return;
+
+#ifdef Q_OS_WIN
+ QCOMPARE(widget.size(), size2);
+#endif
+}
+
void tst_QWidget::showMaximized()
{
QWidget plain;
@@ -2880,7 +2961,7 @@ void tst_QWidget::resizeEvent()
wParent.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
wParent.resize(m_testWidgetSize);
ResizeWidget wChild(&wParent);
- wParent.show();
+ QTestPrivate::androidCompatibleShow(&wParent);
QVERIFY(QTest::qWaitForWindowExposed(&wParent));
QCOMPARE (wChild.m_resizeEventCount, 1); // initial resize event before paint
wParent.hide();
@@ -2889,7 +2970,7 @@ void tst_QWidget::resizeEvent()
safeSize.setWidth(639);
wChild.resize(safeSize);
QCOMPARE (wChild.m_resizeEventCount, 1);
- wParent.show();
+ QTestPrivate::androidCompatibleShow(&wParent);
QCOMPARE (wChild.m_resizeEventCount, 2);
}
@@ -2897,7 +2978,7 @@ void tst_QWidget::resizeEvent()
ResizeWidget wTopLevel;
wTopLevel.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
wTopLevel.resize(m_testWidgetSize);
- wTopLevel.show();
+ QTestPrivate::androidCompatibleShow(&wTopLevel);
QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel));
QCOMPARE (wTopLevel.m_resizeEventCount, 1); // initial resize event before paint for toplevels
wTopLevel.hide();
@@ -2906,7 +2987,7 @@ void tst_QWidget::resizeEvent()
safeSize.setWidth(639);
wTopLevel.resize(safeSize);
QCOMPARE (wTopLevel.m_resizeEventCount, 1);
- wTopLevel.show();
+ QTestPrivate::androidCompatibleShow(&wTopLevel);
QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel));
QCOMPARE (wTopLevel.m_resizeEventCount, 2);
}
@@ -3121,8 +3202,8 @@ void tst_QWidget::reparent()
pal2.setColor(childTLW.backgroundRole(), Qt::yellow);
childTLW.setPalette(pal2);
- parent.show();
- childTLW.show();
+ QTestPrivate::androidCompatibleShow(&parent);
+ QTestPrivate::androidCompatibleShow(&childTLW);
QVERIFY(QTest::qWaitForWindowExposed(&parent));
parent.move(parentPosition);
@@ -3132,7 +3213,7 @@ void tst_QWidget::reparent()
child.setParent(nullptr, child.windowFlags() & ~Qt::WindowType_Mask);
child.setGeometry(childPos.x(), childPos.y(), child.width(), child.height());
- child.show();
+ QTestPrivate::androidCompatibleShow(&child);
#if 0 // QTBUG-26424
if (m_platform == QStringLiteral("xcb"))
@@ -4019,7 +4100,7 @@ void tst_QWidget::restoreVersion1Geometry()
QVERIFY(f.exists());
f.open(QIODevice::ReadOnly);
const QByteArray savedGeometry = f.readAll();
- QCOMPARE(savedGeometry.count(), 46);
+ QCOMPARE(savedGeometry.size(), 46);
f.close();
QWidget widget;
@@ -4231,7 +4312,8 @@ void tst_QWidget::testDeletionInEventHandlers()
w = new Widget;
w->show();
w->deleteThis = true;
- QMouseEvent me(QEvent::MouseButtonRelease, QPoint(1, 1), Qt::LeftButton, Qt::LeftButton, Qt::KeyboardModifiers());
+ QMouseEvent me(QEvent::MouseButtonRelease, QPoint(1, 1), w->mapToGlobal(QPoint(1, 1)),
+ Qt::LeftButton, Qt::LeftButton, Qt::KeyboardModifiers());
qApp->notify(w, &me);
QVERIFY(w.isNull());
delete w;
@@ -4270,7 +4352,8 @@ void tst_QWidget::testDeletionInEventHandlers()
w->setMouseTracking(true);
w->show();
w->deleteThis = true;
- QMouseEvent me2 = QMouseEvent(QEvent::MouseMove, QPoint(0, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ QMouseEvent me2 = QMouseEvent(QEvent::MouseMove, QPoint(0, 0), w->mapToGlobal(QPoint(0, 0)),
+ Qt::NoButton, Qt::NoButton, Qt::NoModifier);
QApplication::sendEvent(w, &me2);
QVERIFY(w.isNull());
delete w;
@@ -5591,7 +5674,7 @@ void tst_QWidget::setWindowGeometry()
QTRY_COMPARE(widget.geometry(), rect);
// show() again, geometry() should still be the same
- widget.show();
+ QTestPrivate::androidCompatibleShow(&widget);
if (rect.isValid())
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTRY_COMPARE(widget.geometry(), rect);
@@ -5642,7 +5725,7 @@ void tst_QWidget::setWindowGeometry()
QTRY_COMPARE(widget.geometry(), rect);
// show() again, geometry() should still be the same
- widget.show();
+ QTestPrivate::androidCompatibleShow(&widget);
if (rect.isValid())
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTest::qWait(10);
@@ -5790,7 +5873,7 @@ void tst_QWidget::windowMoveResize()
QTRY_COMPARE(widget.size(), rect.size());
// show() again, pos() should be the same
- widget.show();
+ QTestPrivate::androidCompatibleShow(&widget);
if (rect.isValid())
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QApplication::processEvents();
@@ -5861,7 +5944,7 @@ void tst_QWidget::windowMoveResize()
QTRY_COMPARE(widget.size(), rect.size());
// show() again, pos() should be the same
- widget.show();
+ QTestPrivate::androidCompatibleShow(&widget);
if (rect.isValid())
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTest::qWait(10);
@@ -7083,7 +7166,9 @@ void tst_QWidget::childEvents()
<< qMakePair(&widget, QEvent::Move)
<< qMakePair(&widget, QEvent::Resize)
<< qMakePair(&widget, QEvent::Show)
+#ifndef Q_OS_ANDROID
<< qMakePair(&widget, QEvent::CursorChange)
+#endif
<< qMakePair(&widget, QEvent::ShowToParent);
QVERIFY2(spy.eventList() == expected,
@@ -7172,7 +7257,9 @@ void tst_QWidget::childEvents()
<< qMakePair(&widget, QEvent::Move)
<< qMakePair(&widget, QEvent::Resize)
<< qMakePair(&widget, QEvent::Show)
+#ifndef Q_OS_ANDROID
<< qMakePair(&widget, QEvent::CursorChange)
+#endif
<< qMakePair(&widget, QEvent::ShowToParent);
QVERIFY2(spy.eventList() == expected,
@@ -7264,7 +7351,9 @@ void tst_QWidget::childEvents()
<< qMakePair(&widget, QEvent::Move)
<< qMakePair(&widget, QEvent::Resize)
<< qMakePair(&widget, QEvent::Show)
+#ifndef Q_OS_ANDROID
<< qMakePair(&widget, QEvent::CursorChange)
+#endif
<< qMakePair(&widget, QEvent::ShowToParent);
QVERIFY2(spy.eventList() == expected,
@@ -7372,7 +7461,11 @@ void tst_QWidget::renderChildFillsBackground()
QCoreApplication::processEvents();
const QPixmap childPixmap = child.grab(QRect(QPoint(0, 0), QSize(-1, -1)));
const QPixmap windowPixmap = window.grab(QRect(QPoint(0, 0), QSize(-1, -1)));
+#ifndef Q_OS_ANDROID
+ // On Android all widgets are shown maximized, so the pixmaps
+ // will be similar
QEXPECT_FAIL("", "This test fails on all platforms", Continue);
+#endif
QCOMPARE(childPixmap, windowPixmap);
}
@@ -8987,9 +9080,6 @@ void tst_QWidget::doubleRepaint()
// Minmize: Should not trigger a repaint.
widget.showMinimized();
QTest::qWait(10);
-#if defined(Q_OS_QNX)
- QEXPECT_FAIL("", "Platform does not support showMinimized()", Continue);
-#endif
QCOMPARE(widget.numPaintEvents, 0);
widget.numPaintEvents = 0;
@@ -9061,6 +9151,44 @@ void tst_QWidget::opaqueChildren()
QCOMPARE(qt_widget_private(&grandChild)->getOpaqueChildren(), QRegion());
}
+void tst_QWidget::dumpObjectTree()
+{
+ QWidget w;
+ w.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
+ Q_SET_OBJECT_NAME(w);
+ w.move(100, 100);
+ w.resize(200, 200);
+
+ QLineEdit le(&w);
+ Q_SET_OBJECT_NAME(le);
+ le.resize(200, 200);
+
+ {
+ const char * const expected[] = {
+ "QWidget::w I",
+ " QLineEdit::le I",
+ " QWidgetLineControl:: ",
+ };
+ for (const char *line : expected)
+ QTest::ignoreMessage(QtDebugMsg, line);
+ w.dumpObjectTree();
+ }
+
+ QTestPrivate::androidCompatibleShow(&w);
+ QApplication::setActiveWindow(&w);
+ QVERIFY(QTest::qWaitForWindowActive(&w));
+
+ {
+ const char * const expected[] = {
+ "QWidget::w <200x200+100+100>",
+ " QLineEdit::le F<200x200+0+0>",
+ " QWidgetLineControl:: ",
+ };
+ for (const char *line : expected)
+ QTest::ignoreMessage(QtDebugMsg, line);
+ w.dumpObjectTree();
+ }
+}
class MaskSetWidget : public QWidget
{
@@ -9567,6 +9695,10 @@ void tst_QWidget::translucentWidget()
const QImage actual = widgetSnapshot.toImage().convertToFormat(QImage::Format_RGB32);
QImage expected = pm.toImage().scaled(label.devicePixelRatio() * pm.size());
expected.setDevicePixelRatio(label.devicePixelRatio());
+#ifdef Q_OS_ANDROID
+ // Android uses Format_ARGB32_Premultiplied by default
+ expected = expected.convertToFormat(QImage::Format_RGB32);
+#endif
QCOMPARE(actual.size(),expected.size());
QCOMPARE(actual,expected);
@@ -10099,6 +10231,8 @@ void tst_QWidget::enterLeaveOnWindowShowHide()
secondary->show();
if (!QTest::qWaitForWindowExposed(secondary))
QEXPECT_FAIL("", "Secondary window failed to show, test will fail", Abort);
+ if (secondaryWindowType == Qt::Dialog && QGuiApplication::platformName() == "windows")
+ QTest::qWait(250); // on Windows, we have to wait for fade-in effects
}
};
@@ -10125,15 +10259,16 @@ void tst_QWidget::enterLeaveOnWindowShowHide()
QTest::mouseClick(&widget, Qt::LeftButton, {}, widget.mapFromGlobal(cursorPos));
++expectedLeave;
- QTRY_COMPARE_WITH_TIMEOUT(widget.numLeaveEvents, expectedLeave, 500);
+ QTRY_COMPARE_WITH_TIMEOUT(widget.numLeaveEvents, expectedLeave, 1000);
QVERIFY(!widget.underMouse());
+ QTRY_VERIFY(QApplication::activeModalWidget() || QApplication::activePopupWidget());
if (QApplication::activeModalWidget())
QApplication::activeModalWidget()->close();
else if (QApplication::activePopupWidget())
QApplication::activePopupWidget()->close();
++expectedEnter;
// Use default timeout, the test is flaky on Windows otherwise.
- QVERIFY(QTest::qWaitFor([&]{ return widget.numEnterEvents >= expectedEnter; }));
+ QTRY_VERIFY(widget.numEnterEvents >= expectedEnter);
// When a modal dialog closes we might get more than one enter event on macOS.
// This seems to depend on timing, so we tolerate that flakiness for now.
if (widget.numEnterEvents > expectedEnter && QGuiApplication::platformName() == "cocoa")
@@ -10215,7 +10350,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
QTRY_COMPARE(child.numEnterEvents, 1);
QCOMPARE(child.numMouseMoveEvents, 0);
- // Sending synthetic enter/leave trough the parent's mousePressEvent handler.
+ // Sending synthetic enter/leave through the parent's mousePressEvent handler.
parent.child = &child;
child.hide();
@@ -10669,6 +10804,9 @@ void tst_QWidget::activateWindow()
void tst_QWidget::openModal_taskQTBUG_5804()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("This test hangs on Android");
+#endif
class Widget : public QWidget
{
public:
@@ -12497,6 +12635,9 @@ protected:
void tst_QWidget::deleteWindowInCloseEvent()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("This test crashes on Android");
+#endif
QSignalSpy quitSpy(qApp, &QGuiApplication::lastWindowClosed);
// Closing this widget should not cause a crash
@@ -12629,5 +12770,38 @@ void tst_QWidget::activateWhileModalHidden()
QCOMPARE(QApplication::activeWindow(), &window);
}
+#ifdef Q_OS_ANDROID
+void tst_QWidget::showFullscreenAndroid()
+{
+ QWidget w;
+ w.setAutoFillBackground(true);
+ QPalette p = w.palette();
+ p.setColor(QPalette::Window, Qt::red);
+ w.setPalette(p);
+
+ // Need to toggle showFullScreen() twice, see QTBUG-101968
+ w.showFullScreen();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ w.showFullScreen();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+
+ // Make sure that the lower part of the screen contains the red widget, not
+ // the buttons.
+
+ const QRect fullGeometry = w.screen()->geometry();
+ // Take a rect of (20 x 20) from the bottom area
+ const QRect grabArea(10, fullGeometry.height() - 30, 20, 20);
+ const QImage img = grabFromWidget(&w, grabArea).toImage().convertedTo(QImage::Format_RGB32);
+
+ QPixmap expectedPix(20, 20);
+ expectedPix.fill(Qt::red);
+ const QImage expectedImg = expectedPix.toImage().convertedTo(QImage::Format_RGB32);
+
+ QCOMPARE(img, expectedImg);
+}
+#endif // Q_OS_ANDROID
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h
index 87de300da9..fec9706ef5 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.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 WITH Qt-GPL-exception-1.0
#include <QtCore/QString>
#include <QtCore/QPair>
#include <QtWidgets/QWidget>
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm
index e2d00aa25b..19c5c0d714 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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 WITH Qt-GPL-exception-1.0
// some versions of CALayer.h use 'slots' as an identifier
#define QT_NO_KEYWORDS
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 5ae4526af2..689a65518e 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -43,6 +18,7 @@
#include <qlabel.h>
#include <qmainwindow.h>
#include <qtoolbar.h>
+#include <qsignalspy.h>
#include <private/qwindow_p.h>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
@@ -131,6 +107,8 @@ private slots:
void mouseMoveWithPopup_data();
void mouseMoveWithPopup();
+ void resetFocusObjectOnDestruction();
+
private:
QSize m_testWidgetSize;
const int m_fuzz;
@@ -1574,5 +1552,38 @@ void tst_QWidget_window::mouseMoveWithPopup()
QCOMPARE(topLevel.popup->mouseReleaseCount, 1);
}
+void tst_QWidget_window::resetFocusObjectOnDestruction()
+{
+ QSignalSpy focusObjectChangedSpy(qApp, &QGuiApplication::focusObjectChanged);
+
+ // single top level widget that has focus
+ std::unique_ptr<QWidget> widget(new QWidget);
+ widget->setObjectName("Widget 1");
+ widget->setFocus();
+ widget->show();
+ QVERIFY(QTest::qWaitForWindowActive(widget.get()));
+
+ int activeCount = focusObjectChangedSpy.count();
+ widget.reset();
+ QVERIFY(focusObjectChangedSpy.count() > activeCount);
+ QCOMPARE(focusObjectChangedSpy.last().last().value<QObject*>(), nullptr);
+ focusObjectChangedSpy.clear();
+
+ // top level widget with focused child
+ widget.reset(new QWidget);
+ widget->setObjectName("Widget 2");
+ QWidget *child = new QWidget(widget.get());
+ child->setObjectName("Child widget");
+ child->setFocus();
+ widget->show();
+ QVERIFY(QTest::qWaitForWindowActive(widget.get()));
+
+ activeCount = focusObjectChangedSpy.count();
+ widget.reset();
+ // we might get more than one signal emission
+ QVERIFY(focusObjectChangedSpy.count() > activeCount);
+ QCOMPARE(focusObjectChangedSpy.last().last().value<QObject*>(), nullptr);
+}
+
QTEST_MAIN(tst_QWidget_window)
#include "tst_qwidget_window.moc"
diff --git a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
index 1b43961182..031856e0f9 100644
--- a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
+++ b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp
index 425380a99e..da417b377e 100644
--- a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp
+++ b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
-** 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) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp b/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp
index 2031c68708..fb959821bc 100644
--- a/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp
+++ b/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.cpp b/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.cpp
index d33f734af0..bb30f3fd43 100644
--- a/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.cpp
+++ b/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
index 9dead3d3ea..19c9606d79 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -75,6 +50,7 @@ private slots:
void testOwnership();
void testBehindTheScenesDeletion();
void testUnparenting();
+ void testReparenting();
void testUnparentReparent();
void testActivation();
void testAncestorChange();
@@ -231,12 +207,12 @@ void tst_QWindowContainer::testActivation()
void tst_QWindowContainer::testUnparenting()
{
- QWindow *window = new QWindow();
+ QPointer<QWindow> window(new QWindow());
QScopedPointer<QWidget> container(QWidget::createWindowContainer(window));
container->setWindowTitle(QTest::currentTestFunction());
container->setGeometry(m_availableGeometry.x() + 100, m_availableGeometry.y() + 100, 200, 100);
- window->setParent(0);
+ window->setParent(nullptr);
container->show();
@@ -244,6 +220,26 @@ void tst_QWindowContainer::testUnparenting()
// Window should not be made visible by container..
QVERIFY(!window->isVisible());
+
+ container.reset();
+ QVERIFY(window);
+ delete window;
+}
+
+void tst_QWindowContainer::testReparenting()
+{
+ QPointer<QWindow> window1(new QWindow());
+ QScopedPointer<QWindow> window2(new QWindow());
+ QScopedPointer<QWidget> container(QWidget::createWindowContainer(window1));
+
+ window1->setParent(window2.data());
+
+ // Not deleted with container
+ container.reset();
+ QVERIFY(window1);
+ // but deleted with new parent
+ window2.reset();
+ QVERIFY(!window1);
}
void tst_QWindowContainer::testUnparentReparent()
diff --git a/tests/auto/widgets/styles/CMakeLists.txt b/tests/auto/widgets/styles/CMakeLists.txt
index b1c9d1fce3..5d84d5e08a 100644
--- a/tests/auto/widgets/styles/CMakeLists.txt
+++ b/tests/auto/widgets/styles/CMakeLists.txt
@@ -3,7 +3,9 @@
if(APPLE)
add_subdirectory(qmacstyle)
endif()
-add_subdirectory(qstyle)
+if(QT_FEATURE_private_tests)
+ add_subdirectory(qstyle)
+endif()
add_subdirectory(qstyleoption)
if(QT_FEATURE_private_tests AND NOT ANDROID AND NOT QNX AND NOT UIKIT)
add_subdirectory(qstylesheetstyle)
diff --git a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
index fd784f9ced..458a108538 100644
--- a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
+++ b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index 0578d5ce70..fc182ae0f2 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -92,6 +67,11 @@ private slots:
void testProxyCalled();
void testStyleOptionInit();
+
+ void sliderPositionFromValue_data();
+ void sliderPositionFromValue();
+ void sliderValueFromPosition_data();
+ void sliderValueFromPosition();
private:
bool testAllFunctions(QStyle *);
bool testScrollBarSubControls(const QStyle *style);
@@ -662,5 +642,108 @@ void tst_QStyle::testStyleOptionInit()
}
}
+void tst_QStyle::sliderPositionFromValue_data()
+{
+ QTest::addColumn<int>("min");
+ QTest::addColumn<int>("max");
+ QTest::addColumn<int>("value");
+ QTest::addColumn<int>("span");
+ QTest::addColumn<bool>("upsideDown");
+ QTest::addColumn<int>("position");
+
+ QTest::addRow("no span") << 12 << 56 << 34 << 0 << false << 0;
+ QTest::addRow("no span inverse") << 12 << 56 << 34 << 0 << true << 0;
+
+ QTest::addRow("value too small") << 34 << 56 << 12 << 2000 << false << 0;
+ QTest::addRow("value too small inverse") << 34 << 56 << 12 << 2000 << true << 2000;
+
+ QTest::addRow("no-range") << 12 << 12 << 12 << 2000 << false << 0;
+ QTest::addRow("no-range-inverse") << 12 << 12 << 12 << 2000 << true << 0;
+
+ QTest::addRow("close-to-max") << 12 << 34 << 33 << 2000 << false << 1909;
+ QTest::addRow("at-max") << 12 << 34 << 34 << 2000 << false << 2000;
+ QTest::addRow("value too large") << 12 << 34 << 35 << 2000 << false << 2000;
+ QTest::addRow("close-to-max-inverse") << 12 << 34 << 33 << 2000 << true << 91;
+ QTest::addRow("at-max-inverse") << 12 << 34 << 34 << 2000 << true << 0;
+ QTest::addRow("value too large-inverse") << 12 << 34 << 35 << 2000 << true << 0;
+
+ QTest::addRow("big-range") << 100000 << 700000 << 250000 << 2000 << false << 500;
+ QTest::addRow("big-range-inverse") << 100000 << 700000 << 250000 << 2000 << true << 1500;
+
+ QTest::addRow("across-zero") << -1000 << 1000 << -500 << 100 << false << 25;
+ QTest::addRow("across-zero-inverse") << -1000 << 1000 << -500 << 100 << true << 75;
+
+ QTest::addRow("span>range") << 0 << 100 << 60 << 2000 << false << 1200;
+ QTest::addRow("span>range-inverse") << 0 << 100 << 60 << 2000 << true << 800;
+
+ QTest::addRow("overflow1 (QTBUG-101581)") << -1 << INT_MAX << 235 << 891 << false << 0;
+ QTest::addRow("overflow2") << INT_MIN << INT_MAX << 10 << 100 << false << 50;
+ QTest::addRow("overflow2-inverse") << INT_MIN << INT_MAX << 10 << 100 << true << 49;
+ QTest::addRow("overflow3") << INT_MIN << INT_MAX << -10 << 100 << false << 49;
+ QTest::addRow("overflow3-inverse") << INT_MIN << INT_MAX << -10 << 100 << true << 50;
+}
+
+void tst_QStyle::sliderPositionFromValue()
+{
+ QFETCH(int, min);
+ QFETCH(int, max);
+ QFETCH(int, value);
+ QFETCH(int, span);
+ QFETCH(bool, upsideDown);
+ QFETCH(int, position);
+
+ QCOMPARE(QStyle::sliderPositionFromValue(min, max, value, span, upsideDown), position);
+}
+
+void tst_QStyle::sliderValueFromPosition_data()
+{
+ QTest::addColumn<int>("min");
+ QTest::addColumn<int>("max");
+ QTest::addColumn<int>("position");
+ QTest::addColumn<int>("span");
+ QTest::addColumn<bool>("upsideDown");
+ QTest::addColumn<int>("value");
+
+ QTest::addRow("position zero") << 0 << 100 << 0 << 2000 << false << 0;
+ QTest::addRow("position zero inverse") << 0 << 100 << 0 << 2000 << true << 100;
+
+ QTest::addRow("span zero") << 0 << 100 << 1200 << 0 << false << 0;
+ QTest::addRow("span zero inverse") << 0 << 100 << 1200 << 0 << true << 100;
+
+ QTest::addRow("position > span") << -300 << -200 << 2 << 1 << false << -200;
+ QTest::addRow("position > span inverse") << -300 << -200 << 2 << 1 << true << -300;
+
+ QTest::addRow("large") << 0 << 100 << 1200 << 2000 << false << 60;
+ QTest::addRow("large-inverse") << 0 << 100 << 1200 << 2000 << true << 40;
+
+ QTest::addRow("normal") << 0 << 100 << 12 << 20 << false << 60;
+ QTest::addRow("inverse") << 0 << 100 << 12 << 20 << true << 40;
+
+ QTest::addRow("overflow1") << -1 << INT_MAX << 10 << 10 << false << INT_MAX;
+ QTest::addRow("overflow1-inverse") << -1 << INT_MAX << 10 << 10 << true << -1;
+ QTest::addRow("overflow2") << INT_MIN << INT_MAX << 5 << 10 << false << 0;
+ QTest::addRow("overflow2-inverse") << INT_MIN << INT_MAX << 5 << 10 << true << -1;
+ QTest::addRow("overflow3") << INT_MIN << 0 << 0 << 10 << false << INT_MIN;
+ QTest::addRow("overflow3-inverse") << INT_MIN << 0 << 0 << 10 << true << 0;
+
+ QTest::addRow("overflow4") << 0 << INT_MAX << INT_MAX/2-6 << INT_MAX/2-5 << false << INT_MAX-2;
+ QTest::addRow("overflow4-inverse") << 0 << INT_MAX << INT_MAX/2-6 << INT_MAX/2-5 << true << 2;
+
+ QTest::addRow("overflow5") << 0 << 4 << INT_MAX/4 << INT_MAX << false << 1;
+ QTest::addRow("overflow5-inverse") << 0 << 4 << INT_MAX/4 << INT_MAX << true << 3;
+}
+
+void tst_QStyle::sliderValueFromPosition()
+{
+ QFETCH(int, min);
+ QFETCH(int, max);
+ QFETCH(int, position);
+ QFETCH(int, span);
+ QFETCH(bool, upsideDown);
+ QFETCH(int, value);
+
+ QCOMPARE(QStyle::sliderValueFromPosition(min, max, position, span, upsideDown), value);
+}
+
QTEST_MAIN(tst_QStyle)
#include "tst_qstyle.moc"
diff --git a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp
index a08b251c35..1d20a9a42b 100644
--- a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp
+++ b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt b/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt
index bf4e52862c..fd66ed2a2c 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt
+++ b/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt
@@ -1,13 +1,15 @@
# Generated from qstylesheetstyle.pro.
-if(NOT QT_FEATURE_private_tests)
- return()
-endif()
-
#####################################################################
## tst_qstylesheetstyle Test:
#####################################################################
+# Resources:
+set(resources_resource_files
+ "images/testimage.png"
+ "images/testimage@2x.png"
+)
+
qt_internal_add_test(tst_qstylesheetstyle
SOURCES
tst_qstylesheetstyle.cpp
@@ -17,21 +19,9 @@ qt_internal_add_test(tst_qstylesheetstyle
Qt::TestPrivate
Qt::Widgets
Qt::WidgetsPrivate
+ TESTDATA ${resources_resource_files}
+ BUILTIN_TESTDATA
)
-# Resources:
-set(resources_resource_files
- "images/testimage.png"
- "images/testimage@2x.png"
-)
-
-qt_internal_add_resource(tst_qstylesheetstyle "resources"
- PREFIX
- "/"
- FILES
- ${resources_resource_files}
-)
-
-
#### Keys ignored in scope 1:.:.:qstylesheetstyle.pro:<TRUE>:
# _REQUIREMENTS = "qtConfig(private_tests)"
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 492b206019..82d48b1692 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtWidgets/QApplication>
#include <QtWidgets/QCheckBox>
@@ -984,7 +959,7 @@ void tst_QStyleSheetStyle::focusColors()
// ten pixels of the right color requires quite a many characters, as the
// majority of the pixels will have slightly different colors due to the
// anti-aliasing effect.
-#if !defined(Q_OS_WIN32) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
+#if !defined(Q_OS_WIN32) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU))
QSKIP("This is a fragile test which fails on many esoteric platforms because of focus problems"
" (for example, QTBUG-33959)."
"That doesn't mean that the feature doesn't work in practice.");
@@ -1220,20 +1195,31 @@ void tst_QStyleSheetStyle::tabAlignment()
void tst_QStyleSheetStyle::tabFont_data()
{
- QTest::addColumn<int>("pixelSize");
+ QTest::addColumn<QFont>("tabFont");
QTest::addColumn<QTabWidget::TabPosition>("tabPosition");
+ QTest::addColumn<bool>("closable");
- QTest::newRow("medium, horizontal") << 24 << QTabWidget::North;
- QTest::newRow("large, vertical") << 36 << QTabWidget::West;
-}
+ QFont medium;
+ medium.setPixelSize(24);
+ QFont large;
+ large.setPixelSize(36);
+ QFont bold;
+ bold.setBold(true);
-#include <QApplication>
+ QTest::newRow("medium, horizontal") << medium << QTabWidget::North << false;
+ QTest::newRow("large, vertical") << large << QTabWidget::West << false;
+ QTest::newRow("bold, horizontal, closable") << bold << QTabWidget::North << true;
+ QTest::newRow("bold, vertical, closable") << bold << QTabWidget::West << true;
+}
void tst_QStyleSheetStyle::tabFont()
{
- QFETCH(int, pixelSize);
+ QFETCH(QFont, tabFont);
QFETCH(QTabWidget::TabPosition, tabPosition);
+ QFETCH(bool, closable);
const bool vertical = tabPosition == QTabWidget::West || tabPosition == QTabWidget::East;
+ const QString tab0Text("Tab title");
+ const QString tab1Text("Very Long Tab title");
// macOS style centers tabs and messes up the test
QWindowsStyle windowsStyle;
@@ -1242,18 +1228,22 @@ void tst_QStyleSheetStyle::tabFont()
topLevel.setWindowTitle(QTest::currentTestFunction());
QTabWidget tabWidget;
tabWidget.setStyle(&windowsStyle);
- tabWidget.addTab(new QWidget,"Tab title");
tabWidget.setTabPosition(tabPosition);
+ tabWidget.addTab(new QWidget, tab0Text);
+ tabWidget.addTab(new QWidget, tab1Text);
QTabWidget styledWidget;
styledWidget.setStyle(&windowsStyle);
styledWidget.setTabPosition(tabPosition);
- styledWidget.addTab(new QWidget,"Tab title");
+ styledWidget.addTab(new QWidget, tab0Text);
+ styledWidget.addTab(new QWidget, tab1Text);
QTabBar *bar = tabWidget.tabBar();
QTabBar *styledBar = styledWidget.tabBar();
QVERIFY(bar && styledBar);
bar->setStyle(&windowsStyle);
+ bar->setTabsClosable(closable);
styledBar->setStyle(&windowsStyle);
+ styledBar->setTabsClosable(closable);
QBoxLayout box(vertical ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
box.addWidget(&tabWidget);
@@ -1265,22 +1255,36 @@ void tst_QStyleSheetStyle::tabFont()
topLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
+ const QFont defaultFont = tabWidget.font();
+ if (QFontMetrics(defaultFont).size(Qt::TextShowMnemonic, tab0Text).width() >=
+ QFontMetrics(tabFont).size(Qt::TextShowMnemonic, tab0Text).width()) {
+ QSKIP("The used font is not larger when bold");
+ }
+
const QRect defaultRect = bar->tabRect(0);
QCOMPARE(styledBar->tabRect(0), defaultRect);
- QFont font;
- font.setPointSize(pixelSize);
- tabWidget.setFont(font);
-
+ tabWidget.setFont(tabFont);
const QRect rectWithFont = bar->tabRect(0);
if (vertical)
QVERIFY(rectWithFont.height() > defaultRect.height());
else
QVERIFY(rectWithFont.width() > defaultRect.width());
- styledWidget.setStyleSheet(QString("QTabBar { font-size: %1pt; }").arg(pixelSize));
+ QString styleSheet = "QTabBar::tab:first {";
+ if (tabFont.pixelSize() != -1)
+ styleSheet += QString(" font-size: %1px;").arg(tabFont.pixelSize());
+ if (tabFont.bold())
+ styleSheet += " font-weight: bold;";
+ styleSheet += "}";
+
+ styledWidget.setStyleSheet(styleSheet);
const QRect rectWithStyle = styledBar->tabRect(0);
- QCOMPARE(rectWithStyle.size(), rectWithFont.size());
+
+ if (vertical)
+ QCOMPARE(rectWithStyle.height(), rectWithFont.height());
+ else
+ QCOMPARE(rectWithStyle.width(), rectWithFont.width());
}
void tst_QStyleSheetStyle::attributesList()
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index 51a75573a4..897608bca8 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtGui>
@@ -145,6 +120,7 @@ private slots:
void QTBUG_14292_filesystem();
void QTBUG_52028_tabAutoCompletes();
void QTBUG_51889_activatedSentTwice();
+ void showPopupInGraphicsView();
private:
void filter(bool assync = false);
@@ -1828,5 +1804,36 @@ void tst_QCompleter::QTBUG_51889_activatedSentTwice()
QTRY_COMPARE(activatedSpy.count(), 1);
}
+void tst_QCompleter::showPopupInGraphicsView()
+{
+ QGraphicsView view;
+ QGraphicsScene scene;
+ view.setScene(&scene);
+
+ QLineEdit lineEdit;
+ lineEdit.setCompleter(new QCompleter({"alpha", "omega", "omicron", "zeta"}));
+ scene.addWidget(&lineEdit);
+
+ view.move(view.screen()->availableGeometry().topLeft() + QPoint(10, 10));
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ // show popup under line edit
+ QTest::keyClick(&lineEdit, Qt::Key_A);
+ QVERIFY(lineEdit.completer()->popup());
+ QVERIFY(lineEdit.completer()->popup()->isVisible());
+ QCOMPARE(lineEdit.completer()->popup()->geometry().x(), lineEdit.mapToGlobal(QPoint(0, 0)).x());
+ QVERIFY(lineEdit.completer()->popup()->geometry().top() >= (lineEdit.mapToGlobal(QPoint(0, lineEdit.height() - 1)).y() - 1));
+
+ // move widget to the bottom of screen
+ lineEdit.clear();
+ int y = view.screen()->availableGeometry().height() - lineEdit.geometry().y();
+ view.move(view.geometry().x(), y);
+
+ // show popup above line edit
+ QTest::keyClick(&lineEdit, Qt::Key_A);
+ QVERIFY(lineEdit.completer()->popup()->geometry().bottom() < lineEdit.mapToGlobal(QPoint(0, 0)).y());
+}
+
QTEST_MAIN(tst_QCompleter)
#include "tst_qcompleter.moc"
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index e3789ab645..491d5d48e3 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the $MODULE$ 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 WITH Qt-GPL-exception-1.0
#include <QtGui>
#include <QtWidgets>
diff --git a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
index 952b9e5868..5348942857 100644
--- a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
+++ b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/CMakeLists.txt b/tests/auto/widgets/widgets/CMakeLists.txt
index c64b86b3de..37f819a48f 100644
--- a/tests/auto/widgets/widgets/CMakeLists.txt
+++ b/tests/auto/widgets/widgets/CMakeLists.txt
@@ -46,17 +46,14 @@ endif()
if(QT_FEATURE_shortcut)
add_subdirectory(qkeysequenceedit)
endif()
+add_subdirectory(qmenu)
+add_subdirectory(qlineedit)
if(NOT ANDROID)
- # QTBUG-87417 # special case
- add_subdirectory(qlineedit)
# QTBUG-87420 # special case
add_subdirectory(qmdiarea)
- # QTBUG-87671 # special case
- add_subdirectory(qmenu)
# QTBUG-87421 # special case
add_subdirectory(qmenubar)
endif()
-# QTBUG-87671 # special case
-if(QT_FEATURE_opengl AND NOT ANDROID)
+if(QT_FEATURE_opengl)
add_subdirectory(qopenglwidget)
endif()
diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
index c13e6a5420..ec916925a3 100644
--- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
+++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -42,6 +17,7 @@
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformtheme.h>
class tst_QAbstractButton : public QObject
{
@@ -81,6 +57,8 @@ private slots:
void keyNavigation();
#endif
+ void buttonPressKeys();
+
protected slots:
void onClicked();
void onToggled( bool on );
@@ -276,7 +254,13 @@ void tst_QAbstractButton::setAutoRepeat()
QCOMPARE(press_count, click_count);
QVERIFY(click_count > 1);
break;
- case 4:
+ case 4: {
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ if (buttonPressKeys.contains(Qt::Key_Enter)) {
+ QSKIP("platform theme has Key_Enter in ButtonPressKeys");
+ }
// check that pressing ENTER has no effect when autorepeat is false
testWidget->setDown( false );
testWidget->setAutoRepeat( false );
@@ -293,7 +277,14 @@ void tst_QAbstractButton::setAutoRepeat()
QVERIFY( click_count == 0 );
break;
- case 5:
+ }
+ case 5: {
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ if (buttonPressKeys.contains(Qt::Key_Enter)) {
+ QSKIP("platform theme has Key_Enter in ButtonPressKeys");
+ }
// check that pressing ENTER has no effect when autorepeat is true
testWidget->setDown( false );
testWidget->setAutoRepeat( true );
@@ -311,6 +302,7 @@ void tst_QAbstractButton::setAutoRepeat()
QVERIFY( click_count == 0 );
break;
+ }
case 6:
// verify autorepeat is off by default.
MyButton tmp( 0);
@@ -619,9 +611,9 @@ void tst_QAbstractButton::mouseReleased() // QTBUG-53244
QPointF posOutOfWidget = QPointF(30, 30);
QMouseEvent me(QEvent::MouseMove,
- posOutOfWidget, Qt::NoButton,
- Qt::MouseButtons(Qt::LeftButton),
- Qt::NoModifier); // mouse press and move
+ posOutOfWidget, button.mapToGlobal(posOutOfWidget),
+ Qt::NoButton, Qt::MouseButtons(Qt::LeftButton),
+ Qt::NoModifier); // mouse press and move
qApp->sendEvent(&button, &me);
// should emit released signal once mouse is dragging out of boundary
@@ -687,5 +679,16 @@ void tst_QAbstractButton::keyNavigation()
}
#endif
+void tst_QAbstractButton::buttonPressKeys()
+{
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ for (uint i = 0; i < buttonPressKeys.length(); ++i) {
+ QTest::keyClick(testWidget, buttonPressKeys[i]);
+ QCOMPARE(click_count, i + 1);
+ }
+}
+
QTEST_MAIN(tst_QAbstractButton)
#include "tst_qabstractbutton.moc"
diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp
index 9d7cc484cd..86c42a6522 100644
--- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp
+++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
index 7ab609a7ca..edca1954fd 100644
--- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp
index 6898cf18dc..6c3eaa5e9c 100644
--- a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp
+++ b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -39,15 +14,12 @@
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
+#include <memory>
class tst_QAbstractSpinBox : public QObject
{
Q_OBJECT
-public:
- tst_QAbstractSpinBox();
- virtual ~tst_QAbstractSpinBox();
-
private slots:
void initTestCase();
void cleanupTestCase();
@@ -64,32 +36,25 @@ private:
PlatformInputContext m_platformInputContext;
};
-tst_QAbstractSpinBox::tst_QAbstractSpinBox()
-{
-}
-
-tst_QAbstractSpinBox::~tst_QAbstractSpinBox()
-{
-}
-
class MyAbstractSpinBox : public QAbstractSpinBox
{
public:
- MyAbstractSpinBox() : QAbstractSpinBox() {}
- QLineEdit *lineEdit() { return QAbstractSpinBox::lineEdit(); }
- void setLineEdit(QLineEdit *le) { QAbstractSpinBox::setLineEdit(le); }
+ using QAbstractSpinBox::QAbstractSpinBox;
+
+ using QAbstractSpinBox::lineEdit;
+ using QAbstractSpinBox::setLineEdit;
};
void tst_QAbstractSpinBox::initTestCase()
{
- QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ auto *inputMethodPrivate = QInputMethodPrivate::get(QGuiApplication::inputMethod());
inputMethodPrivate->testContext = &m_platformInputContext;
}
void tst_QAbstractSpinBox::cleanupTestCase()
{
- QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
- inputMethodPrivate->testContext = 0;
+ auto *inputMethodPrivate = QInputMethodPrivate::get(QGuiApplication::inputMethod());
+ inputMethodPrivate->testContext = nullptr;
}
// Testing get/set functions
@@ -112,11 +77,12 @@ void tst_QAbstractSpinBox::getSetCheck()
// QLineEdit * QAbstractSpinBox::lineEdit()
// void QAbstractSpinBox::setLineEdit(QLineEdit *)
- QLineEdit *var3 = new QLineEdit(0);
+ auto *var3 = new QLineEdit(nullptr);
obj1.setLineEdit(var3);
QCOMPARE(var3, obj1.lineEdit());
-#ifndef QT_DEBUG
- obj1.setLineEdit((QLineEdit *)0); // Will assert in debug, so only test in release
+ // Will assert in debug, so only test in release
+#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
+ obj1.setLineEdit(nullptr);
QCOMPARE(var3, obj1.lineEdit()); // Setting 0 should keep the current editor
#endif
// delete var3; // No delete, since QAbstractSpinBox takes ownership
@@ -124,45 +90,38 @@ void tst_QAbstractSpinBox::getSetCheck()
void tst_QAbstractSpinBox::task183108_clear()
{
- QAbstractSpinBox *sbox;
-
- sbox = new QSpinBox;
+ auto sbox = std::make_unique<QSpinBox>();
sbox->clear();
sbox->show();
- qApp->processEvents();
+ QCoreApplication::processEvents();
QVERIFY(sbox->text().isEmpty());
- delete sbox;
- sbox = new QSpinBox;
+ sbox.reset(new QSpinBox);
sbox->clear();
sbox->show();
sbox->hide();
- qApp->processEvents();
+ QCoreApplication::processEvents();
QCOMPARE(sbox->text(), QString());
- delete sbox;
- sbox = new QSpinBox;
+ sbox.reset(new QSpinBox);
sbox->show();
sbox->clear();
- qApp->processEvents();
+ QCoreApplication::processEvents();
QCOMPARE(sbox->text(), QString());
- delete sbox;
- sbox = new QSpinBox;
+ sbox.reset(new QSpinBox);
sbox->show();
sbox->clear();
sbox->hide();
- qApp->processEvents();
+ QCoreApplication::processEvents();
QCOMPARE(sbox->text(), QString());
-
- delete sbox;
}
void tst_QAbstractSpinBox::task228728_cssselector()
{
//QAbstractSpinBox does some call to stylehint into his constructor.
//so while the stylesheet want to access property, it should not crash
- qApp->setStyleSheet("[alignment=\"1\"], [text=\"foo\"] { color:black; }" );
+ qApp->setStyleSheet(R"([alignment="1"], [text="foo"] { color:black; })");
QSpinBox box;
}
@@ -173,24 +132,23 @@ void tst_QAbstractSpinBox::inputMethodUpdate()
QSpinBox box;
- QSpinBox *testWidget = &box;
- testWidget->setRange(0, 1);
+ box.setRange(0, 1);
- QTestPrivate::centerOnScreen(testWidget);
- testWidget->clear();
- testWidget->show();
- QVERIFY(QTest::qWaitForWindowExposed(testWidget));
+ QTestPrivate::centerOnScreen(&box);
+ box.clear();
+ box.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&box));
- testWidget->activateWindow();
- testWidget->setFocus();
- QTRY_VERIFY(testWidget->hasFocus());
- QTRY_COMPARE(qApp->focusObject(), testWidget);
+ box.activateWindow();
+ box.setFocus();
+ QTRY_VERIFY(box.hasFocus());
+ QTRY_COMPARE(QGuiApplication::focusObject(), &box);
m_platformInputContext.m_updateCallCount = 0;
{
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event("1", attributes);
- QApplication::sendEvent(testWidget, &event);
+ QCoreApplication::sendEvent(&box, &event);
}
QVERIFY(m_platformInputContext.m_updateCallCount >= 1);
@@ -199,7 +157,7 @@ void tst_QAbstractSpinBox::inputMethodUpdate()
QList<QInputMethodEvent::Attribute> attributes;
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 1, QVariant());
QInputMethodEvent event("1", attributes);
- QApplication::sendEvent(testWidget, &event);
+ QCoreApplication::sendEvent(&box, &event);
}
QVERIFY(m_platformInputContext.m_updateCallCount >= 1);
@@ -208,17 +166,17 @@ void tst_QAbstractSpinBox::inputMethodUpdate()
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event("", attributes);
event.setCommitString("1");
- QApplication::sendEvent(testWidget, &event);
+ QCoreApplication::sendEvent(&box, &event);
}
QVERIFY(m_platformInputContext.m_updateCallCount >= 1);
- QCOMPARE(testWidget->value(), 1);
+ QCOMPARE(box.value(), 1);
m_platformInputContext.m_updateCallCount = 0;
{
QList<QInputMethodEvent::Attribute> attributes;
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant());
QInputMethodEvent event("", attributes);
- QApplication::sendEvent(testWidget, &event);
+ QCoreApplication::sendEvent(&box, &event);
}
QVERIFY(m_platformInputContext.m_updateCallCount >= 1);
}
diff --git a/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp
index 8ab2faab43..f95f017d6b 100644
--- a/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp
+++ b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
index 91da5dc69b..064b539f22 100644
--- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
+++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -290,6 +265,9 @@ void tst_QCalendarWidget::showPrevNext()
QFETCH(ShowFunc, function);
QFETCH(QDate, dateOrigin);
QFETCH(QDate, expectedDate);
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes sometimes on Android emulator, figure out why (QTBUG-102258)");
+#endif
QCalendarWidget calWidget;
calWidget.show();
diff --git a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp
index 33fb6b482a..b0b34ee3fa 100644
--- a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp
+++ b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 4146a6632d..4ca3a1b5a5 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
@@ -170,6 +145,8 @@ private slots:
void checkMenuItemPosWhenStyleSheetIsSet();
void checkEmbeddedLineEditWhenStyleSheetIsSet();
void propagateStyleChanges();
+ void buttonPressKeys();
+ void clearModel();
private:
PlatformInputContext m_platformInputContext;
@@ -1481,14 +1458,12 @@ void tst_QComboBox::setCurrentText()
else
QCOMPARE(testWidget->currentText(), QString("foo"));
-#ifndef QT_NO_PROPERTIES
// verify WRITE for currentText property
testWidget->setCurrentIndex(0);
const QByteArray n("currentText");
QCOMPARE(testWidget->property(n).toString(), QString("foo"));
testWidget->setProperty(n, QString("bar"));
QCOMPARE(testWidget->property(n).toString(), QString("bar"));
-#endif
}
void tst_QComboBox::currentTextChanged_data()
@@ -1653,6 +1628,16 @@ void tst_QComboBox::setModel()
QCOMPARE(box.rootModelIndex(), rootModelIndex);
box.setModel(box.model());
QCOMPARE(box.rootModelIndex(), rootModelIndex);
+
+ // check that setting the same model as the completer's doesn't crash
+ QCompleter *completer = new QCompleter(&box);
+ box.setEditable(true);
+ box.setCompleter(completer);
+ auto *listModel = new QStringListModel({ "one", "two" }, completer);
+ completer->setModel(listModel);
+ QCOMPARE(listModel->rowCount(), 2); // make sure it wasn't deleted
+ box.setModel(listModel);
+ QCOMPARE(listModel->rowCount(), 2); // make sure it wasn't deleted
}
void tst_QComboBox::setCustomModelAndView()
@@ -3590,5 +3575,56 @@ void tst_QComboBox::propagateStyleChanges()
QVERIFY(frameStyle.inquired);
}
+void tst_QComboBox::buttonPressKeys()
+{
+ QComboBox comboBox;
+ comboBox.setEditable(false);
+ comboBox.addItem(QString::number(1));
+ comboBox.addItem(QString::number(2));
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ for (int i = 0; i < buttonPressKeys.length(); ++i) {
+ QTest::keyClick(&comboBox, buttonPressKeys[i]);
+ // On some platforms, a window will not be immediately visible,
+ // but take some event-loop iterations to complete.
+ // Using QTRY_VERIFY to deal with that.
+ QTRY_VERIFY(comboBox.view()->isVisible());
+ comboBox.hidePopup();
+ }
+}
+
+void tst_QComboBox::clearModel()
+{
+ using namespace Qt::StringLiterals;
+ QStringListModel model({ "one"_L1, "two"_L1, "three"_L1 });
+
+ QComboBox combo;
+ combo.setModel(&model);
+ combo.setCurrentIndex(1);
+
+ QCOMPARE(combo.currentIndex(), 1);
+ QCOMPARE(combo.currentText(), model.index(1).data().toString());
+
+ QSignalSpy indexSpy(&combo, &QComboBox::currentIndexChanged);
+ QSignalSpy textSpy(&combo, &QComboBox::currentTextChanged);
+
+ QVERIFY(indexSpy.isEmpty());
+ QVERIFY(textSpy.isEmpty());
+
+ model.setStringList({});
+
+ QCOMPARE(indexSpy.count(), 1);
+ const int index = indexSpy.takeFirst().at(0).toInt();
+ QCOMPARE(index, -1);
+
+ QCOMPARE(textSpy.count(), 1);
+ const QString text = textSpy.takeFirst().at(0).toString();
+ QCOMPARE(text, QString());
+
+ QCOMPARE(combo.currentIndex(), -1);
+ QCOMPARE(combo.currentText(), QString());
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/widgets/widgets/qcommandlinkbutton/CMakeLists.txt b/tests/auto/widgets/widgets/qcommandlinkbutton/CMakeLists.txt
index dfb555673a..9c556296c0 100644
--- a/tests/auto/widgets/widgets/qcommandlinkbutton/CMakeLists.txt
+++ b/tests/auto/widgets/widgets/qcommandlinkbutton/CMakeLists.txt
@@ -9,5 +9,6 @@ qt_internal_add_test(tst_qcommandlinkbutton
tst_qcommandlinkbutton.cpp
PUBLIC_LIBRARIES
Qt::Gui
+ Qt::GuiPrivate
Qt::Widgets
)
diff --git a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
index 11bef2dc0d..6b02775786 100644
--- a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
+++ b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -40,6 +15,9 @@
#include <QGridLayout>
#include <QPainter>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformtheme.h>
+
class tst_QCommandLinkButton : public QObject
{
Q_OBJECT
@@ -226,6 +204,13 @@ void tst_QCommandLinkButton::setAutoRepeat()
// check that pressing ENTER has no effect
resetCounters();
testWidget->setDown( false );
+ // Skip after reset if ButtonPressKeys has Key_Enter
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ if (buttonPressKeys.contains(Qt::Key_Enter)) {
+ return;
+ }
testWidget->setAutoRepeat( false );
QTest::keyPress( testWidget, Qt::Key_Enter );
@@ -258,6 +243,14 @@ void tst_QCommandLinkButton::pressed()
QCOMPARE( press_count, (uint)1 );
QCOMPARE( release_count, (uint)1 );
+ // Skip if ButtonPressKeys has Key_Enter
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ if (buttonPressKeys.contains(Qt::Key_Enter)) {
+ return;
+ }
+
QTest::keyPress( testWidget,Qt::Key_Enter );
QCOMPARE( press_count, (uint)1 );
QCOMPARE( release_count, (uint)1 );
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index cc76bff416..354a5f182f 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qapplication.h>
#include <qgroupbox.h>
diff --git a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp
index 86928414c8..3008714576 100644
--- a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp
+++ b/tests/auto/widgets/widgets/qdial/tst_qdial.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -100,7 +75,7 @@ void tst_QDial::sliderMoved()
QPoint init(dial.width()/4, dial.height()/2);
- QMouseEvent pressevent(QEvent::MouseButtonPress, init,
+ QMouseEvent pressevent(QEvent::MouseButtonPress, init, dial.mapToGlobal(init),
Qt::LeftButton, Qt::LeftButton, {});
qApp->sendEvent(&dial, &pressevent);
@@ -110,7 +85,7 @@ void tst_QDial::sliderMoved()
{ //move on top of the slider
init = QPoint(dial.width()/2, dial.height()/4);
- QMouseEvent moveevent(QEvent::MouseMove, init,
+ QMouseEvent moveevent(QEvent::MouseMove, init, dial.mapToGlobal(init),
Qt::LeftButton, Qt::LeftButton, {});
qApp->sendEvent(&dial, &moveevent);
QCOMPARE( sliderspy.count(), 1);
@@ -120,14 +95,14 @@ void tst_QDial::sliderMoved()
{ //move on the right of the slider
init = QPoint(dial.width()*3/4, dial.height()/2);
- QMouseEvent moveevent(QEvent::MouseMove, init,
+ QMouseEvent moveevent(QEvent::MouseMove, init, dial.mapToGlobal(init),
Qt::LeftButton, Qt::LeftButton, {});
qApp->sendEvent(&dial, &moveevent);
QCOMPARE( sliderspy.count(), 2);
QCOMPARE( valuespy.count(), 0);
}
- QMouseEvent releaseevent(QEvent::MouseButtonRelease, init,
+ QMouseEvent releaseevent(QEvent::MouseButtonRelease, init, dial.mapToGlobal(init),
Qt::LeftButton, Qt::LeftButton, {});
qApp->sendEvent(&dial, &releaseevent);
QCOMPARE( valuespy.count(), 1); // valuechanged signal should be called at this point
diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index 2e7e248db7..c2a9f27295 100644
--- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
#include <QtWidgets/QPushButton>
diff --git a/tests/auto/widgets/widgets/qdockwidget/BLACKLIST b/tests/auto/widgets/widgets/qdockwidget/BLACKLIST
index 6a3b189939..8b7a126b4d 100644
--- a/tests/auto/widgets/widgets/qdockwidget/BLACKLIST
+++ b/tests/auto/widgets/widgets/qdockwidget/BLACKLIST
@@ -1,3 +1,27 @@
# QTBUG-87415
[task169808_setFloating]
android
+#
+# QDockWidget::isFloating() is flaky after state change on these OS
+[closeAndDelete]
+macos
+[floatingTabs]
+# QTBUG-103091
+qnx
+macos
+[closeAndDelete]
+b2qt
+[floatingTabs]
+macos b2qt arm android
+[closeAndDelete]
+b2qt
+[floatingTabs]
+arm
+[closeAndDelete]
+macos b2qt arm android
+[floatingTabs]
+arm
+[closeAndDelete]
+android
+[floatingTabs]
+android
diff --git a/tests/auto/widgets/widgets/qdockwidget/CMakeLists.txt b/tests/auto/widgets/widgets/qdockwidget/CMakeLists.txt
index adf48ddb11..6d54deca0b 100644
--- a/tests/auto/widgets/widgets/qdockwidget/CMakeLists.txt
+++ b/tests/auto/widgets/widgets/qdockwidget/CMakeLists.txt
@@ -8,6 +8,7 @@ qt_internal_add_test(tst_qdockwidget
SOURCES
tst_qdockwidget.cpp
PUBLIC_LIBRARIES
+ Qt::Core
Qt::CorePrivate
Qt::Gui
Qt::GuiPrivate
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index d726807b7c..2229f5da55 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -1,42 +1,26 @@
-/****************************************************************************
-**
-** 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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
-
#include <qaction.h>
#include <qdockwidget.h>
#include <qmainwindow.h>
+#include "private/qdockwidget_p.h"
+#include "private/qmainwindowlayout_p.h"
+#include <QAbstractButton>
#include <qlineedit.h>
#include <qtabbar.h>
#include <QScreen>
+#include <QTimer>
#include <QtGui/QPainter>
-#include "private/qdockwidget_p.h"
+#include <QLabel>
+
+#ifdef QT_BUILD_INTERNAL
+QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcQpaDockWidgets, "qt.widgets.dockwidgets");
+QT_END_NAMESPACE
+#endif
bool hasFeature(QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature)
{ return (dockwidget->features() & feature) == feature; }
@@ -70,6 +54,7 @@ private slots:
void restoreDockWidget();
void restoreStateWhileStillFloating();
void setWindowTitle();
+
// task specific tests:
void task165177_deleteFocusWidget();
void task169808_setFloating();
@@ -78,8 +63,75 @@ private slots:
void task258459_visibilityChanged();
void taskQTBUG_1665_closableChanged();
void taskQTBUG_9758_undockedGeometry();
+
+ // Dock area permissions for DockWidgets and DockWidgetGroupWindows
+ void dockPermissions();
+
+ // test floating tabs and item_tree consistency
+ void floatingTabs();
+
+ // test hide & show
+ void hideAndShow();
+
+ // test closing and deleting consistency
+ void closeAndDelete();
+
+private:
+ // helpers and consts for dockPermissions, hideAndShow, closeAndDelete
+#ifdef QT_BUILD_INTERNAL
+ void createTestWidgets(QMainWindow* &MainWindow, QPointer<QWidget> &cent, QPointer<QDockWidget> &d1, QPointer<QDockWidget> &d2) const;
+ void unplugAndResize(QMainWindow* MainWindow, QDockWidget* dw, QPoint home, QSize size) const;
+
+ static inline QPoint dragPoint(QDockWidget* dockWidget);
+ static inline QPoint home1(QMainWindow* MainWindow)
+ { return MainWindow->mapToGlobal(MainWindow->rect().topLeft() + QPoint(0.1 * MainWindow->width(), 0.1 * MainWindow->height())); }
+
+ static inline QPoint home2(QMainWindow* MainWindow)
+ { return MainWindow->mapToGlobal(MainWindow->rect().topLeft() + QPoint(0.6 * MainWindow->width(), 0.15 * MainWindow->height())); }
+
+ static inline QSize size1(QMainWindow* MainWindow)
+ { return QSize (0.2 * MainWindow->width(), 0.25 * MainWindow->height()); }
+
+ static inline QSize size2(QMainWindow* MainWindow)
+ { return QSize (0.1 * MainWindow->width(), 0.15 * MainWindow->height()); }
+
+ static inline QPoint dockPoint(QMainWindow* mw, Qt::DockWidgetArea area)
+ { return mw->mapToGlobal(qobject_cast<QMainWindowLayout*>(mw->layout())->dockWidgetAreaRect(area, QMainWindowLayout::Maximum).center()); }
+
+ bool checkFloatingTabs(QMainWindow* MainWindow, QPointer<QDockWidgetGroupWindow> &ftabs, const QList<QDockWidget*> &dwList = {}) const;
+
+ // move a dock widget
+ void moveDockWidget(QDockWidget* dw, QPoint to, QPoint from = QPoint()) const;
+
+ // Message handling for xcb error QTBUG 82059
+ static void xcbMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
+public:
+ bool xcbError = false;
+private:
+
+#ifdef QT_DEBUG
+ // Grace time between mouse events. Set to 400 for debugging.
+ const int waitingTime = 400;
+
+ // Waiting time before closing widgets successful test. Set to 20000 for debugging.
+ const int waitBeforeClose = 0;
+
+ // Enable logging
+ const bool dockWidgetLog = true;
+#else
+ const int waitingTime = 15;
+ const int waitBeforeClose = 0;
+ const bool dockWidgetLog = false;
+#endif // QT_DEBUG
+#endif // QT_BUILD_INTERNAL
+
};
+// Statics for xcb error / msg handler
+static tst_QDockWidget *qThis = nullptr;
+static void (*oldMessageHandler)(QtMsgType, const QMessageLogContext&, const QString&);
+#define QXCBVERIFY(cond) do { if (xcbError) QSKIP("Test skipped due to XCB error"); QVERIFY(cond); } while (0)
+
// Testing get/set functions
void tst_QDockWidget::getSetCheck()
{
@@ -446,6 +498,7 @@ void tst_QDockWidget::allowedAreas()
QVERIFY(!dw.isAreaAllowed(Qt::RightDockWidgetArea));
QVERIFY(dw.isAreaAllowed(Qt::TopDockWidgetArea));
QVERIFY(dw.isAreaAllowed(Qt::BottomDockWidgetArea));
+ //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea));
QCOMPARE(spy.count(), 1);
QCOMPARE(*static_cast<const Qt::DockWidgetAreas *>(spy.at(0).value(0).constData()),
dw.allowedAreas());
@@ -459,6 +512,7 @@ void tst_QDockWidget::allowedAreas()
QVERIFY(dw.isAreaAllowed(Qt::RightDockWidgetArea));
QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea));
QVERIFY(!dw.isAreaAllowed(Qt::BottomDockWidgetArea));
+ //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea));
QCOMPARE(spy.count(), 1);
QCOMPARE(*static_cast<const Qt::DockWidgetAreas *>(spy.at(0).value(0).constData()),
dw.allowedAreas());
@@ -472,6 +526,22 @@ void tst_QDockWidget::allowedAreas()
QVERIFY(!dw.isAreaAllowed(Qt::RightDockWidgetArea));
QVERIFY(dw.isAreaAllowed(Qt::TopDockWidgetArea));
QVERIFY(!dw.isAreaAllowed(Qt::BottomDockWidgetArea));
+ //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(*static_cast<const Qt::DockWidgetAreas *>(spy.at(0).value(0).constData()),
+ dw.allowedAreas());
+ spy.clear();
+ dw.setAllowedAreas(dw.allowedAreas());
+ QCOMPARE(spy.count(), 0);
+
+ //dw.setAllowedAreas(Qt::BottomDockWidgetArea | Qt::FloatingDockWidgetArea);
+ dw.setAllowedAreas(Qt::BottomDockWidgetArea);
+ //QCOMPARE(dw.allowedAreas(), Qt::BottomDockWidgetArea | Qt::FloatingDockWidgetArea);
+ QVERIFY(!dw.isAreaAllowed(Qt::LeftDockWidgetArea));
+ QVERIFY(!dw.isAreaAllowed(Qt::RightDockWidgetArea));
+ QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea));
+ QVERIFY(dw.isAreaAllowed(Qt::BottomDockWidgetArea));
+ //QVERIFY(dw.isAreaAllowed(Qt::FloatingDockWidgetArea));
QCOMPARE(spy.count(), 1);
QCOMPARE(*static_cast<const Qt::DockWidgetAreas *>(spy.at(0).value(0).constData()),
dw.allowedAreas());
@@ -485,6 +555,7 @@ void tst_QDockWidget::allowedAreas()
QVERIFY(dw.isAreaAllowed(Qt::RightDockWidgetArea));
QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea));
QVERIFY(dw.isAreaAllowed(Qt::BottomDockWidgetArea));
+ //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea));
QCOMPARE(spy.count(), 1);
QCOMPARE(*static_cast<const Qt::DockWidgetAreas *>(spy.at(0).value(0).constData()),
dw.allowedAreas());
@@ -1046,5 +1117,487 @@ void tst_QDockWidget::setWindowTitle()
QCOMPARE(dock2.windowTitle(), dock2Title);
}
+// helpers for dockPermissions, hideAndShow, closeAndDelete
+#ifdef QT_BUILD_INTERNAL
+void tst_QDockWidget::createTestWidgets(QMainWindow* &mainWindow, QPointer<QWidget> &cent, QPointer<QDockWidget> &d1, QPointer<QDockWidget> &d2) const
+{
+ // Enable logging if required
+ if (dockWidgetLog)
+ QLoggingCategory::setFilterRules("qt.widgets.dockwidgets=true");
+
+ // Derive sizes and positions from primary screen
+ const QRect screen = QApplication::primaryScreen()->availableGeometry();
+ const QPoint m_topLeft = screen.topLeft();
+ const QSize s_mwindow = QApplication::primaryScreen()->availableSize() * 0.7;
+
+ mainWindow = new QMainWindow;
+ mainWindow->setMouseTracking(true);
+ mainWindow->setFixedSize(s_mwindow);
+ cent = new QWidget;
+ mainWindow->setCentralWidget(cent);
+ cent->setLayout(new QGridLayout);
+ cent->layout()->setContentsMargins(0, 0, 0, 0);
+ cent->setMinimumSize(0, 0);
+ mainWindow->setDockOptions(QMainWindow::AllowTabbedDocks | QMainWindow::GroupedDragging);
+ mainWindow->move(m_topLeft);
+
+ d1 = new QDockWidget(mainWindow);
+ d1->setWindowTitle("I am D1");
+ d1->setObjectName("D1");
+ d1->setFeatures(QDockWidget::DockWidgetFeatureMask);
+ d1->setAllowedAreas(Qt::DockWidgetArea::AllDockWidgetAreas);
+
+ d2 = new QDockWidget(mainWindow);
+ d2->setWindowTitle("I am D2");
+ d2->setObjectName("D2");
+ d2->setFeatures(QDockWidget::DockWidgetFeatureMask);
+ d2->setAllowedAreas(Qt::DockWidgetArea::RightDockWidgetArea);
+
+ mainWindow->addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, d1);
+ mainWindow->addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, d2);
+ d1->show();
+ d2->show();
+ mainWindow->show();
+ QApplication::setActiveWindow(mainWindow);
+
+}
+
+QPoint tst_QDockWidget::dragPoint(QDockWidget* dockWidget)
+{
+ Q_ASSERT(dockWidget);
+ QDockWidgetLayout *dwlayout = qobject_cast<QDockWidgetLayout *>(dockWidget->layout());
+ Q_ASSERT(dwlayout);
+ return dockWidget->mapToGlobal(dwlayout->titleArea().center());
+}
+
+void tst_QDockWidget::moveDockWidget(QDockWidget* dw, QPoint to, QPoint from) const
+{
+ Q_ASSERT(dw);
+
+ // If no from point is given, use the drag point
+ if (from.isNull())
+ from = dragPoint(dw);
+
+ // move and log
+ const QPoint source = dw->mapFromGlobal(from);
+ const QPoint target = dw->mapFromGlobal(to);
+ qCDebug(lcQpaDockWidgets) << "Move" << dw->objectName() << "from" << source;
+ qCDebug(lcQpaDockWidgets) << "Move" << dw->objectName() << "from" << from;
+ QTest::mousePress(dw, Qt::LeftButton, Qt::KeyboardModifiers(), source);
+ QTest::mouseMove(dw, target);
+ qCDebug(lcQpaDockWidgets) << "Move" << dw->objectName() << "to" << target;
+ qCDebug(lcQpaDockWidgets) << "Move" << dw->objectName() << "to" << to;
+ QTest::mouseRelease(dw, Qt::LeftButton, Qt::KeyboardModifiers(), target);
+ QTest::qWait(waitingTime);
+
+ // Verify WindowActive only for floating dock widgets
+ if (dw->isFloating())
+ QTRY_VERIFY(QTest::qWaitForWindowActive(dw));
+}
+
+void tst_QDockWidget::unplugAndResize(QMainWindow* mainWindow, QDockWidget* dw, QPoint home, QSize size) const
+{
+ Q_ASSERT(mainWindow);
+ Q_ASSERT(dw);
+
+ // Return if floating
+ if (dw->isFloating())
+ return;
+
+ QMainWindowLayout* layout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
+ Qt::DockWidgetArea area = layout->dockWidgetArea(dw);
+
+ // calculate minimum lateral move to unplug a dock widget
+ const int unplugMargin = 80;
+ int my = 0;
+ int mx = 0;
+
+ switch (area) {
+ case Qt::LeftDockWidgetArea:
+ mx = unplugMargin;
+ break;
+ case Qt::TopDockWidgetArea:
+ my = unplugMargin;
+ break;
+ case Qt::RightDockWidgetArea:
+ mx = -unplugMargin;
+ break;
+ case Qt::BottomDockWidgetArea:
+ my = -unplugMargin;
+ break;
+ default:
+ return;
+ }
+
+ // unplug and resize a dock Widget
+ qCDebug(lcQpaDockWidgets) << "*** unplug and resize" << dw->objectName();
+ QPoint pos1 = dw->mapToGlobal(dw->rect().center());
+ pos1.rx() += mx;
+ pos1.ry() += my;
+ moveDockWidget(dw, pos1, dw->mapToGlobal(dw->rect().center()));
+ //QTest::mousePress(dw, Qt::LeftButton, Qt::KeyboardModifiers(), dw->mapFromGlobal(pos1));
+ QTRY_VERIFY(dw->isFloating());
+
+ qCDebug(lcQpaDockWidgets) << "Resizing" << dw->objectName() << "to" << size;
+ dw->setFixedSize(size);
+ QTest::qWait(waitingTime);
+ qCDebug(lcQpaDockWidgets) << "Move" << dw->objectName() << "to its home" << dw->mapFromGlobal(home);
+ dw->move(home);
+ //moveDockWidget(dw, home);
+}
+
+bool tst_QDockWidget::checkFloatingTabs(QMainWindow* mainWindow, QPointer<QDockWidgetGroupWindow> &ftabs, const QList<QDockWidget*> &dwList) const
+{
+ Q_ASSERT(mainWindow);
+
+ // Check if mainWindow has a floatingTab child
+ ftabs = mainWindow->findChild<QDockWidgetGroupWindow*>();
+ if (ftabs.isNull()) {
+ qCDebug(lcQpaDockWidgets) << "MainWindow has no DockWidgetGroupWindow" << mainWindow;
+ return false;
+ }
+
+ QTabBar* tab = ftabs->findChild<QTabBar*>();
+ if (!tab) {
+ qCDebug(lcQpaDockWidgets) << "DockWidgetGroupWindow has no tab bar" << ftabs;
+ return false;
+ }
+
+ // both dock widgets must be direct children of the main window
+ const QList<QDockWidget*> children = ftabs->findChildren<QDockWidget*>(QString(), Qt::FindDirectChildrenOnly);
+ if (dwList.count() > 0)
+ {
+ if (dwList.count() != children.count()) {
+ qCDebug(lcQpaDockWidgets) << "Expected DockWidgetGroupWindow children:" << dwList.count()
+ << "Children found:" << children.count();
+
+ qCDebug(lcQpaDockWidgets) << "Expected:" << dwList;
+ qCDebug(lcQpaDockWidgets) << "Found in" << ftabs << ":" << children.count();
+ return false;
+ }
+
+ for (const QDockWidget* child : dwList) {
+ if (!children.contains(child)) {
+ qCDebug(lcQpaDockWidgets) << "Expected child" << child << "not found in" << children;
+ return false;
+ }
+ }
+ }
+
+ // Always select first tab position
+ qCDebug(lcQpaDockWidgets) << "click on first tab";
+ QTest::mouseClick(tab, Qt::LeftButton, Qt::KeyboardModifiers(), tab->tabRect(0).center());
+ return true;
+}
+
+// detect xcb error
+// qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window
+void tst_QDockWidget::xcbMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+{
+ Q_ASSERT(oldMessageHandler);
+
+ if (type == QtWarningMsg && QString(context.category) == "qt.qpa.xcb" && msg.contains("internal error")) {
+ Q_ASSERT(qThis);
+ qThis->xcbError = true;
+ }
+
+ return oldMessageHandler(type, context, msg);
+}
+
+#endif // QT_BUILD_INTERNAL
+
+// test floating tabs and item_tree consistency
+void tst_QDockWidget::floatingTabs()
+{
+#ifdef Q_OS_WIN
+ QSKIP("Test skipped on Windows platforms");
+#endif // Q_OS_WIN
+#ifdef QT_BUILD_INTERNAL
+ // Create a mainwindow with a central widget and two dock widgets
+ QPointer<QDockWidget> d1;
+ QPointer<QDockWidget> d2;
+ QPointer<QWidget> cent;
+ QMainWindow* mainWindow;
+ createTestWidgets(mainWindow, cent, d1, d2);
+ std::unique_ptr<QMainWindow> up_mainWindow(mainWindow);
+
+ /*
+ * unplug both dockwidgets, resize them and plug them into a joint floating tab
+ * expected behavior: QDOckWidgetGroupWindow with both widgets is created
+ */
+
+ // remember paths to d1 and d2
+ QMainWindowLayout* layout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
+ const QList<int> path1 = layout->layoutState.indexOf(d1);
+ const QList<int> path2 = layout->layoutState.indexOf(d2);
+
+ // unplug and resize both dock widgets
+ unplugAndResize(mainWindow, d1, home1(mainWindow), size1(mainWindow));
+ unplugAndResize(mainWindow, d2, home2(mainWindow), size2(mainWindow));
+
+ // Test plugging
+ qCDebug(lcQpaDockWidgets) << "*** move d1 dock over d2 dock ***";
+ qCDebug(lcQpaDockWidgets) << "**********(test plugging)*************";
+ qCDebug(lcQpaDockWidgets) << "Move d1 over d2";
+ moveDockWidget(d1, d2->mapToGlobal(d2->rect().center()));
+
+ // Both dock widgets must no longer be floating
+ // disabled due to flakiness on macOS and Windows
+ //QTRY_VERIFY(!d1->isFloating());
+ //QTRY_VERIFY(!d2->isFloating());
+ if (d1->isFloating())
+ qWarning("OS flakiness: D1 is docked and reports being floating");
+ if (d2->isFloating())
+ qWarning("OS flakiness: D2 is docked and reports being floating");
+
+ // Now MainWindow has to have a floatingTab child
+ QPointer<QDockWidgetGroupWindow> ftabs;
+ QTRY_VERIFY(checkFloatingTabs(mainWindow, ftabs, QList<QDockWidget*>() << d1 << d2));
+
+ /*
+ * replug both dock widgets into their initial position
+ * expected behavior: both docks are plugged and no longer floating
+ */
+
+
+ // limitation: QTest cannot handle drag to unplug.
+ // reason: Object under mouse mutates from QTabBar::tab to QDockWidget. QTest cannot handle that.
+ // => click float button to unplug
+ qCDebug(lcQpaDockWidgets) << "*** test unplugging from floating dock ***";
+
+ // QDockWidget must have a QAbstractButton with object name "qt_dockwidget_floatbutton"
+ QAbstractButton* floatButton = d1->findChild<QAbstractButton*>("qt_dockwidget_floatbutton", Qt::FindDirectChildrenOnly);
+ QTRY_VERIFY(floatButton != nullptr);
+ QPoint pos1 = floatButton->rect().center();
+ qCDebug(lcQpaDockWidgets) << "unplug d1" << pos1;
+ QTest::mouseClick(floatButton, Qt::LeftButton, Qt::KeyboardModifiers(), pos1);
+ QTest::qWait(waitingTime);
+
+ // d1 must be floating again, while d2 is still in its GroupWindow
+ QTRY_VERIFY(d1->isFloating());
+ QTRY_VERIFY(!d2->isFloating());
+
+ // Plug back into dock areas
+ qCDebug(lcQpaDockWidgets) << "*** test plugging back to dock areas ***";
+ qCDebug(lcQpaDockWidgets) << "Move d1 to left dock";
+ //moveDockWidget(d1, d1->mapFrom(MainWindow, dockPoint(MainWindow, Qt::LeftDockWidgetArea)));
+ moveDockWidget(d1, dockPoint(mainWindow, Qt::LeftDockWidgetArea));
+ qCDebug(lcQpaDockWidgets) << "Move d2 to right dock";
+ moveDockWidget(d2, dockPoint(mainWindow, Qt::RightDockWidgetArea));
+
+ qCDebug(lcQpaDockWidgets) << "Waiting" << waitBeforeClose << "ms before plugging back.";
+ QTest::qWait(waitBeforeClose);
+
+ // Both dock widgets must no longer be floating
+ QTRY_VERIFY(!d1->isFloating());
+ QTRY_VERIFY(!d2->isFloating());
+
+ // check if QDockWidgetGroupWindow has been removed from mainWindowLayout and properly deleted
+ QTRY_VERIFY(!mainWindow->findChild<QDockWidgetGroupWindow*>());
+ QTRY_VERIFY(ftabs.isNull());
+
+ // Check if paths are consistent
+ qCDebug(lcQpaDockWidgets) << "Checking path consistency" << layout->layoutState.indexOf(d1) << layout->layoutState.indexOf(d2);
+
+ // Path1 must be identical
+ QTRY_VERIFY(path1 == layout->layoutState.indexOf(d1));
+
+ // d1 must have a gap item due to size change
+ QTRY_VERIFY(layout->layoutState.indexOf(d2) == QList<int>() << path2 << 0);
+#else
+ QSKIP("test requires -developer-build option");
+#endif // QT_BUILD_INTERNAL
+}
+
+// test hide & show
+void tst_QDockWidget::hideAndShow()
+{
+#ifdef QT_BUILD_INTERNAL
+ // Skip test if xcb error is launched
+ qThis = this;
+ oldMessageHandler = qInstallMessageHandler(xcbMessageHandler);
+ auto resetMessageHandler = qScopeGuard([] { qInstallMessageHandler(oldMessageHandler); });
+
+ // Create a mainwindow with a central widget and two dock widgets
+ QPointer<QDockWidget> d1;
+ QPointer<QDockWidget> d2;
+ QPointer<QWidget> cent;
+ QMainWindow* mainWindow;
+ createTestWidgets(mainWindow, cent, d1, d2);
+ std::unique_ptr<QMainWindow> up_mainWindow(mainWindow);
+
+ // Check hiding of docked widgets
+ qCDebug(lcQpaDockWidgets) << "Hiding mainWindow with plugged dock widgets" << mainWindow;
+ mainWindow->hide();
+ QXCBVERIFY(!mainWindow->isVisible());
+ QXCBVERIFY(!d1->isVisible());
+ QXCBVERIFY(!d2->isVisible());
+
+ // Check showing everything again
+ qCDebug(lcQpaDockWidgets) << "Showing mainWindow with plugged dock widgets" << mainWindow;
+ mainWindow->show();
+ QXCBVERIFY(QTest::qWaitForWindowActive(mainWindow));
+ QXCBVERIFY(QTest::qWaitForWindowExposed(mainWindow));
+ QXCBVERIFY(mainWindow->isVisible());
+ QXCBVERIFY(QTest::qWaitForWindowActive(d1));
+ QXCBVERIFY(d1->isVisible());
+ QXCBVERIFY(QTest::qWaitForWindowActive(d2));
+ QXCBVERIFY(d2->isVisible());
+
+ // in case of XCB errors, unplugAndResize will block and cause the test to time out.
+ // => force skip
+ QTest::qWait(waitingTime);
+ if (xcbError)
+ QSKIP("Test skipped due to XCB error");
+
+ // unplug and resize both dock widgets
+ unplugAndResize(mainWindow, d1, home1(mainWindow), size1(mainWindow));
+ unplugAndResize(mainWindow, d2, home2(mainWindow), size2(mainWindow));
+
+ // Check hiding of undocked widgets
+ qCDebug(lcQpaDockWidgets) << "Hiding mainWindow with unplugged dock widgets" << mainWindow;
+ mainWindow->hide();
+ QTRY_VERIFY(!mainWindow->isVisible());
+ QTRY_VERIFY(d1->isVisible());
+ QTRY_VERIFY(d2->isVisible());
+ d1->hide();
+ d2->hide();
+ QTRY_VERIFY(!d1->isVisible());
+ QTRY_VERIFY(!d2->isVisible());
+
+ qCDebug(lcQpaDockWidgets) << "Waiting" << waitBeforeClose << "ms before closing.";
+ QTest::qWait(waitBeforeClose);
+#else
+ QSKIP("test requires -developer-build option");
+#endif // QT_BUILD_INTERNAL
+}
+
+// test closing and deleting consistency
+void tst_QDockWidget::closeAndDelete()
+{
+#ifdef QT_BUILD_INTERNAL
+ // Create a mainwindow with a central widget and two dock widgets
+ QPointer<QDockWidget> d1;
+ QPointer<QDockWidget> d2;
+ QPointer<QWidget> cent;
+ QMainWindow* mainWindow;
+ createTestWidgets(mainWindow, cent, d1, d2);
+ std::unique_ptr<QMainWindow> up_mainWindow(mainWindow);
+
+ // unplug and resize both dock widgets
+ unplugAndResize(mainWindow, d1, home1(mainWindow), size1(mainWindow));
+ unplugAndResize(mainWindow, d2, home2(mainWindow), size2(mainWindow));
+
+ // Create a floating tab and unplug it again
+ qCDebug(lcQpaDockWidgets) << "Move d1 over d2";
+ moveDockWidget(d1, d2->mapToGlobal(d2->rect().center()));
+
+ // Both dock widgets must no longer be floating
+ // disabled due to flakiness on macOS and Windows
+ //QTRY_VERIFY(!d1->isFloating());
+ //QTRY_VERIFY(!d2->isFloating());
+ if (d1->isFloating())
+ qWarning("OS flakiness: D1 is docked and reports being floating");
+ if (d2->isFloating())
+ qWarning("OS flakiness: D2 is docked and reports being floating");
+
+ // Close everything with a single shot. Expected behavior: Event loop stops
+ bool eventLoopStopped = true;
+ QTimer::singleShot(0, this, [mainWindow, d1, d2] {
+ mainWindow->close();
+ QTRY_VERIFY(!mainWindow->isVisible());
+ QTRY_VERIFY(d1->isVisible());
+ QTRY_VERIFY(d2->isVisible());
+ d1->close();
+ d2->close();
+ QTRY_VERIFY(!d1->isVisible());
+ QTRY_VERIFY(!d2->isVisible());
+ });
+
+ // Fallback timer to report event loop still running
+ QTimer::singleShot(100, this, [&eventLoopStopped] {
+ qCDebug(lcQpaDockWidgets) << "Last dock widget hasn't shout down event loop!";
+ eventLoopStopped = false;
+ QApplication::quit();
+ });
+
+ QApplication::exec();
+
+ QTRY_VERIFY(eventLoopStopped);
+
+ // Check heap cleanup
+ qCDebug(lcQpaDockWidgets) << "Deleting mainWindow";
+ up_mainWindow.reset();
+ QTRY_VERIFY(d1.isNull());
+ QTRY_VERIFY(d2.isNull());
+ QTRY_VERIFY(cent.isNull());
+#else
+ QSKIP("test requires -developer-build option");
+#endif // QT_BUILD_INTERNAL
+}
+
+// Test dock area permissions
+void tst_QDockWidget::dockPermissions()
+{
+#ifdef Q_OS_WIN
+ QSKIP("Test skipped on Windows platforms");
+#endif // Q_OS_WIN
+#ifdef QT_BUILD_INTERNAL
+ // Create a mainwindow with a central widget and two dock widgets
+ QPointer<QDockWidget> d1;
+ QPointer<QDockWidget> d2;
+ QPointer<QWidget> cent;
+ QMainWindow* mainWindow;
+ createTestWidgets(mainWindow, cent, d1, d2);
+ std::unique_ptr<QMainWindow> up_mainWindow(mainWindow);
+
+ /*
+ * Unplug both dock widgets from their dock areas and hover them over each other
+ * expected behavior:
+ * - d2 hovering over d1 does nothing as d2 can only use right dock
+ * - hovering d2 over top, left and bottom dock area will do nothing due to lacking permissions
+ * - d1 hovering over d2 will create floating tabs as d1 has permission for DockWidgetArea::FloatingDockWidgetArea
+ * - resizing and tab creation will add two gap items in the right dock (d2)
+ */
+
+ // unplug and resize both dock widgets
+ unplugAndResize(mainWindow, d1, home1(mainWindow), size1(mainWindow));
+ unplugAndResize(mainWindow, d2, home2(mainWindow), size2(mainWindow));
+
+ // both dock widgets must be direct children of the main window
+ {
+ const QList<QDockWidget*> children = mainWindow->findChildren<QDockWidget*>(QString(), Qt::FindDirectChildrenOnly);
+ QTRY_VERIFY(children.count() == 2);
+ for (const QDockWidget* child : children)
+ QTRY_VERIFY(child == d1 || child == d2);
+ }
+
+ // The main window must not contain floating tabs
+ QTRY_VERIFY(mainWindow->findChild<QDockWidgetGroupWindow*>() == nullptr);
+
+ // Test unpermitted dock areas with d2
+ qCDebug(lcQpaDockWidgets) << "*** move d2 to forbidden docks ***";
+
+ // Move d2 to non allowed dock areas and verify it remains floating
+ qCDebug(lcQpaDockWidgets) << "Move d2 to top dock";
+ moveDockWidget(d2, dockPoint(mainWindow, Qt::TopDockWidgetArea));
+ QTRY_VERIFY(d2->isFloating());
+
+ qCDebug(lcQpaDockWidgets) << "Move d2 to left dock";
+ //moveDockWidget(d2, d2->mapFrom(MainWindow, dockPoint(MainWindow, Qt::LeftDockWidgetArea)));
+ moveDockWidget(d2, dockPoint(mainWindow, Qt::LeftDockWidgetArea));
+ QTRY_VERIFY(d2->isFloating());
+
+ qCDebug(lcQpaDockWidgets) << "Move d2 to bottom dock";
+ moveDockWidget(d2, dockPoint(mainWindow, Qt::BottomDockWidgetArea));
+ QTRY_VERIFY(d2->isFloating());
+
+ qCDebug(lcQpaDockWidgets) << "Waiting" << waitBeforeClose << "ms before closing.";
+ QTest::qWait(waitBeforeClose);
+#else
+ QSKIP("test requires -developer-build option");
+#endif // QT_BUILD_INTERNAL
+}
+
QTEST_MAIN(tst_QDockWidget)
#include "tst_qdockwidget.moc"
diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
index dd67de2287..3d7eece17a 100644
--- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp
index d273d77e35..92038cfa3a 100644
--- a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp
+++ b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
index a521b96e21..6a0749d7e3 100644
--- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
+++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qframe/BLACKLIST b/tests/auto/widgets/widgets/qframe/BLACKLIST
deleted file mode 100644
index 3a28dd1239..0000000000
--- a/tests/auto/widgets/widgets/qframe/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-# QTBUG-69064
-[testPainting]
-android
diff --git a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
index b5272f6b1a..40cb897ed1 100644
--- a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
+++ b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-** 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.
+// Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QFrame>
@@ -173,7 +148,16 @@ void tst_QFrame::testPainting()
frame.setMidLineWidth(midLineWidth);
frame.resize(16, 16);
- const QPixmap pixmap = frame.grab();
+ QPixmap pixmap = frame.grab();
+#ifdef Q_OS_ANDROID
+ // QPixmap is created with system's default format, which is
+ // ARGB32_Premultiplied for Android. For desktop systems the format is
+ // RGB32, so that's also the format of the images in resources. So on
+ // Android we need to explicitly convert the pixmap to a proper format.
+ QImage img = pixmap.toImage();
+ QVERIFY(img.reinterpretAsFormat(QImage::Format_RGB32));
+ pixmap = QPixmap::fromImage(img);
+#endif
const QString fileName = QLatin1String("images/") + basename + QLatin1Char('_')
+ QString::number(lineWidth) + QLatin1Char('_') + QString::number(midLineWidth)
diff --git a/tests/auto/widgets/widgets/qgroupbox/CMakeLists.txt b/tests/auto/widgets/widgets/qgroupbox/CMakeLists.txt
index ed08cce5f2..56079857a8 100644
--- a/tests/auto/widgets/widgets/qgroupbox/CMakeLists.txt
+++ b/tests/auto/widgets/widgets/qgroupbox/CMakeLists.txt
@@ -9,5 +9,6 @@ qt_internal_add_test(tst_qgroupbox
tst_qgroupbox.cpp
PUBLIC_LIBRARIES
Qt::Gui
+ Qt::GuiPrivate
Qt::Widgets
)
diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
index b9def66f7c..6c42baf147 100644
--- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
+++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -36,6 +11,9 @@
#include <QDialog>
#include <QSignalSpy>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformtheme.h>
+
#include "qgroupbox.h"
class tst_QGroupBox : public QObject
@@ -70,6 +48,7 @@ private slots:
void propagateFocus();
void task_QTBUG_19170_ignoreMouseReleaseEvent();
void task_QTBUG_15519_propagateMouseEvents();
+ void buttonPressKeys();
private:
bool checked;
@@ -611,10 +590,25 @@ void tst_QGroupBox::task_QTBUG_15519_propagateMouseEvents()
QCOMPARE(parent.mouseMoved, true);
}
+void tst_QGroupBox::buttonPressKeys()
+{
+ QGroupBox groupBox;
+ groupBox.setCheckable(true);
+ QSignalSpy clickedSpy(&groupBox, &QGroupBox::clicked);
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ for (int i = 0; i < buttonPressKeys.length(); ++i) {
+ QTest::keyClick(&groupBox, buttonPressKeys[i]);
+ QCOMPARE(clickedSpy.length(), i + 1);
+ }
+}
+
void tst_QGroupBox::sendMouseMoveEvent(QWidget *widget, const QPoint &localPos)
{
// Send a MouseMove event without actually moving the pointer
- QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ QMouseEvent event(QEvent::MouseMove, localPos, widget->mapToGlobal(localPos),
+ Qt::NoButton, Qt::NoButton, Qt::NoModifier);
QApplication::sendEvent(widget, &event);
}
diff --git a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
index 1a0532ffa4..14649fc345 100644
--- a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
+++ b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index 1af61e9ec6..3441e6296d 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -575,7 +550,8 @@ void tst_QLabel::taskQTBUG_7902_contextMenuCrash()
w->connect(&ti, SIGNAL(timeout()), w, SLOT(deleteLater()));
ti.start(300);
- QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center());
+ QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center(),
+ w->mapToGlobal(w->rect().center()));
qApp->postEvent(w, cme);
QTest::qWait(350);
diff --git a/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.cpp b/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.cpp
index a97a090ebd..c339268e8e 100644
--- a/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.cpp
+++ b/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qlineedit/BLACKLIST b/tests/auto/widgets/widgets/qlineedit/BLACKLIST
index 9f87a6d921..a459495d1a 100644
--- a/tests/auto/widgets/widgets/qlineedit/BLACKLIST
+++ b/tests/auto/widgets/widgets/qlineedit/BLACKLIST
@@ -3,13 +3,7 @@
android
[leftKeyOnSelectedText]
android
-[cutWithoutSelection]
-android
-[inlineCompletion]
-android
[textMargin]
android
-[task210502_caseInsensitiveInlineCompletion]
-android
[testQuickSelectionWithMouse]
android
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index d6c6211e01..9719aefe7b 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -3430,6 +3405,9 @@ void tst_QLineEdit::leftKeyOnSelectedText()
void tst_QLineEdit::inlineCompletion()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("QCompleter does not work on Android, see QTBUG-77174");
+#endif
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
@@ -3827,6 +3805,9 @@ void tst_QLineEdit::task198789_currentCompletion()
void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("QCompleter does not work on Android, see QTBUG-77174");
+#endif
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
@@ -4047,7 +4028,8 @@ void tst_QLineEdit::taskQTBUG_7902_contextMenuCrash()
w->connect(&ti, SIGNAL(timeout()), w, SLOT(deleteLater()));
ti.start(200);
- QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center());
+ QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center(),
+ w->mapToGlobal(w->rect().center()));
qApp->postEvent(w, cme);
QTest::qWait(300);
@@ -4123,7 +4105,7 @@ void tst_QLineEdit::QTBUG13520_textNotVisible()
QString sometext("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg");
le.setText(sometext);
le.setCursorPosition(0);
- QTest::qWait(100); //just make sure we get he lineedit correcly painted
+ QTest::qWait(100); //just make sure we get he lineedit correctly painted
auto expectedCursorCoordinate = le.width() - le.fontMetrics().horizontalAdvance(sometext);
// cursor does not leave widget to the left:
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index f2a7981b4c..6996591946 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -68,13 +43,13 @@ public:
}
void timerEvent(QTimerEvent*) override
{
- QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonPress, QPoint(6, 7), Qt::LeftButton, {}, {}));
- QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(7, 8), Qt::LeftButton, Qt::LeftButton, {}));
- QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(27, 23), Qt::LeftButton, Qt::LeftButton, {}));
- QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(30, 27), Qt::LeftButton, Qt::LeftButton, {}));
- QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(162, 109), Qt::LeftButton, Qt::LeftButton, {}));
- QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(10, 4), Qt::LeftButton, Qt::LeftButton, {}));
- QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(9, 4), Qt::LeftButton, {}, {}));
+ QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonPress, QPoint(6, 7), m_tb->mapToGlobal(QPoint(6, 7)), Qt::LeftButton, {}, {}));
+ QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(7, 8), m_tb->mapToGlobal(QPoint(7, 8)), Qt::LeftButton, Qt::LeftButton, {}));
+ QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(27, 23), m_tb->mapToGlobal(QPoint(27, 23)), Qt::LeftButton, Qt::LeftButton, {}));
+ QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(30, 27), m_tb->mapToGlobal(QPoint(30, 27)), Qt::LeftButton, Qt::LeftButton, {}));
+ QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(162, 109), m_tb->mapToGlobal(QPoint(162, 109)), Qt::LeftButton, Qt::LeftButton, {}));
+ QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(10, 4), m_tb->mapToGlobal(QPoint(10, 4)), Qt::LeftButton, Qt::LeftButton, {}));
+ QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(9, 4), m_tb->mapToGlobal(QPoint(6, 7)), Qt::LeftButton, {}, {}));
}
};
@@ -92,8 +67,8 @@ public:
void timerEvent(QTimerEvent*) override
{
- QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonPress, QPoint(230, 370), Qt::LeftButton, {}, {}));
- QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(230, 370), Qt::LeftButton, {}, {}));
+ QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonPress, QPoint(230, 370), m_w->mapToGlobal(QPoint(230, 370)), Qt::LeftButton, {}, {}));
+ QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(230, 370), m_w->mapToGlobal(QPoint(230, 370)), Qt::LeftButton, {}, {}));
}
};
@@ -1365,14 +1340,19 @@ void tst_QMainWindow::restoreState()
dw.setObjectName(QLatin1String("dock"));
mw.addDockWidget(Qt::LeftDockWidgetArea, &dw);
+ QWidgetPrivate *tbp = QWidgetPrivate::get(&tb);
+ QVERIFY(tbp->widgetItem);
+
QByteArray state;
state = mw.saveState();
QVERIFY(mw.restoreState(state));
+ QVERIFY(tbp->widgetItem);
state = mw.saveState(1);
QVERIFY(!mw.restoreState(state));
QVERIFY(mw.restoreState(state, 1));
+ QVERIFY(tbp->widgetItem);
}
//tests the restoration of the previous versions of window settings
@@ -1859,11 +1839,11 @@ void tst_QMainWindow::setCursor()
QVERIFY(QTest::qWaitForWindowActive(&mw));
QCOMPARE(cur.shape(), mw.cursor().shape());
- QHoverEvent enterE(QEvent::HoverEnter, QPoint(10,10), QPoint());
+ QHoverEvent enterE(QEvent::HoverEnter, QPoint(10,10), QPoint(), QPoint());
mw.event(&enterE);
QCOMPARE(cur.shape(), mw.cursor().shape());
- QHoverEvent leaveE(QEvent::HoverLeave, QPoint(), QPoint());
+ QHoverEvent leaveE(QEvent::HoverLeave, QPoint(), QPoint(), QPoint());
mw.event(&leaveE);
QCOMPARE(cur.shape(), mw.cursor().shape());
}
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 55ac17ac70..1d76bb4d72 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -1911,9 +1886,6 @@ void tst_QMdiArea::dontMaximizeSubWindowOnActivation()
for (int i = 0; i < 5; ++i) {
QMdiSubWindow *window = mdiArea.addSubWindow(new QWidget);
window->show();
-#if defined Q_OS_QNX
- QEXPECT_FAIL("", "QTBUG-38231", Abort);
-#endif
QVERIFY(window->isMaximized());
qApp->processEvents();
}
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
index a4283de59e..1bdb1e8201 100644
--- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmdisubwindow.h"
#include "private/qmdisubwindow_p.h"
@@ -45,6 +20,7 @@
#include <QStyleOptionTitleBar>
#include <QPushButton>
#include <QScreen>
+#include <QScrollBar>
#include <QSizeGrip>
#include <QSignalSpy>
#include <QList>
@@ -221,6 +197,7 @@ private slots:
void styleChange();
void testFullScreenState();
void testRemoveBaseWidget();
+ void testRespectMinimumSize();
};
void tst_QMdiSubWindow::initTestCase()
@@ -1567,9 +1544,6 @@ void tst_QMdiSubWindow::hideAndShow()
#if !defined (Q_OS_DARWIN)
QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner));
-#if defined Q_OS_QNX
- QEXPECT_FAIL("", "QTBUG-38231", Abort);
-#endif
QVERIFY(subWindow->maximizedButtonsWidget());
QVERIFY(subWindow->maximizedSystemMenuIconWidget());
QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget());
@@ -1800,9 +1774,6 @@ void tst_QMdiSubWindow::replaceMenuBarWhileMaximized()
QCoreApplication::processEvents();
-#if defined Q_OS_QNX
- QEXPECT_FAIL("", "QTBUG-38231", Abort);
-#endif
QVERIFY(subWindow->maximizedButtonsWidget());
QVERIFY(subWindow->maximizedSystemMenuIconWidget());
QCOMPARE(menuBar1->cornerWidget(Qt::TopLeftCorner), subWindow->maximizedSystemMenuIconWidget());
@@ -2169,6 +2140,36 @@ void tst_QMdiSubWindow::testRemoveBaseWidget()
delete widget1;
}
+void tst_QMdiSubWindow::testRespectMinimumSize() // QTBUG-100494
+{
+ QMdiArea mdiArea;
+ mdiArea.resize(400, 400);
+ mdiArea.setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ mdiArea.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+
+ auto vlay = new QVBoxLayout;
+ vlay->addWidget(new QPushButton(QLatin1String("btn1-1")));
+ vlay->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ vlay->addWidget(new QPushButton(QLatin1String("btn1-2")));
+ auto w1 = new QWidget;
+ w1->setLayout(vlay);
+ w1->resize(300, 200);
+ w1->setMinimumSize(200, 150);
+ auto sw = new QMdiSubWindow;
+ sw->setWidget(w1);
+ sw->resize(w1->size());
+ mdiArea.addSubWindow(sw);
+ sw->showMaximized();
+
+ mdiArea.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&mdiArea));
+ QVERIFY(!mdiArea.horizontalScrollBar()->isVisible());
+ QVERIFY(!mdiArea.verticalScrollBar()->isVisible());
+ mdiArea.resize(150, 100);
+ QTRY_VERIFY(mdiArea.horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(mdiArea.verticalScrollBar()->isVisible());
+}
+
QTEST_MAIN(tst_QMdiSubWindow)
#include "tst_qmdisubwindow.moc"
diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST
index 230512769c..dc1ab8ddd3 100644
--- a/tests/auto/widgets/widgets/qmenu/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST
@@ -1,10 +1,6 @@
[task258920_mouseBorder]
macos
-[layoutDirection]
-macos
# Fails when enabling synchronous expose events QTBUG-62092
-[pushButtonPopulateOnAboutToShow]
-macos
[tearOff]
macos
[submenuTearOffDontClose]
@@ -29,3 +25,6 @@ android
[QTBUG_89082_actionTipsHide]
macos ci # Can't move cursor (QTBUG-76312)
windows-10 ci
+# QTBUG-87424
+[transientParent]
+android
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 31ecd024c0..602795debb 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.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 WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtTest/private/qtesthelpers_p.h>
@@ -918,13 +893,20 @@ private:
void tst_QMenu::activeSubMenuPositionExec()
{
-
+#ifdef Q_OS_ANDROID
+ // QTBUG-87424
+ QSKIP("Android: This hangs. Figure out why.");
+#endif
SubMenuPositionExecMenu menu;
menu.exec(QGuiApplication::primaryScreen()->availableGeometry().center());
}
void tst_QMenu::task242454_sizeHint()
{
+#ifdef Q_OS_ANDROID
+ // QTBUG-87424
+ QSKIP("Android: This hangs. Figure out why.");
+#endif
QMenu menu;
QString s = QLatin1String("foo\nfoo\nfoo\nfoo");
menu.addAction(s);
@@ -1053,12 +1035,16 @@ public:
// Mouse move related signals for Windows Mobile unavailable
void tst_QMenu::task258920_mouseBorder()
{
+ const QRect screenGeometry = QGuiApplication::primaryScreen()->availableGeometry();
Menu258920 menu;
+ QCursor::setPos(screenGeometry.topLeft());
+ if (!QTest::qWaitFor([screenGeometry]{ return QCursor::pos() == screenGeometry.topLeft(); }))
+ QSKIP("Can't move cursor out of the way");
// For styles which inherit from QWindowsStyle, styleHint(QStyle::SH_Menu_MouseTracking) is true.
menu.setMouseTracking(true);
QAction *action = menu.addAction("test");
- const QPoint center = QGuiApplication::primaryScreen()->availableGeometry().center();
+ const QPoint center = screenGeometry.center();
menu.popup(center);
QVERIFY(QTest::qWaitForWindowExposed(&menu));
QRect actionRect = menu.actionGeometry(action);
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm b/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm
index f90af47c19..be58cff8e6 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm
@@ -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 WITH Qt-GPL-exception-1.0
#import <AppKit/AppKit.h>
diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
index 633bda332f..05984b6039 100644
--- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
@@ -3,6 +3,7 @@ ubuntu-16.04
#QTBUG-66255
ubuntu-18.04
ubuntu-20.04
+ubuntu-22.04
[activatedCount]
opensuse-42.3
# QTBUG-87421
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 1b8de0b75c..18aacc52c3 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -40,6 +15,7 @@
#include <QVBoxLayout>
#include <QLabel>
#include <QPlainTextEdit>
+#include <QTranslator>
#include <qscreen.h>
#include <qobject.h>
@@ -144,6 +120,8 @@ private slots:
#ifdef Q_OS_MACOS
void taskQTBUG56275_reinsertMenuInParentlessQMenuBar();
void QTBUG_57404_existingMenuItemException();
+ void defaultEditMenuItems();
+
#endif
void QTBUG_25669_menubarActionDoubleTriggered();
void taskQTBUG55966_subMenuRemoved();
@@ -1429,7 +1407,7 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten()
QMenu menu("menu1");
QAction *first = menubar.addMenu(&menu);
#if QT_CONFIG(shortcut)
- menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC"));
+ menu.addAction("quit", QKeySequence("ESC"), &menubar, SLOT(close()));
#endif
centerOnScreen(&menubar);
menubar.show();
@@ -1818,6 +1796,32 @@ void tst_QMenuBar::QTBUG_57404_existingMenuItemException()
QTest::qWait(100);
// No crash, all fine. Ideally, there should be only one warning.
}
+
+void tst_QMenuBar::defaultEditMenuItems()
+{
+ class TestTranslator : public QTranslator
+ {
+ public:
+ QString translate(const char *context, const char *sourceText,
+ const char *disambiguation = nullptr, int n = -1) const override
+ {
+ if (QByteArrayView(context) == "QCocoaMenu" && QByteArrayView(sourceText) == "Edit")
+ return QString("Editieren");
+ return QTranslator::translate(context, sourceText, disambiguation, n);
+ }
+ } testTranslator;
+ qApp->installTranslator(&testTranslator);
+
+ QMainWindow mw;
+ mw.show();
+ QVERIFY(QTest::qWaitForWindowActive(&mw));
+
+ mw.menuBar()->addMenu("Editieren")->addAction("Undo");
+
+ mw.hide();
+ mw.show();
+ // this should not crash with infinite recursion
+}
#endif // Q_OS_MACOS
void tst_QMenuBar::taskQTBUG55966_subMenuRemoved()
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm
index 823ca7edfa..fd8086772a 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#import <Cocoa/Cocoa.h>
diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
index 3d7bb36f24..49718a5e87 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
+++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.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 WITH Qt-GPL-exception-1.0
#include <QtOpenGLWidgets/QOpenGLWidget>
#include <QtGui/QOpenGLFunctions>
@@ -37,6 +12,8 @@
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QStackedWidget>
+#include <QtWidgets/QTabWidget>
+#include <QtWidgets/QLabel>
#include <QTest>
#include <QSignalSpy>
#include <private/qguiapplication_p.h>
@@ -58,6 +35,7 @@ private slots:
void reparentToAlreadyCreated();
void reparentToNotYetCreated();
void reparentHidden();
+ void reparentTopLevel();
void asViewport();
void requestUpdate();
void fboRedirect();
@@ -66,6 +44,7 @@ private slots:
void stackWidgetOpaqueChildIsVisible();
void offscreen();
void offscreenThenOnscreen();
+ void paintWhileHidden();
#ifdef QT_BUILD_INTERNAL
void staticTextDanglingPointer();
@@ -152,6 +131,9 @@ void tst_QOpenGLWidget::clearAndGrab()
void tst_QOpenGLWidget::clearAndResizeAndGrab()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
QScopedPointer<QOpenGLWidget> w(new ClearWidget(0, 640, 480));
w->resize(640, 480);
w->show();
@@ -206,7 +188,7 @@ void tst_QOpenGLWidget::createNonTopLevel()
class PainterWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
public:
- PainterWidget(QWidget *parent)
+ PainterWidget(QWidget *parent = nullptr)
: QOpenGLWidget(parent), m_clear(false) { }
void initializeGL() override {
@@ -272,6 +254,9 @@ void tst_QOpenGLWidget::reparentToAlreadyCreated()
void tst_QOpenGLWidget::reparentToNotYetCreated()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
QWidget w1;
PainterWidget *glw = new PainterWidget(&w1);
w1.resize(640, 480);
@@ -320,6 +305,70 @@ void tst_QOpenGLWidget::reparentHidden()
QVERIFY(originalContext != newContext);
}
+void tst_QOpenGLWidget::reparentTopLevel()
+{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
+ // no GL content yet, just an ordinary tab widget, top-level
+ QTabWidget tabWidget;
+ tabWidget.resize(640, 480);
+ tabWidget.addTab(new QLabel("Dummy page"), "Page 1");
+ tabWidget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&tabWidget));
+
+ PainterWidget *glw1 = new PainterWidget;
+ // add child GL widget as a tab page
+ {
+ QSignalSpy frameSwappedSpy(glw1, &QOpenGLWidget::frameSwapped);
+ tabWidget.setCurrentIndex(tabWidget.addTab(glw1, "OpenGL widget 1"));
+ QTRY_VERIFY(frameSwappedSpy.count() > 0);
+ }
+
+ PainterWidget *glw2 = new PainterWidget;
+ // add child GL widget #2 as a tab page
+ {
+ QSignalSpy frameSwappedSpy(glw2, &QOpenGLWidget::frameSwapped);
+ tabWidget.setCurrentIndex(tabWidget.addTab(glw2, "OpenGL widget 2"));
+ QTRY_VERIFY(frameSwappedSpy.count() > 0);
+ }
+
+ QImage image = glw2->grabFramebuffer();
+ QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));
+
+ // now delete GL widget #2
+ {
+ QSignalSpy frameSwappedSpy(glw1, &QOpenGLWidget::frameSwapped);
+ delete glw2;
+ QTRY_VERIFY(frameSwappedSpy.count() > 0);
+ }
+
+ image = glw1->grabFramebuffer();
+ QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));
+
+ // make the GL widget top-level
+ {
+ QSignalSpy frameSwappedSpy(glw1, &QOpenGLWidget::frameSwapped);
+ glw1->setParent(nullptr);
+ glw1->show();
+ QVERIFY(QTest::qWaitForWindowExposed(glw1));
+ QTRY_VERIFY(frameSwappedSpy.count() > 0);
+ }
+
+ image = glw1->grabFramebuffer();
+ QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));
+
+ // back to a child widget by readding to the tab widget
+ {
+ QSignalSpy frameSwappedSpy(glw1, &QOpenGLWidget::frameSwapped);
+ tabWidget.setCurrentIndex(tabWidget.addTab(glw1, "Re-added OpenGL widget 1"));
+ QTRY_VERIFY(frameSwappedSpy.count() > 0);
+ }
+
+ image = glw1->grabFramebuffer();
+ QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));
+}
+
class CountingGraphicsView : public QGraphicsView
{
public:
@@ -346,6 +395,9 @@ void CountingGraphicsView::drawForeground(QPainter *, const QRectF &)
void tst_QOpenGLWidget::asViewport()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
// Have a QGraphicsView with a QOpenGLWidget as its viewport.
QGraphicsScene scene;
scene.addItem(new QGraphicsRectItem(10, 10, 100, 100));
@@ -394,6 +446,9 @@ public:
void tst_QOpenGLWidget::requestUpdate()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
@@ -421,6 +476,9 @@ public:
void tst_QOpenGLWidget::fboRedirect()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
FboCheckWidget w;
w.resize(640, 480);
w.show();
@@ -436,6 +494,9 @@ void tst_QOpenGLWidget::fboRedirect()
void tst_QOpenGLWidget::showHide()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
w->resize(800, 600);
w->show();
@@ -462,6 +523,9 @@ void tst_QOpenGLWidget::showHide()
void tst_QOpenGLWidget::nativeWindow()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
w->resize(800, 600);
w->show();
@@ -585,6 +649,9 @@ void tst_QOpenGLWidget::stackWidgetOpaqueChildIsVisible()
QSKIP("QScreen::grabWindow() doesn't work properly on OSX HighDPI screen: QTBUG-46803");
return;
#endif
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
if (QGuiApplication::platformName().startsWith(QLatin1String("offscreen"), Qt::CaseInsensitive))
@@ -671,6 +738,9 @@ void tst_QOpenGLWidget::offscreen()
void tst_QOpenGLWidget::offscreenThenOnscreen()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
w->resize(800, 600);
@@ -694,6 +764,33 @@ void tst_QOpenGLWidget::offscreenThenOnscreen()
QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255));
}
+void tst_QOpenGLWidget::paintWhileHidden()
+{
+#ifdef Q_OS_ANDROID
+ QSKIP("Crashes on Android, figure out why (QTBUG-102043)");
+#endif
+ QScopedPointer<QWidget> tlw(new QWidget);
+ tlw->resize(640, 480);
+
+ ClearWidget *w = new ClearWidget(0, 640, 480);
+ w->setParent(tlw.data());
+ w->setClearColor(0, 0, 1);
+
+ tlw->show();
+ QVERIFY(QTest::qWaitForWindowExposed(tlw.data()));
+
+ // QTBUG-101620: Now make visible=false and call update and see if we get to
+ // paintEvent/paintGL eventually, to ensure the updating of the texture is
+ // not optimized permanently away even though there is no composition
+ // on-screen at the point when update() is called.
+
+ w->setVisible(false);
+ w->m_paintCalled = 0;
+ w->update();
+ w->setVisible(true);
+ QTRY_VERIFY(w->m_paintCalled > 0);
+}
+
class StaticTextPainterWidget : public QOpenGLWidget
{
public:
diff --git a/tests/auto/widgets/widgets/qplaintextedit/BLACKLIST b/tests/auto/widgets/widgets/qplaintextedit/BLACKLIST
deleted file mode 100644
index b71f2fcc0a..0000000000
--- a/tests/auto/widgets/widgets/qplaintextedit/BLACKLIST
+++ /dev/null
@@ -1,15 +0,0 @@
-# QTBUG-87423
-[copyAvailable]
-android
-[adjustScrollbars]
-android
-# QTBUG-89402
-[undoAvailableAfterPaste]
-android
-[copyAndSelectAllInReadonly]
-android
-[canPaste]
-android
-[updateCursorPositionAfterEdit]
-android
-
diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
index 297eb5ec51..e0c213f8e0 100644
--- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -38,6 +13,7 @@
#include <qclipboard.h>
#include <qtextbrowser.h>
#include <private/qwidgettextcontrol_p.h>
+#include <private/qplaintextedit_p.h>
#include <qscrollbar.h>
#include <qtextobject.h>
#include <qmenu.h>
@@ -143,7 +119,7 @@ private slots:
void layoutAfterMultiLineRemove();
void undoCommandRemovesAndReinsertsBlock();
void taskQTBUG_43562_lineCountCrash();
-#ifndef QT_NO_CONTEXTMENU
+#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD)
void contextMenu();
#endif
void inputMethodCursorRect();
@@ -154,6 +130,8 @@ private slots:
void updateCursorPositionAfterEdit();
#endif
void appendTextWhenInvisible();
+ void placeholderVisibility_data();
+ void placeholderVisibility();
private:
void createSelection();
@@ -1368,7 +1346,9 @@ void tst_QPlainTextEdit::adjustScrollbars()
ed->setFont(ff);
ed->setMinimumSize(140, 100);
ed->setMaximumSize(140, 100);
- ed->show();
+ // We use showNormal() here, because otherwise on Android the widget will
+ // be shown fullscreen, and the scrollbar will not appear.
+ ed->showNormal();
QLatin1String txt("\nabc def ghi jkl mno pqr stu vwx");
ed->setPlainText(txt + txt + txt + txt);
@@ -1696,7 +1676,7 @@ void tst_QPlainTextEdit::taskQTBUG_43562_lineCountCrash()
disconnect(ed->document(), SIGNAL(contentsChange(int, int, int)), 0, 0);
}
-#ifndef QT_NO_CONTEXTMENU
+#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD)
void tst_QPlainTextEdit::contextMenu()
{
ed->appendHtml(QStringLiteral("Hello <a href='http://www.qt.io'>Qt</a>"));
@@ -1730,7 +1710,7 @@ void tst_QPlainTextEdit::contextMenu()
delete menu;
QVERIFY(!ed->findChild<QAction *>(QStringLiteral("link-copy")));
}
-#endif // QT_NO_CONTEXTMENU
+#endif // QT_NO_CONTEXTMENU && QT_NO_CLIPBOARD
// QTBUG-51923: Verify that the cursor rectangle returned by the input
// method query correctly reflects the viewport offset.
@@ -1837,5 +1817,107 @@ void tst_QPlainTextEdit::appendTextWhenInvisible()
QCOMPARE(maxAfterAppend, maxAfterSet);
}
+enum SetupCommand {
+ ClearPlaceHolder, // set empty placeholder text
+ SetPlaceHolder, // set a non-empty placeholder text
+ ClearContent, // set empty text as content
+ SetContent // set non-empty text as content
+};
+
+void tst_QPlainTextEdit::placeholderVisibility_data()
+{
+ QTest::addColumn<QList<SetupCommand>>("setupCommands");
+ QTest::addColumn<bool>("placeholderVisible");
+ QTest::addRow("no placeholder set + no text set")
+ << QList<SetupCommand>{} << true;
+ QTest::addRow("no placeholder set + text set or text set + no placeholder set")
+ << QList<SetupCommand>{ SetContent } << false;
+ QTest::addRow("no placeholder set + text set + empty text set")
+ << QList<SetupCommand>{ SetContent , ClearContent }
+ << false;
+ QTest::addRow("no placeholder set + empty text set + text set")
+ << QList<SetupCommand>{ ClearContent, SetContent }
+ << false;
+ QTest::addRow("empty placeholder set + no text set")
+ << QList<SetupCommand>{ ClearPlaceHolder } << true;
+ QTest::addRow("empty placeholder set + text set")
+ << QList<SetupCommand>{ ClearPlaceHolder, SetContent }
+ << false;
+ QTest::addRow("empty placeholder set + text set + empty text set")
+ << QList<SetupCommand>{ ClearPlaceHolder, SetContent, ClearContent }
+ << false;
+ QTest::addRow("empty placeholder set + empty text set + text set")
+ << QList<SetupCommand>{ ClearPlaceHolder, ClearContent, SetContent }
+ << false;
+ QTest::addRow("placeholder set + no text set")
+ << QList<SetupCommand>{ SetPlaceHolder, ClearContent }
+ << true;
+ QTest::addRow("placeholder set + text set")
+ << QList<SetupCommand>{ SetPlaceHolder, SetContent }
+ << false;
+ QTest::addRow("placeholder set + text set + empty text set")
+ << QList<SetupCommand>{ SetPlaceHolder, SetContent, ClearContent }
+ << true;
+ QTest::addRow("placeholder set + empty text set + text set")
+ << QList<SetupCommand>{ SetPlaceHolder, ClearContent, SetContent }
+ << false;
+ QTest::addRow("placeholder set + text set + empty placeholder set")
+ << QList<SetupCommand>{ SetPlaceHolder, SetContent, ClearPlaceHolder}
+ << false;
+ QTest::addRow("placeholder set + empty placeholder set + text set")
+ << QList<SetupCommand>{ SetPlaceHolder, ClearPlaceHolder, SetContent }
+ << false;
+ QTest::addRow("placeholder set + empty placeholder set + empty text set")
+ << QList<SetupCommand>{ SetPlaceHolder, ClearPlaceHolder, ClearContent }
+ << false;
+ QTest::addRow("placeholder set + empty text set + empty placeholder set")
+ << QList<SetupCommand>{ SetPlaceHolder, ClearContent, ClearPlaceHolder }
+ << false;
+ QTest::addRow("text set + no placeholder set + empty text set")
+ << QList<SetupCommand>{ SetContent, ClearContent }
+ << false;
+ QTest::addRow("text set + empty placeholder set")
+ << QList<SetupCommand>{ SetContent, ClearPlaceHolder }
+ << false;
+ QTest::addRow("text set + placeholder set")
+ << QList<SetupCommand>{ SetContent, SetPlaceHolder }
+ << false;
+ QTest::addRow("text set + placeholder set + empty text set")
+ << QList<SetupCommand>{ SetContent, SetPlaceHolder, ClearContent }
+ << true;
+ QTest::addRow("text set + placeholder set + empty placeholder set")
+ << QList<SetupCommand>{ SetContent, SetPlaceHolder, ClearPlaceHolder }
+ << false;
+}
+
+void tst_QPlainTextEdit::placeholderVisibility()
+{
+ QFETCH(QList<SetupCommand>, setupCommands);
+ QFETCH(bool, placeholderVisible);
+
+ QPlainTextEdit plainTextEdit;
+ for (auto command : setupCommands) {
+ switch (command) {
+ case ClearPlaceHolder:
+ plainTextEdit.setPlaceholderText("");
+ break;
+ case SetPlaceHolder:
+ plainTextEdit.setPlaceholderText("Qt is awesome !");
+ break;
+ case ClearContent:
+ plainTextEdit.setPlainText("");
+ break;
+ case SetContent:
+ plainTextEdit.setPlainText("PlainText...");
+ break;
+ }
+ }
+ auto *plainTextEdit_d = static_cast<QPlainTextEditPrivate *>(qt_widget_private(&plainTextEdit));
+
+ plainTextEdit.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&plainTextEdit));
+ QTRY_VERIFY(plainTextEdit_d->placeholderVisible == placeholderVisible);
+}
+
QTEST_MAIN(tst_QPlainTextEdit)
#include "tst_qplaintextedit.moc"
diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
index 5c08ac4e3e..abe29345d2 100644
--- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt b/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt
index 0ec5c1fe09..199a891695 100644
--- a/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt
+++ b/tests/auto/widgets/widgets/qpushbutton/CMakeLists.txt
@@ -9,5 +9,6 @@ qt_internal_add_test(tst_qpushbutton
tst_qpushbutton.cpp
PUBLIC_LIBRARIES
Qt::Gui
+ Qt::GuiPrivate
Qt::Widgets
)
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 60b5bebdaf..172c5878cb 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -41,6 +16,9 @@
#include <QStyleFactory>
#include <QTabWidget>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformtheme.h>
+
class tst_QPushButton : public QObject
{
Q_OBJECT
@@ -220,6 +198,13 @@ void tst_QPushButton::autoRepeat()
// check that pressing ENTER has no effect
resetCounters();
testWidget->setDown( false );
+ // Skip after reset if ButtonPressKeys has Key_Enter
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ if (buttonPressKeys.contains(Qt::Key_Enter)) {
+ return;
+ }
testWidget->setAutoRepeat( false );
QTest::keyPress( testWidget, Qt::Key_Enter );
@@ -255,6 +240,14 @@ void tst_QPushButton::pressed()
QCOMPARE( press_count, (uint)1 );
QCOMPARE( release_count, (uint)1 );
+ // Skip if ButtonPressKeys has Key_Enter
+ const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()
+ ->themeHint(QPlatformTheme::ButtonPressKeys)
+ .value<QList<Qt::Key>>();
+ if (buttonPressKeys.contains(Qt::Key_Enter)) {
+ return;
+ }
+
QTest::keyPress( testWidget,Qt::Key_Enter );
QCOMPARE( press_count, (uint)1 );
QCOMPARE( release_count, (uint)1 );
diff --git a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
index 8b1670ae06..2fcf2e5545 100644
--- a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
+++ b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
index e0fd42e95c..edb59b5a7a 100644
--- a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
+++ b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
index 471a9bd3e4..a6e39bf273 100644
--- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
+++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -192,13 +167,20 @@ void tst_QScrollBar::QTBUG_42871()
QMouseEvent mousePressEvent(QEvent::MouseButtonPress, pressPoint, globalPressPoint,
Qt::LeftButton, Qt::LeftButton, {});
QApplication::sendEvent(&scrollBarWidget, &mousePressEvent);
+ QElapsedTimer timer;
+ timer.start();
QTest::qWait(1);
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pressPoint, globalPressPoint,
Qt::LeftButton, Qt::LeftButton, {});
QApplication::sendEvent(&scrollBarWidget, &mouseReleaseEvent);
+ if (timer.elapsed() > 40) {
+ // took too long, we need to tolerate auto-repeat
+ if (myHandler.updatesCount > 1)
+ QEXPECT_FAIL("", "Took too long to process events, repeat timer fired", Continue);
+ }
// Check that the action was triggered once.
QCOMPARE(myHandler.updatesCount, 1);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.count(), myHandler.updatesCount);
}
QTEST_MAIN(tst_QScrollBar)
diff --git a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp
index 1c69a1c8bd..e7a2cd5f42 100644
--- a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp
+++ b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qslider/tst_qslider.cpp b/tests/auto/widgets/widgets/qslider/tst_qslider.cpp
index 3722025782..c5f0b9a812 100644
--- a/tests/auto/widgets/widgets/qslider/tst_qslider.cpp
+++ b/tests/auto/widgets/widgets/qslider/tst_qslider.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index fc3412f387..732fdb6515 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.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 WITH Qt-GPL-exception-1.0
#include <qdebug.h>
#include <qapplication.h>
diff --git a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
index c038682788..f397777065 100644
--- a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp
+++ b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index ce7ac0a186..667c6868b7 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -1,33 +1,10 @@
-/****************************************************************************
-**
-** 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 WITH Qt-GPL-exception-1.0
#include <QTest>
+#include <QSignalSpy>
+
#include <qapplication.h>
#include <qsplitter.h>
#include <qstyle.h>
@@ -81,6 +58,8 @@ private slots:
void replaceWidget();
void replaceWidgetWithSplitterChild_data();
void replaceWidgetWithSplitterChild();
+ void replaceWidgetWhileHidden_data();
+ void replaceWidgetWhileHidden();
void handleMinimumWidth();
// task-specific tests below me:
@@ -89,6 +68,7 @@ private slots:
void task169702_sizes();
void taskQTBUG_4101_ensureOneNonCollapsedWidget_data();
void taskQTBUG_4101_ensureOneNonCollapsedWidget();
+ void taskQTBUG_102249_moveNonPressed();
void setLayout();
void autoAdd();
@@ -851,6 +831,47 @@ void tst_QSplitter::replaceWidgetWithSplitterChild()
}
}
+void tst_QSplitter::replaceWidgetWhileHidden_data()
+{
+ QTest::addColumn<bool>("splitterVisible");
+ QTest::addColumn<bool>("widgetVisible");
+
+ QTest::addRow("visibleToVisible") << true << true;
+ QTest::addRow("hiddenToVisible") << true << false;
+ QTest::addRow("visibleToHidden") << false << true;
+ QTest::addRow("hiddenToHidden") << false << false;
+}
+
+void tst_QSplitter::replaceWidgetWhileHidden()
+{
+ QFETCH(bool, splitterVisible);
+ QFETCH(bool, widgetVisible);
+
+ MyFriendlySplitter splitter;
+
+ splitter.addWidget(new QLabel("One"));
+ splitter.addWidget(new QLabel("Two"));
+
+ if (splitterVisible) {
+ splitter.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&splitter));
+ }
+ QWidget *newWidget = new QLabel("Three");
+ if (!widgetVisible)
+ newWidget->hide();
+
+ const bool wasExplicitHide = !widgetVisible && newWidget->testAttribute(Qt::WA_WState_ExplicitShowHide);
+ splitter.replaceWidget(1, newWidget);
+
+ QCOMPARE(!widgetVisible && newWidget->testAttribute(Qt::WA_WState_ExplicitShowHide), wasExplicitHide);
+
+ if (!splitterVisible) {
+ splitter.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&splitter));
+ }
+ QCOMPARE(widgetVisible, newWidget->isVisible());
+}
+
void tst_QSplitter::handleMinimumWidth()
{
MyFriendlySplitter split;
@@ -1026,6 +1047,24 @@ void tst_QSplitter::taskQTBUG_4101_ensureOneNonCollapsedWidget()
QTRY_VERIFY(s.sizes().at(0) > 0);
}
+void tst_QSplitter::taskQTBUG_102249_moveNonPressed()
+{
+ QSplitter s;
+ s.setOpaqueResize(true);
+ s.addWidget(new QWidget());
+ s.addWidget(new QWidget());
+ s.show();
+
+ QSignalSpy spyMove(&s, &QSplitter::splitterMoved);
+ QPointF posOutOfWidget = QPointF(30, 30);
+ QMouseEvent me(QEvent::MouseMove,
+ posOutOfWidget, s.mapToGlobal(posOutOfWidget),
+ Qt::NoButton, Qt::MouseButtons(Qt::LeftButton),
+ Qt::NoModifier);
+ qApp->sendEvent(s.handle(0), &me);
+ QCOMPARE(spyMove.count(), 0);
+}
+
void tst_QSplitter::setLayout()
{
QSplitter splitter;
diff --git a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp
index df3b943e05..672e176808 100644
--- a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp
+++ b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp
index d7079197ce..353c44d6b3 100644
--- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp
+++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
index f51f0a23d5..1e19617be9 100644
--- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
@@ -36,6 +11,10 @@
#include <QStyleOptionTab>
#include <QProxyStyle>
#include <QTimer>
+#include <QScreen>
+#include <QWindow>
+
+using namespace Qt::StringLiterals;
class TabBar;
@@ -78,6 +57,7 @@ private slots:
void setUsesScrollButtons();
void removeLastTab();
+ void removeLastVisibleTab();
void closeButton();
@@ -488,6 +468,39 @@ void tst_QTabBar::removeLastTab()
spy.clear();
}
+void tst_QTabBar::removeLastVisibleTab()
+{
+ QTabBar tabbar;
+ tabbar.setSelectionBehaviorOnRemove(QTabBar::SelectionBehavior::SelectRightTab);
+
+ int invisible = tabbar.addTab("invisible");
+ int visible = tabbar.addTab("visible");
+ tabbar.setCurrentIndex(visible);
+ tabbar.adjustSize();
+
+ tabbar.setTabVisible(invisible, false);
+ {
+ QSignalSpy spy(&tabbar, SIGNAL(currentChanged(int)));
+ tabbar.removeTab(visible);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toInt(), -1);
+ QCOMPARE(tabbar.currentIndex(), -1);
+ }
+
+ tabbar.setSelectionBehaviorOnRemove(QTabBar::SelectionBehavior::SelectLeftTab);
+ visible = tabbar.insertTab(0, "visible");
+ ++invisible;
+ QVERIFY(!tabbar.isTabVisible(invisible));
+ tabbar.setCurrentIndex(visible);
+ {
+ QSignalSpy spy(&tabbar, SIGNAL(currentChanged(int)));
+ tabbar.removeTab(visible);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toInt(), -1);
+ QCOMPARE(tabbar.currentIndex(), -1);
+ }
+}
+
void tst_QTabBar::closeButton()
{
QTabBar tabbar;
@@ -1011,8 +1024,8 @@ void tst_QTabBar::kineticWheel()
window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window));
- const auto *leftButton = tabbar.findChild<QAbstractButton*>(u"ScrollLeftButton"_qs);
- const auto *rightButton = tabbar.findChild<QAbstractButton*>(u"ScrollRightButton"_qs);
+ const auto *leftButton = tabbar.findChild<QAbstractButton*>(u"ScrollLeftButton"_s);
+ const auto *rightButton = tabbar.findChild<QAbstractButton*>(u"ScrollRightButton"_s);
QVERIFY(leftButton && rightButton);
QVERIFY(leftButton->isEnabled() && rightButton->isEnabled());
@@ -1190,8 +1203,8 @@ void tst_QTabBar::scrollButtons()
window.show();
QVERIFY(QTest::qWaitForWindowActive(&window));
- auto *leftB = tabWidget.tabBar()->findChild<QAbstractButton*>(u"ScrollLeftButton"_qs);
- auto *rightB = tabWidget.tabBar()->findChild<QAbstractButton*>(u"ScrollRightButton"_qs);
+ auto *leftB = tabWidget.tabBar()->findChild<QAbstractButton*>(u"ScrollLeftButton"_s);
+ auto *rightB = tabWidget.tabBar()->findChild<QAbstractButton*>(u"ScrollRightButton"_s);
QVERIFY(leftB->isVisible());
QVERIFY(!leftB->isEnabled());
@@ -1246,9 +1259,10 @@ void tst_QTabBar::currentTabLargeFont()
void tst_QTabBar::hoverTab_data()
{
- // Since we still rely on moving the mouse via QCursor::setPos in QTest::mouseMove,
+ // Move the cursor away from the widget as not to interfere.
// skip this test if we can't
- const QPoint cursorPos = QCursor::pos() + QPoint(10, 10);
+ const QPoint topLeft = QGuiApplication::primaryScreen()->availableGeometry().topLeft();
+ const QPoint cursorPos = topLeft + QPoint(10, 10);
QCursor::setPos(cursorPos);
if (!QTest::qWaitFor([cursorPos]{ return QCursor::pos() == cursorPos; }, 500))
QSKIP("Can't move mouse");
@@ -1261,7 +1275,7 @@ void tst_QTabBar::hoverTab_data()
void tst_QTabBar::hoverTab()
{
QFETCH(bool, documentMode);
- QWidget window;
+ QWidget topLevel;
class TabBar : public QTabBar
{
public:
@@ -1272,7 +1286,7 @@ void tst_QTabBar::hoverTab()
styleOptions[tabIndex] = *option;
}
mutable QHash<int, QStyleOptionTab> styleOptions;
- } tabbar(&window);
+ } tabbar(&topLevel);
tabbar.setDocumentMode(documentMode);
tabbar.addTab("A");
@@ -1281,7 +1295,10 @@ void tst_QTabBar::hoverTab()
tabbar.addTab("D");
tabbar.move(0,0);
- window.setMinimumSize(tabbar.sizeHint());
+ const QSize size = tabbar.sizeHint();
+ const auto center = topLevel.screen()->availableGeometry().center();
+ topLevel.move(center - QPoint{size.width(), size.height()} / 2);
+ topLevel.setMinimumSize(size);
tabbar.ensurePolished();
// some styles set those flags, some don't. If not, use a style sheet
@@ -1293,21 +1310,25 @@ void tst_QTabBar::hoverTab()
)");
}
- window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window));
+ topLevel.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
+ auto *window = topLevel.windowHandle();
- QTest::mouseMove(&tabbar, tabbar.tabRect(0).center());
+ auto pos = tabbar.mapToParent(tabbar.tabRect(0).center());
+ QTest::mouseMove(window, pos);
QTRY_VERIFY(tabbar.styleOptions[0].state & QStyle::State_Selected);
QTRY_COMPARE(tabbar.styleOptions[1].state & QStyle::State_MouseOver, QStyle::State_None);
QTRY_COMPARE(tabbar.styleOptions[2].state & QStyle::State_MouseOver, QStyle::State_None);
QTRY_COMPARE(tabbar.styleOptions[3].state & QStyle::State_MouseOver, QStyle::State_None);
- QTest::mouseMove(&tabbar, tabbar.tabRect(1).center());
+ pos = tabbar.mapToParent(tabbar.tabRect(1).center());
+ QTest::mouseMove(window, pos);
QTRY_COMPARE(tabbar.styleOptions[1].state & QStyle::State_MouseOver, QStyle::State_MouseOver);
QCOMPARE(tabbar.styleOptions[2].state & QStyle::State_MouseOver, QStyle::State_None);
QCOMPARE(tabbar.styleOptions[3].state & QStyle::State_MouseOver, QStyle::State_None);
- QTest::mouseMove(&tabbar, tabbar.tabRect(2).center());
+ pos = tabbar.mapToParent(tabbar.tabRect(2).center());
+ QTest::mouseMove(window, pos);
QTRY_COMPARE(tabbar.styleOptions[2].state & QStyle::State_MouseOver, QStyle::State_MouseOver);
QCOMPARE(tabbar.styleOptions[1].state & QStyle::State_MouseOver, QStyle::State_None);
QCOMPARE(tabbar.styleOptions[3].state & QStyle::State_MouseOver, QStyle::State_None);
diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
index 0e7012482d..0cf37ad9d0 100644
--- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp
index ec187a55b0..ee950fa670 100644
--- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp
+++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 9126b87472..ff5d3ab083 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.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 WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -139,7 +114,13 @@ private slots:
void moveCursor();
#ifndef QT_NO_CLIPBOARD
void mimeDataReimplementations();
+#ifndef QT_NO_TEXTHTMLPARSER
+ void mimeTypesAvailableFromRichText();
#endif
+#if QT_CONFIG(textmarkdownreader)
+ void mimeTypesAvailableFromMarkdown();
+#endif
+#endif // QT_NO_CLIPBOARD
void ctrlEnterShouldInsertLineSeparator_NOT();
void shiftEnterShouldInsertLineSeparator();
void selectWordsFromStringsContainingSeparators_data();
@@ -175,6 +156,7 @@ private slots:
void setDocumentPreservesPalette();
#endif
void pasteFromQt3RichText();
+ void pasteFromMarkdown();
void noWrapBackgrounds();
void preserveCharFormatAfterUnchangingSetPosition();
void twoSameInputMethodEvents();
@@ -218,6 +200,7 @@ private:
void createSelection();
int blockCount() const;
void compareWidgetAndImage(QTextEdit &widget, const QString &imageFileName);
+ bool isMainFontFixed();
QTextEdit *ed;
qreal rootFrameMargin;
@@ -1505,7 +1488,63 @@ void tst_QTextEdit::mimeDataReimplementations()
QCOMPARE(ed.insertCallCount, 1);
#endif
}
+
+#ifndef QT_NO_TEXTHTMLPARSER
+void tst_QTextEdit::mimeTypesAvailableFromRichText()
+{
+ MyTextEdit ed;
+ ed.setHtml("<i>Hello <b>World</b></i>");
+ ed.selectAll();
+ ed.copy();
+ const auto *mimeData = QApplication::clipboard()->mimeData();
+ qCDebug(lcTests) << "available mime types" << mimeData->formats();
+ QVERIFY(mimeData->formats().contains("text/plain"));
+#if QT_CONFIG(textmarkdownwriter)
+ QVERIFY(mimeData->formats().contains("text/markdown"));
+ const QByteArray expectedMarkdown = "*Hello **World***\n\n";
+ if (mimeData->data("text/markdown") != expectedMarkdown && isMainFontFixed())
+ QEXPECT_FAIL("", "fixed-pitch main font (QTBUG-103484)", Continue);
+ QCOMPARE(mimeData->data("text/markdown"), expectedMarkdown);
+#endif
+#ifndef QT_NO_TEXTHTMLPARSER
+ QVERIFY(mimeData->formats().contains("text/html"));
+ QVERIFY(mimeData->hasHtml());
+#endif
+#ifndef QT_NO_TEXTODFWRITER
+ QVERIFY(mimeData->formats().contains("application/vnd.oasis.opendocument.text"));
+#endif
+}
+#endif // QT_NO_TEXTHTMLPARSER
+
+#if QT_CONFIG(textmarkdownreader)
+void tst_QTextEdit::mimeTypesAvailableFromMarkdown()
+{
+ MyTextEdit ed;
+ const QString md("# TODO\n\n- [x] Fix bugs\n- [ ] Have a beer\n");
+ ed.setMarkdown(md);
+ ed.selectAll();
+ ed.copy();
+ const auto *mimeData = QApplication::clipboard()->mimeData();
+ qCDebug(lcTests) << "available mime types" << mimeData->formats();
+ QVERIFY(mimeData->formats().contains("text/plain"));
+#if QT_CONFIG(textmarkdownwriter)
+ QVERIFY(mimeData->formats().contains("text/markdown"));
+ if (mimeData->data("text/markdown") != md && isMainFontFixed())
+ QEXPECT_FAIL("", "fixed-pitch main font (QTBUG-103484)", Continue);
+ QCOMPARE(mimeData->data("text/markdown"), md);
+#endif
+#ifndef QT_NO_TEXTHTMLPARSER
+ QVERIFY(mimeData->formats().contains("text/html"));
+ QVERIFY(mimeData->hasHtml());
+ QVERIFY(mimeData->html().contains("checked")); // <li class=\"checked\" ...
#endif
+#ifndef QT_NO_TEXTODFWRITER
+ QVERIFY(mimeData->formats().contains("application/vnd.oasis.opendocument.text"));
+#endif
+}
+#endif // textmarkdownreader
+
+#endif // QT_NO_CLIPBOARD
void tst_QTextEdit::ctrlEnterShouldInsertLineSeparator_NOT()
{
@@ -2158,6 +2197,18 @@ void tst_QTextEdit::compareWidgetAndImage(QTextEdit &widget, const QString &imag
}
}
+bool tst_QTextEdit::isMainFontFixed()
+{
+ bool ret = QFontInfo(QGuiApplication::font()).fixedPitch();
+ if (ret) {
+ qCWarning(lcTests) << "QFontDatabase::GeneralFont is monospaced: markdown writing is likely to use too many backticks";
+ qCWarning(lcTests) << "system fonts: fixed" << QFontDatabase::systemFont(QFontDatabase::FixedFont)
+ << "fixed?" << QFontInfo(QFontDatabase::systemFont(QFontDatabase::FixedFont)).fixedPitch()
+ << "general" << QFontDatabase::systemFont(QFontDatabase::GeneralFont);
+ }
+ return ret;
+}
+
void tst_QTextEdit::cursorRect()
{
ed->show();
@@ -2178,9 +2229,8 @@ void tst_QTextEdit::setDocumentPreservesPalette()
QWidgetTextControl *control = ed->findChild<QWidgetTextControl *>();
QVERIFY(control);
- QPalette defaultPal = ed->palette();
QPalette whitePal = ed->palette();
- whitePal.setColor(QPalette::Active, QPalette::Text, "white");
+ whitePal.setColor(QPalette::Active, QPalette::Text, Qt::white);
QVERIFY(whitePal != ed->palette());
@@ -2225,6 +2275,24 @@ void tst_QTextEdit::pasteFromQt3RichText()
QCOMPARE(ed->toPlainText(), QString::fromLatin1(" QTextEdit is an "));
}
+void tst_QTextEdit::pasteFromMarkdown()
+{
+ QByteArray richtext("*This* text is **rich**");
+
+ QMimeData mimeData;
+ mimeData.setData("text/markdown", richtext);
+
+ static_cast<PublicTextEdit *>(ed)->publicInsertFromMimeData(&mimeData);
+
+ QCOMPARE(ed->toPlainText(), "This text is rich");
+#if QT_CONFIG(textmarkdownwriter)
+ const auto expectedMarkdown = QString::fromLatin1(richtext + "\n\n");
+ if (ed->toMarkdown() != expectedMarkdown && isMainFontFixed())
+ QEXPECT_FAIL("", "fixed-pitch main font (QTBUG-103484)", Continue);
+ QCOMPARE(ed->toMarkdown(), expectedMarkdown);
+#endif
+}
+
void tst_QTextEdit::noWrapBackgrounds()
{
QWidget topLevel;
@@ -2297,7 +2365,8 @@ void tst_QTextEdit::taskQTBUG_7902_contextMenuCrash()
w->connect(&ti, SIGNAL(timeout()), w, SLOT(deleteLater()));
ti.start(200);
- QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center());
+ QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse, w->rect().center(),
+ w->viewport()->mapToGlobal(w->rect().center()));
qApp->postEvent(w->viewport(), cme);
QTest::qWait(300);
diff --git a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
index 8fea0dcd67..c1d08316f8 100644
--- a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
+++ b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp
index fc7eade9f4..5fe06707be 100644
--- a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp
+++ b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.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 WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
index 12a9ec3de0..abccd7bec8 100644
--- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
+++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.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 WITH Qt-GPL-exception-1.0
#include <QTest>