summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r--tests/auto/gui/kernel/CMakeLists.txt38
-rw-r--r--tests/auto/gui/kernel/kernel.pro13
-rw-r--r--tests/auto/gui/kernel/noqteventloop/CMakeLists.txt24
-rw-r--r--tests/auto/gui/kernel/qbackingstore/CMakeLists.txt15
-rw-r--r--tests/auto/gui/kernel/qclipboard/CMakeLists.txt7
-rw-r--r--tests/auto/gui/kernel/qclipboard/copier/CMakeLists.txt18
-rw-r--r--tests/auto/gui/kernel/qclipboard/paster/CMakeLists.txt18
-rw-r--r--tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt24
-rw-r--r--tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt24
-rw-r--r--tests/auto/gui/kernel/qcursor/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qdrag/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qevent/CMakeLists.txt10
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/CMakeLists.txt4
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/CMakeLists.txt16
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/test/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qguiaction/.gitignore1
-rw-r--r--tests/auto/gui/kernel/qguiaction/qguiaction.pro4
-rw-r--r--tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp210
-rw-r--r--tests/auto/gui/kernel/qguiactiongroup/.gitignore1
-rw-r--r--tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro4
-rw-r--r--tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp235
-rw-r--r--tests/auto/gui/kernel/qguiapplication/.prev_CMakeLists.txt47
-rw-r--r--tests/auto/gui/kernel/qguiapplication/BLACKLIST3
-rw-r--r--tests/auto/gui/kernel/qguiapplication/CMakeLists.txt48
-rw-r--r--tests/auto/gui/kernel/qguieventdispatcher/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt28
-rw-r--r--tests/auto/gui/kernel/qguieventloop/CMakeLists.txt28
-rw-r--r--tests/auto/gui/kernel/qguimetatype/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp26
-rw-r--r--tests/auto/gui/kernel/qguishortcut/qguishortcut.pro4
-rw-r--r--tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp82
-rw-r--r--tests/auto/gui/kernel/qguitimer/.prev_CMakeLists.txt14
-rw-r--r--tests/auto/gui/kernel/qguitimer/CMakeLists.txt15
-rw-r--r--tests/auto/gui/kernel/qguivariant/CMakeLists.txt4
-rw-r--r--tests/auto/gui/kernel/qguivariant/no_application/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt38
-rw-r--r--tests/auto/gui/kernel/qinputmethod/CMakeLists.txt15
-rw-r--r--tests/auto/gui/kernel/qkeyevent/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp6
-rw-r--r--tests/auto/gui/kernel/qkeysequence/CMakeLists.txt29
-rw-r--r--tests/auto/gui/kernel/qmouseevent/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qmouseevent_modal/CMakeLists.txt13
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/CMakeLists.txt16
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro2
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp2
-rw-r--r--tests/auto/gui/kernel/qpalette/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qpalette/tst_qpalette.cpp89
-rw-r--r--tests/auto/gui/kernel/qpixelformat/CMakeLists.txt12
-rw-r--r--tests/auto/gui/kernel/qrasterwindow/CMakeLists.txt15
-rw-r--r--tests/auto/gui/kernel/qscreen/CMakeLists.txt15
-rw-r--r--tests/auto/gui/kernel/qsurfaceformat/CMakeLists.txt15
-rw-r--r--tests/auto/gui/kernel/qtouchevent/CMakeLists.txt15
-rw-r--r--tests/auto/gui/kernel/qwindow/CMakeLists.txt23
53 files changed, 1348 insertions, 30 deletions
diff --git a/tests/auto/gui/kernel/CMakeLists.txt b/tests/auto/gui/kernel/CMakeLists.txt
new file mode 100644
index 0000000000..b2397bed19
--- /dev/null
+++ b/tests/auto/gui/kernel/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Generated from kernel.pro.
+
+add_subdirectory(qbackingstore)
+add_subdirectory(qcursor)
+add_subdirectory(qdrag)
+add_subdirectory(qevent)
+add_subdirectory(qfileopenevent)
+add_subdirectory(qguieventdispatcher)
+add_subdirectory(qguimetatype)
+add_subdirectory(qguitimer)
+add_subdirectory(qguivariant)
+add_subdirectory(qinputmethod)
+add_subdirectory(qkeyevent)
+add_subdirectory(qkeysequence)
+add_subdirectory(qmouseevent)
+add_subdirectory(qpalette)
+add_subdirectory(qscreen)
+add_subdirectory(qsurfaceformat)
+add_subdirectory(qwindow)
+add_subdirectory(qguiapplication)
+add_subdirectory(qpixelformat)
+add_subdirectory(qrasterwindow)
+if(NOT ANDROID AND NOT APPLE_UIKIT)
+ add_subdirectory(qclipboard)
+endif()
+if(TARGET Qt::Network)
+ add_subdirectory(qguieventloop)
+endif()
+if(TARGET Qt::Widgets)
+ add_subdirectory(qmouseevent_modal)
+ add_subdirectory(qtouchevent)
+endif()
+if(QT_FEATURE_opengl)
+ add_subdirectory(qopenglwindow)
+endif()
+if(TARGET Qt::Network AND WIN32 AND NOT WINRT)
+ add_subdirectory(noqteventloop)
+endif()
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 42135dae24..106e9050b8 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -4,11 +4,14 @@ SUBDIRS=\
qclipboard \
qcursor \
qdrag \
+ qguiaction \
+ qguiactiongroup \
qevent \
qfileopenevent \
qguieventdispatcher \
qguieventloop \
qguimetatype \
+ qguishortcut \
qguitimer \
qguivariant \
qhighdpiscaling \
@@ -29,6 +32,12 @@ SUBDIRS=\
win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
+!qtConfig(shortcut): SUBDIRS -= \
+ qkeysequence \
+ qguishortcut \
+ qguimetatype \
+ qguivariant
+
!qtHaveModule(widgets): SUBDIRS -= \
qmouseevent_modal \
qtouchevent
@@ -36,6 +45,10 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
!qtHaveModule(network): SUBDIRS -= \
qguieventloop
+!qtConfig(action): SUBDIRS -= \
+ qguiaction \
+ qguiactiongroup
+
!qtConfig(highdpiscaling): SUBDIRS -= qhighdpiscaling
!qtConfig(opengl): SUBDIRS -= qopenglwindow
diff --git a/tests/auto/gui/kernel/noqteventloop/CMakeLists.txt b/tests/auto/gui/kernel/noqteventloop/CMakeLists.txt
new file mode 100644
index 0000000000..7161c47db1
--- /dev/null
+++ b/tests/auto/gui/kernel/noqteventloop/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Generated from noqteventloop.pro.
+
+#####################################################################
+## tst_noqteventloop Test:
+#####################################################################
+
+add_qt_test(tst_noqteventloop
+ SOURCES
+ tst_noqteventloop.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Network
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_noqteventloop CONDITION QT_FEATURE_dynamicgl AND WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ user32
+)
diff --git a/tests/auto/gui/kernel/qbackingstore/CMakeLists.txt b/tests/auto/gui/kernel/qbackingstore/CMakeLists.txt
new file mode 100644
index 0000000000..d657196113
--- /dev/null
+++ b/tests/auto/gui/kernel/qbackingstore/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qbackingstore.pro.
+
+#####################################################################
+## tst_qbackingstore Test:
+#####################################################################
+
+add_qt_test(tst_qbackingstore
+ SOURCES
+ tst_qbackingstore.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qclipboard/CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/CMakeLists.txt
new file mode 100644
index 0000000000..b795d32520
--- /dev/null
+++ b/tests/auto/gui/kernel/qclipboard/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Generated from qclipboard.pro.
+
+add_subdirectory(test)
+if(NOT WINRT)
+ add_subdirectory(copier)
+ add_subdirectory(paster)
+endif()
diff --git a/tests/auto/gui/kernel/qclipboard/copier/CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/copier/CMakeLists.txt
new file mode 100644
index 0000000000..30990c1387
--- /dev/null
+++ b/tests/auto/gui/kernel/qclipboard/copier/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from copier.pro.
+
+#####################################################################
+## copier Binary:
+#####################################################################
+
+add_qt_executable(copier
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:copier.pro:WIN32:
+# DESTDIR = "../copier"
diff --git a/tests/auto/gui/kernel/qclipboard/paster/CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/paster/CMakeLists.txt
new file mode 100644
index 0000000000..2c90c1530f
--- /dev/null
+++ b/tests/auto/gui/kernel/qclipboard/paster/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from paster.pro.
+
+#####################################################################
+## paster Binary:
+#####################################################################
+
+add_qt_executable(paster
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:paster.pro:WIN32:
+# DESTDIR = "../paster"
diff --git a/tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..620ef96a5b
--- /dev/null
+++ b/tests/auto/gui/kernel/qclipboard/test/.prev_CMakeLists.txt
@@ -0,0 +1,24 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qclipboard Test:
+#####################################################################
+
+add_qt_test(tst_qclipboard
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../tst_qclipboard.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qclipboard CONDITION APPLE_OSX
+ PUBLIC_LIBRARIES
+ ${FWAppKit}
+)
+
+#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT:
+# TEST_HELPER_INSTALLS = "../copier/copier" "../paster/paster"
diff --git a/tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt b/tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt
new file mode 100644
index 0000000000..620ef96a5b
--- /dev/null
+++ b/tests/auto/gui/kernel/qclipboard/test/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qclipboard Test:
+#####################################################################
+
+add_qt_test(tst_qclipboard
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../tst_qclipboard.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qclipboard CONDITION APPLE_OSX
+ PUBLIC_LIBRARIES
+ ${FWAppKit}
+)
+
+#### Keys ignored in scope 6:.:.:test.pro:NOT ANDROID AND NOT WINRT:
+# TEST_HELPER_INSTALLS = "../copier/copier" "../paster/paster"
diff --git a/tests/auto/gui/kernel/qcursor/CMakeLists.txt b/tests/auto/gui/kernel/qcursor/CMakeLists.txt
new file mode 100644
index 0000000000..8f4062a42a
--- /dev/null
+++ b/tests/auto/gui/kernel/qcursor/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qcursor.pro.
+
+#####################################################################
+## tst_qcursor Test:
+#####################################################################
+
+add_qt_test(tst_qcursor
+ SOURCES
+ tst_qcursor.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qdrag/CMakeLists.txt b/tests/auto/gui/kernel/qdrag/CMakeLists.txt
new file mode 100644
index 0000000000..84bceaf0de
--- /dev/null
+++ b/tests/auto/gui/kernel/qdrag/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qdrag.pro.
+
+#####################################################################
+## tst_qdrag Test:
+#####################################################################
+
+add_qt_test(tst_qdrag
+ SOURCES
+ tst_qdrag.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qevent/CMakeLists.txt b/tests/auto/gui/kernel/qevent/CMakeLists.txt
new file mode 100644
index 0000000000..01d6db7225
--- /dev/null
+++ b/tests/auto/gui/kernel/qevent/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qevent.pro.
+
+#####################################################################
+## tst_qevent Test:
+#####################################################################
+
+add_qt_test(tst_qevent
+ SOURCES
+ tst_qevent.cpp
+)
diff --git a/tests/auto/gui/kernel/qfileopenevent/CMakeLists.txt b/tests/auto/gui/kernel/qfileopenevent/CMakeLists.txt
new file mode 100644
index 0000000000..2404833737
--- /dev/null
+++ b/tests/auto/gui/kernel/qfileopenevent/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Generated from qfileopenevent.pro.
+
+add_subdirectory(test)
+add_subdirectory(qfileopeneventexternal)
diff --git a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/CMakeLists.txt b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/CMakeLists.txt
new file mode 100644
index 0000000000..0c50f7ff56
--- /dev/null
+++ b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Generated from qfileopeneventexternal.pro.
+
+#####################################################################
+## qfileopeneventexternal Binary:
+#####################################################################
+
+add_qt_executable(qfileopeneventexternal
+ GUI
+ SOURCES
+ qfileopeneventexternal.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+#### Keys ignored in scope 1:.:.:qfileopeneventexternal.pro:<TRUE>:
+# TEMPLATE = "app"
diff --git a/tests/auto/gui/kernel/qfileopenevent/test/CMakeLists.txt b/tests/auto/gui/kernel/qfileopenevent/test/CMakeLists.txt
new file mode 100644
index 0000000000..6695ef42b3
--- /dev/null
+++ b/tests/auto/gui/kernel/qfileopenevent/test/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qfileopenevent Test:
+#####################################################################
+
+add_qt_test(tst_qfileopenevent
+ SOURCES
+ tst_qfileopenevent.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qguiaction/.gitignore b/tests/auto/gui/kernel/qguiaction/.gitignore
new file mode 100644
index 0000000000..bf81f5bf2c
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiaction/.gitignore
@@ -0,0 +1 @@
+tst_qaction
diff --git a/tests/auto/gui/kernel/qguiaction/qguiaction.pro b/tests/auto/gui/kernel/qguiaction/qguiaction.pro
new file mode 100644
index 0000000000..2a39636119
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiaction/qguiaction.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qguiaction
+QT += gui-private core-private testlib
+SOURCES += tst_qguiaction.cpp
diff --git a/tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp b/tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp
new file mode 100644
index 0000000000..9d45d4ae14
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp
@@ -0,0 +1,210 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <qguiapplication.h>
+#include <qevent.h>
+#include <qguiaction.h>
+#include <qguiactiongroup.h>
+#include <qpa/qplatformtheme.h>
+
+#include <private/qguiapplication_p.h>
+
+class tst_QGuiAction : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QGuiAction();
+
+private slots:
+ void cleanup();
+ void getSetCheck();
+ void setText_data();
+ void setText();
+ void setIconText_data() { setText_data(); }
+ void setIconText();
+#if QT_CONFIG(shortcut)
+ void setStandardKeys();
+ void task200823_tooltip();
+#endif
+ void task229128TriggeredSignalWithoutActiongroup();
+ void setData();
+
+private:
+ const int m_keyboardScheme;
+};
+
+tst_QGuiAction::tst_QGuiAction()
+ : m_keyboardScheme(QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt())
+{
+}
+
+void tst_QGuiAction::cleanup()
+{
+ QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
+}
+
+// Testing get/set functions
+void tst_QGuiAction::getSetCheck()
+{
+ QGuiAction obj1(nullptr);
+ // QActionGroup * QAction::actionGroup()
+ // void QAction::setActionGroup(QActionGroup *)
+ auto var1 = new QGuiActionGroup(nullptr);
+ obj1.setActionGroup(var1);
+ QCOMPARE(var1, obj1.guiActionGroup());
+ obj1.setActionGroup(nullptr);
+ QCOMPARE(obj1.guiActionGroup(), nullptr);
+ delete var1;
+
+ QCOMPARE(obj1.priority(), QGuiAction::NormalPriority);
+ obj1.setPriority(QGuiAction::LowPriority);
+ QCOMPARE(obj1.priority(), QGuiAction::LowPriority);
+}
+
+void tst_QGuiAction::setText_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("iconText");
+ QTest::addColumn<QString>("textFromIconText");
+
+ //next we fill it with data
+ QTest::newRow("Normal") << "Action" << "Action" << "Action";
+ QTest::newRow("Ampersand") << "Search && Destroy" << "Search & Destroy" << "Search && Destroy";
+ QTest::newRow("Mnemonic and ellipsis") << "O&pen File ..." << "Open File" << "Open File";
+}
+
+void tst_QGuiAction::setText()
+{
+ QFETCH(QString, text);
+
+ QGuiAction action(nullptr);
+ action.setText(text);
+
+ QCOMPARE(action.text(), text);
+
+ QFETCH(QString, iconText);
+ QCOMPARE(action.iconText(), iconText);
+}
+
+void tst_QGuiAction::setIconText()
+{
+ QFETCH(QString, iconText);
+
+ QGuiAction action(nullptr);
+ action.setIconText(iconText);
+ QCOMPARE(action.iconText(), iconText);
+
+ QFETCH(QString, textFromIconText);
+ QCOMPARE(action.text(), textFromIconText);
+}
+
+#if QT_CONFIG(shortcut)
+
+//basic testing of standard keys
+void tst_QGuiAction::setStandardKeys()
+{
+ QGuiAction act(nullptr);
+ act.setShortcut(QKeySequence("CTRL+L"));
+ QList<QKeySequence> list;
+ act.setShortcuts(list);
+ act.setShortcuts(QKeySequence::Copy);
+ QCOMPARE(act.shortcut(), act.shortcuts().constFirst());
+
+ QList<QKeySequence> expected;
+ const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
+ const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT"));
+ switch (m_keyboardScheme) {
+ case QPlatformTheme::MacKeyboardScheme:
+ expected << ctrlC;
+ break;
+ case QPlatformTheme::WindowsKeyboardScheme:
+ expected << ctrlC << ctrlInsert;
+ break;
+ default: // X11
+ expected << ctrlC << ctrlInsert << QKeySequence(QStringLiteral("F16"));
+ break;
+ }
+
+ QCOMPARE(act.shortcuts(), expected);
+}
+
+void tst_QGuiAction::task200823_tooltip()
+{
+ const QScopedPointer<QGuiAction> action(new QGuiAction("foo", nullptr));
+ QString shortcut("ctrl+o");
+ action->setShortcut(shortcut);
+
+ // we want a non-standard tooltip that shows the shortcut
+ action->setToolTip(action->text() + QLatin1String(" (") + action->shortcut().toString() + QLatin1Char(')'));
+
+ QString ref = QLatin1String("foo (") + QKeySequence(shortcut).toString() + QLatin1Char(')');
+ QCOMPARE(action->toolTip(), ref);
+}
+
+#endif // QT_CONFIG(shortcut)
+
+void tst_QGuiAction::task229128TriggeredSignalWithoutActiongroup()
+{
+ // test without a group
+ const QScopedPointer<QGuiAction> actionWithoutGroup(new QGuiAction("Test", nullptr));
+ QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), QOverload<bool>::of(&QGuiAction::triggered));
+ QCOMPARE(spyWithoutGroup.count(), 0);
+ actionWithoutGroup->trigger();
+ // signal should be emitted
+ QCOMPARE(spyWithoutGroup.count(), 1);
+
+ // it is now a checkable checked action
+ actionWithoutGroup->setCheckable(true);
+ actionWithoutGroup->setChecked(true);
+ spyWithoutGroup.clear();
+ QCOMPARE(spyWithoutGroup.count(), 0);
+ actionWithoutGroup->trigger();
+ // signal should be emitted
+ QCOMPARE(spyWithoutGroup.count(), 1);
+}
+
+void tst_QGuiAction::setData() // QTBUG-62006
+{
+ QGuiAction act(nullptr);
+ QSignalSpy spy(&act, &QGuiAction::changed);
+ QCOMPARE(act.data(), QVariant());
+ QCOMPARE(spy.count(), 0);
+ act.setData(QVariant());
+ QCOMPARE(spy.count(), 0);
+
+ act.setData(-1);
+ QCOMPARE(spy.count(), 1);
+ act.setData(-1);
+ QCOMPARE(spy.count(), 1);
+}
+
+QTEST_MAIN(tst_QGuiAction)
+#include "tst_qguiaction.moc"
diff --git a/tests/auto/gui/kernel/qguiactiongroup/.gitignore b/tests/auto/gui/kernel/qguiactiongroup/.gitignore
new file mode 100644
index 0000000000..daba003e96
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiactiongroup/.gitignore
@@ -0,0 +1 @@
+tst_qactiongroup
diff --git a/tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro b/tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro
new file mode 100644
index 0000000000..7fd64e70f1
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qactiongroup
+QT += testlib
+SOURCES += tst_qguiactiongroup.cpp
diff --git a/tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp b/tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp
new file mode 100644
index 0000000000..1ac14280fb
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp
@@ -0,0 +1,235 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <qguiaction.h>
+#include <qguiactiongroup.h>
+
+class tst_QGuiActionGroup : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void cleanup() { QVERIFY(QGuiApplication::topLevelWindows().isEmpty()); }
+ void enabledPropagation();
+ void visiblePropagation();
+ void exclusive();
+ void exclusiveOptional();
+ void testActionInTwoQActionGroup();
+ void unCheckCurrentAction();
+};
+
+void tst_QGuiActionGroup::enabledPropagation()
+{
+ QGuiActionGroup testActionGroup(nullptr);
+
+ auto childAction = new QGuiAction( &testActionGroup );
+ auto anotherChildAction = new QGuiAction( &testActionGroup );
+ auto freeAction = new QGuiAction(nullptr);
+
+ QVERIFY( testActionGroup.isEnabled() );
+ QVERIFY( childAction->isEnabled() );
+
+ testActionGroup.setEnabled( false );
+ QVERIFY( !testActionGroup.isEnabled() );
+ QVERIFY( !childAction->isEnabled() );
+ QVERIFY( !anotherChildAction->isEnabled() );
+
+ childAction->setEnabled(true);
+ QVERIFY( !childAction->isEnabled());
+
+ anotherChildAction->setEnabled( false );
+
+ testActionGroup.setEnabled( true );
+ QVERIFY( testActionGroup.isEnabled() );
+ QVERIFY( childAction->isEnabled() );
+ QVERIFY( !anotherChildAction->isEnabled() );
+
+ testActionGroup.setEnabled( false );
+ auto lastChildAction = new QGuiAction(&testActionGroup);
+
+ QVERIFY(!lastChildAction->isEnabled());
+ testActionGroup.setEnabled( true );
+ QVERIFY(lastChildAction->isEnabled());
+
+ freeAction->setEnabled(false);
+ testActionGroup.addAction(freeAction);
+ QVERIFY(!freeAction->isEnabled());
+ delete freeAction;
+}
+
+void tst_QGuiActionGroup::visiblePropagation()
+{
+ QGuiActionGroup testActionGroup(nullptr);
+
+ auto childAction = new QGuiAction( &testActionGroup );
+ auto anotherChildAction = new QGuiAction( &testActionGroup );
+ auto freeAction = new QGuiAction(nullptr);
+
+ QVERIFY( testActionGroup.isVisible() );
+ QVERIFY( childAction->isVisible() );
+
+ testActionGroup.setVisible( false );
+ QVERIFY( !testActionGroup.isVisible() );
+ QVERIFY( !childAction->isVisible() );
+ QVERIFY( !anotherChildAction->isVisible() );
+
+ anotherChildAction->setVisible(false);
+
+ testActionGroup.setVisible( true );
+ QVERIFY( testActionGroup.isVisible() );
+ QVERIFY( childAction->isVisible() );
+
+ QVERIFY( !anotherChildAction->isVisible() );
+
+ testActionGroup.setVisible( false );
+ auto lastChildAction = new QGuiAction(&testActionGroup);
+
+ QVERIFY(!lastChildAction->isVisible());
+ testActionGroup.setVisible( true );
+ QVERIFY(lastChildAction->isVisible());
+
+ freeAction->setVisible(false);
+ testActionGroup.addAction(freeAction);
+ QVERIFY(!freeAction->isVisible());
+ delete freeAction;
+}
+
+void tst_QGuiActionGroup::exclusive()
+{
+ QGuiActionGroup group(nullptr);
+ group.setExclusive(false);
+ QVERIFY( !group.isExclusive() );
+
+ auto actOne = new QGuiAction(&group);
+ actOne->setCheckable( true );
+ auto actTwo = new QGuiAction(&group);
+ actTwo->setCheckable( true );
+ auto actThree = new QGuiAction(&group);
+ actThree->setCheckable( true );
+
+ group.setExclusive( true );
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->setChecked( true );
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->setChecked( true );
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+}
+
+void tst_QGuiActionGroup::exclusiveOptional()
+{
+ QGuiActionGroup group(0);
+ group.setExclusive(true);
+ QVERIFY( group.isExclusive() );
+
+ auto actOne = new QGuiAction(&group);
+ actOne->setCheckable( true );
+ auto actTwo = new QGuiAction(&group);
+ actTwo->setCheckable( true );
+ auto actThree = new QGuiAction(&group);
+ actThree->setCheckable( true );
+
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->trigger();
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->trigger();
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ group.setExclusionPolicy(QGuiActionGroup::ExclusionPolicy::ExclusiveOptional);
+ QVERIFY( group.isExclusive() );
+
+ actOne->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+}
+
+void tst_QGuiActionGroup::testActionInTwoQActionGroup()
+{
+ QGuiAction action1("Action 1", this);
+
+ QGuiActionGroup group1(this);
+ QGuiActionGroup group2(this);
+
+ group1.addAction(&action1);
+ group2.addAction(&action1);
+
+ QCOMPARE(action1.guiActionGroup(), &group2);
+ QCOMPARE(group2.guiActions().constFirst(), &action1);
+ QCOMPARE(group1.guiActions().isEmpty(), true);
+}
+
+void tst_QGuiActionGroup::unCheckCurrentAction()
+{
+ QGuiActionGroup group(nullptr);
+ QGuiAction action1(&group) ,action2(&group);
+ action1.setCheckable(true);
+ action2.setCheckable(true);
+ QVERIFY(!action1.isChecked());
+ QVERIFY(!action2.isChecked());
+ action1.setChecked(true);
+ QVERIFY(action1.isChecked());
+ QVERIFY(!action2.isChecked());
+ auto current = group.checkedGuiAction();
+ QCOMPARE(current, &action1);
+ current->setChecked(false);
+ QVERIFY(!action1.isChecked());
+ QVERIFY(!action2.isChecked());
+ QVERIFY(!group.checkedGuiAction());
+}
+
+
+QTEST_MAIN(tst_QGuiActionGroup)
+#include "tst_qguiactiongroup.moc"
diff --git a/tests/auto/gui/kernel/qguiapplication/.prev_CMakeLists.txt b/tests/auto/gui/kernel/qguiapplication/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..1874a33794
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiapplication/.prev_CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from qguiapplication.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qguiapplication Test:
+#####################################################################
+
+add_qt_test(tst_qguiapplication
+ SOURCES
+ tst_qcoreapplication.cpp tst_qcoreapplication.h
+ tst_qguiapplication.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0x050E00
+ INCLUDE_DIRECTORIES
+ ../../../corelib/kernel/qcoreapplication
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+# Resources:
+set(tst_qguiapplication_resource_files
+ "icons/appicon.png"
+ "icons/usericon.png"
+)
+
+add_qt_resource(tst_qguiapplication "tst_qguiapplication"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qguiapplication_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 3:.:../../../corelib/kernel/qcoreapplication:../../../corelib/kernel/qcoreapplication/qcoreapplication.pro:WIN32:
+# VERSION = "1.2.3.4"
+
+#### Keys ignored in scope 4:.:../../../corelib/kernel/qcoreapplication:../../../corelib/kernel/qcoreapplication/qcoreapplication.pro:else:
+# VERSION = "1.2.3"
diff --git a/tests/auto/gui/kernel/qguiapplication/BLACKLIST b/tests/auto/gui/kernel/qguiapplication/BLACKLIST
index e6ffe78ae3..58ca7bf782 100644
--- a/tests/auto/gui/kernel/qguiapplication/BLACKLIST
+++ b/tests/auto/gui/kernel/qguiapplication/BLACKLIST
@@ -1,3 +1,6 @@
[focusObject]
ubuntu-16.04
opensuse-42.3
+
+[quitOnLastWindowClosedMulti]
+macos ci
diff --git a/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt
new file mode 100644
index 0000000000..09498e2a39
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Generated from qguiapplication.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qguiapplication Test:
+#####################################################################
+
+add_qt_test(tst_qguiapplication
+ SOURCES
+ ../../../corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp ../../../corelib/kernel/qcoreapplication/tst_qcoreapplication.h # special case
+ tst_qguiapplication.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0x050E00
+ INCLUDE_DIRECTORIES
+ ../../../corelib/kernel/qcoreapplication
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Threads::Threads # special case
+)
+
+# Resources:
+set(tst_qguiapplication_resource_files
+ "icons/appicon.png"
+ "icons/usericon.png"
+)
+
+add_qt_resource(tst_qguiapplication "tst_qguiapplication"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qguiapplication_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 3:.:../../../corelib/kernel/qcoreapplication:../../../corelib/kernel/qcoreapplication/qcoreapplication.pro:WIN32:
+# VERSION = "1.2.3.4"
+
+#### Keys ignored in scope 4:.:../../../corelib/kernel/qcoreapplication:../../../corelib/kernel/qcoreapplication/qcoreapplication.pro:else:
+# VERSION = "1.2.3"
diff --git a/tests/auto/gui/kernel/qguieventdispatcher/CMakeLists.txt b/tests/auto/gui/kernel/qguieventdispatcher/CMakeLists.txt
new file mode 100644
index 0000000000..eb36e0ece7
--- /dev/null
+++ b/tests/auto/gui/kernel/qguieventdispatcher/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qguieventdispatcher.pro.
+
+#####################################################################
+## tst_qguieventdispatcher Test:
+#####################################################################
+
+add_qt_test(tst_qguieventdispatcher
+ SOURCES
+ ../../../corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt b/tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..c4daa5a310
--- /dev/null
+++ b/tests/auto/gui/kernel/qguieventloop/.prev_CMakeLists.txt
@@ -0,0 +1,28 @@
+# Generated from qguieventloop.pro.
+
+#####################################################################
+## tst_qguieventloop Test:
+#####################################################################
+
+add_qt_test(tst_qguieventloop
+ SOURCES
+ ../../../corelib/kernel/qeventloop/tst_qeventloop.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Network
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qguieventloop CONDITION WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ user32
+)
+
+extend_target(tst_qguieventloop CONDITION QT_FEATURE_glib
+ DEFINES
+ HAVE_GLIB
+)
diff --git a/tests/auto/gui/kernel/qguieventloop/CMakeLists.txt b/tests/auto/gui/kernel/qguieventloop/CMakeLists.txt
new file mode 100644
index 0000000000..c4daa5a310
--- /dev/null
+++ b/tests/auto/gui/kernel/qguieventloop/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Generated from qguieventloop.pro.
+
+#####################################################################
+## tst_qguieventloop Test:
+#####################################################################
+
+add_qt_test(tst_qguieventloop
+ SOURCES
+ ../../../corelib/kernel/qeventloop/tst_qeventloop.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Network
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qguieventloop CONDITION WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ user32
+)
+
+extend_target(tst_qguieventloop CONDITION QT_FEATURE_glib
+ DEFINES
+ HAVE_GLIB
+)
diff --git a/tests/auto/gui/kernel/qguimetatype/CMakeLists.txt b/tests/auto/gui/kernel/qguimetatype/CMakeLists.txt
new file mode 100644
index 0000000000..3701b3983a
--- /dev/null
+++ b/tests/auto/gui/kernel/qguimetatype/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qguimetatype.pro.
+
+#####################################################################
+## tst_qguimetatype Test:
+#####################################################################
+
+add_qt_test(tst_qguimetatype
+ SOURCES
+ tst_qguimetatype.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index 81f0183728..d60d6643b2 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -181,9 +181,13 @@ template<> struct TestValueFactory<QMetaType::QCursor> {
static QCursor *create() { return new QCursor(Qt::WaitCursor); }
};
#endif
+
+#if QT_CONFIG(shortcut)
template<> struct TestValueFactory<QMetaType::QKeySequence> {
static QKeySequence *create() { return new QKeySequence(QKeySequence::Close); }
};
+#endif
+
template<> struct TestValueFactory<QMetaType::QPen> {
static QPen *create() { return new QPen(Qt::DashDotDotLine); }
};
@@ -317,30 +321,10 @@ void tst_QGuiMetaType::sizeOf()
QCOMPARE(QMetaType::sizeOf(type), size);
}
-#ifndef Q_ALIGNOF
-template<uint N>
-struct RoundToNextHighestPowerOfTwo
-{
-private:
- enum { V1 = N-1 };
- enum { V2 = V1 | (V1 >> 1) };
- enum { V3 = V2 | (V2 >> 2) };
- enum { V4 = V3 | (V3 >> 4) };
- enum { V5 = V4 | (V4 >> 8) };
- enum { V6 = V5 | (V5 >> 16) };
-public:
- enum { Value = V6 + 1 };
-};
-#endif
-
template<class T>
struct TypeAlignment
{
-#ifdef Q_ALIGNOF
- enum { Value = Q_ALIGNOF(T) };
-#else
- enum { Value = RoundToNextHighestPowerOfTwo<sizeof(T)>::Value };
-#endif
+ enum { Value = alignof(T) };
};
void tst_QGuiMetaType::flags_data()
diff --git a/tests/auto/gui/kernel/qguishortcut/qguishortcut.pro b/tests/auto/gui/kernel/qguishortcut/qguishortcut.pro
new file mode 100644
index 0000000000..1417dee213
--- /dev/null
+++ b/tests/auto/gui/kernel/qguishortcut/qguishortcut.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qguishortcut
+QT += testlib
+SOURCES += tst_qguishortcut.cpp
diff --git a/tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp b/tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp
new file mode 100644
index 0000000000..bc3fb9862d
--- /dev/null
+++ b/tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qguishortcut.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qrasterwindow.h>
+#include <QtGui/qscreen.h>
+#include <QtGui/qwindow.h>
+
+class tst_QGuiShortcut : public QObject
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void trigger();
+};
+
+class ColoredWindow : public QRasterWindow {
+public:
+ ColoredWindow(QColor c) : m_color(c) {}
+
+protected:
+ void paintEvent(QPaintEvent *event) override;
+
+private:
+ const QColor m_color;
+};
+
+void ColoredWindow::paintEvent(QPaintEvent *)
+{
+ QPainter p(this);
+ p.fillRect(QRect(QPoint(), size()), m_color);
+}
+
+static void sendKey(QWindow *target, Qt::Key k, char c, Qt::KeyboardModifiers modifiers)
+{
+ QTest::sendKeyEvent(QTest::Press, target, k, c, modifiers);
+ QTest::sendKeyEvent(QTest::Release, target, k, c, modifiers);
+}
+
+void tst_QGuiShortcut::trigger()
+{
+ ColoredWindow w(Qt::yellow);
+ w.setTitle(QTest::currentTestFunction());
+ w.resize(QGuiApplication::primaryScreen()->size() / 4);
+ new QGuiShortcut(Qt::CTRL + Qt::Key_Q, &w, SLOT(close()));
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ sendKey(&w, Qt::Key_Q, 'q', Qt::ControlModifier);
+ QTRY_VERIFY(!w.isVisible());
+}
+
+QTEST_MAIN(tst_QGuiShortcut)
+#include "tst_qguishortcut.moc"
diff --git a/tests/auto/gui/kernel/qguitimer/.prev_CMakeLists.txt b/tests/auto/gui/kernel/qguitimer/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..6d0f3cbbee
--- /dev/null
+++ b/tests/auto/gui/kernel/qguitimer/.prev_CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qguitimer.pro.
+
+#####################################################################
+## tst_qguitimer Test:
+#####################################################################
+
+add_qt_test(tst_qguitimer
+ SOURCES
+ ../../../corelib/kernel/qtimer/tst_qtimer.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qguitimer/CMakeLists.txt b/tests/auto/gui/kernel/qguitimer/CMakeLists.txt
new file mode 100644
index 0000000000..5f255d49e4
--- /dev/null
+++ b/tests/auto/gui/kernel/qguitimer/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qguitimer.pro.
+
+#####################################################################
+## tst_qguitimer Test:
+#####################################################################
+
+add_qt_test(tst_qguitimer
+ SOURCES
+ ../../../corelib/kernel/qtimer/tst_qtimer.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Threads::Threads # special case
+)
diff --git a/tests/auto/gui/kernel/qguivariant/CMakeLists.txt b/tests/auto/gui/kernel/qguivariant/CMakeLists.txt
new file mode 100644
index 0000000000..3a0adab6e3
--- /dev/null
+++ b/tests/auto/gui/kernel/qguivariant/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Generated from qguivariant.pro.
+
+add_subdirectory(test)
+add_subdirectory(no_application)
diff --git a/tests/auto/gui/kernel/qguivariant/no_application/CMakeLists.txt b/tests/auto/gui/kernel/qguivariant/no_application/CMakeLists.txt
new file mode 100644
index 0000000000..8261212801
--- /dev/null
+++ b/tests/auto/gui/kernel/qguivariant/no_application/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from no_application.pro.
+
+#####################################################################
+## no_application Test:
+#####################################################################
+
+add_qt_test(no_application
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt b/tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt
new file mode 100644
index 0000000000..af2cea60e6
--- /dev/null
+++ b/tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qguivariant Test:
+#####################################################################
+
+add_qt_test(tst_qguivariant
+ SOURCES
+ tst_qguivariant.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../other/qvariant_common
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+# Resources:
+set(tst_qguivariant_resource_files
+ "black.png"
+ "black2.png"
+)
+
+add_qt_resource(tst_qguivariant "tst_qguivariant"
+ PREFIX
+ "/"
+ FILES
+ ${tst_qguivariant_resource_files}
+)
+set(qguivariant_resource_files
+ "data"
+)
+
+add_qt_resource(tst_qguivariant "qguivariant"
+ PREFIX
+ "/"
+ FILES
+ ${qguivariant_resource_files}
+)
+
diff --git a/tests/auto/gui/kernel/qinputmethod/CMakeLists.txt b/tests/auto/gui/kernel/qinputmethod/CMakeLists.txt
new file mode 100644
index 0000000000..f0f09818e5
--- /dev/null
+++ b/tests/auto/gui/kernel/qinputmethod/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qinputmethod.pro.
+
+#####################################################################
+## tst_qinputmethod Test:
+#####################################################################
+
+add_qt_test(tst_qinputmethod
+ SOURCES
+ tst_qinputmethod.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qkeyevent/CMakeLists.txt b/tests/auto/gui/kernel/qkeyevent/CMakeLists.txt
new file mode 100644
index 0000000000..2e36795375
--- /dev/null
+++ b/tests/auto/gui/kernel/qkeyevent/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qkeyevent.pro.
+
+#####################################################################
+## tst_qkeyevent Test:
+#####################################################################
+
+add_qt_test(tst_qkeyevent
+ SOURCES
+ tst_qkeyevent.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
index 87a47bd93b..6a928cac7a 100644
--- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
+++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
@@ -64,8 +64,10 @@ public:
private slots:
void basicEventDelivery();
+#if QT_CONFIG(shortcut)
void modifiers_data();
void modifiers();
+#endif
};
tst_QKeyEvent::tst_QKeyEvent()
@@ -128,6 +130,8 @@ static QByteArray modifiersTestRowName(const QString &keySequence)
return result;
}
+#if QT_CONFIG(shortcut)
+
void tst_QKeyEvent::modifiers_data()
{
struct Modifier
@@ -198,5 +202,7 @@ void tst_QKeyEvent::modifiers()
}
}
+#endif // QT_CONFIG(shortcut)
+
QTEST_MAIN(tst_QKeyEvent)
#include "tst_qkeyevent.moc"
diff --git a/tests/auto/gui/kernel/qkeysequence/CMakeLists.txt b/tests/auto/gui/kernel/qkeysequence/CMakeLists.txt
new file mode 100644
index 0000000000..01f03fac76
--- /dev/null
+++ b/tests/auto/gui/kernel/qkeysequence/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Generated from qkeysequence.pro.
+
+#####################################################################
+## tst_qkeysequence Test:
+#####################################################################
+
+add_qt_test(tst_qkeysequence
+ SOURCES
+ tst_qkeysequence.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+# Resources:
+set(qkeysequence_resource_files
+ "keys_de.qm"
+ "qt_de.qm"
+)
+
+add_qt_resource(tst_qkeysequence "qkeysequence"
+ PREFIX
+ "/"
+ FILES
+ ${qkeysequence_resource_files}
+)
+
diff --git a/tests/auto/gui/kernel/qmouseevent/CMakeLists.txt b/tests/auto/gui/kernel/qmouseevent/CMakeLists.txt
new file mode 100644
index 0000000000..4e1081c6ad
--- /dev/null
+++ b/tests/auto/gui/kernel/qmouseevent/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qmouseevent.pro.
+
+#####################################################################
+## tst_qmouseevent Test:
+#####################################################################
+
+add_qt_test(tst_qmouseevent
+ SOURCES
+ tst_qmouseevent.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qmouseevent_modal/CMakeLists.txt b/tests/auto/gui/kernel/qmouseevent_modal/CMakeLists.txt
new file mode 100644
index 0000000000..c7f447ffeb
--- /dev/null
+++ b/tests/auto/gui/kernel/qmouseevent_modal/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qmouseevent_modal.pro.
+
+#####################################################################
+## tst_qmouseevent_modal Test:
+#####################################################################
+
+add_qt_test(tst_qmouseevent_modal
+ SOURCES
+ tst_qmouseevent_modal.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/tests/auto/gui/kernel/qopenglwindow/CMakeLists.txt b/tests/auto/gui/kernel/qopenglwindow/CMakeLists.txt
new file mode 100644
index 0000000000..c8e3789886
--- /dev/null
+++ b/tests/auto/gui/kernel/qopenglwindow/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Generated from qopenglwindow.pro.
+
+#####################################################################
+## tst_qopenglwindow Test:
+#####################################################################
+
+add_qt_test(tst_qopenglwindow
+ SOURCES
+ tst_qopenglwindow.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::OpenGL
+)
diff --git a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
index 759b608c93..28b12f0677 100644
--- a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
+++ b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qopenglwindow
-QT += core-private gui-private testlib
+QT += opengl core-private gui-private testlib
SOURCES += tst_qopenglwindow.cpp
diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
index 9c36b6898a..2785d57a42 100644
--- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
+++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
@@ -26,7 +26,7 @@
**
****************************************************************************/
-#include <QtGui/QOpenGLWindow>
+#include <QtOpenGL/QOpenGLWindow>
#include <QtTest/QtTest>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLContext>
diff --git a/tests/auto/gui/kernel/qpalette/CMakeLists.txt b/tests/auto/gui/kernel/qpalette/CMakeLists.txt
new file mode 100644
index 0000000000..4bd2ce7cc5
--- /dev/null
+++ b/tests/auto/gui/kernel/qpalette/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qpalette.pro.
+
+#####################################################################
+## tst_qpalette Test:
+#####################################################################
+
+add_qt_test(tst_qpalette
+ SOURCES
+ tst_qpalette.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
index 6ce6422f48..04343727bb 100644
--- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
+++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp
@@ -41,6 +41,12 @@ private Q_SLOTS:
void copySemantics();
void moveSemantics();
void setBrush();
+
+ void isBrushSet();
+ void setAllPossibleBrushes();
+ void noBrushesSetForDefaultPalette();
+ void cannotCheckIfInvalidBrushSet();
+ void checkIfBrushForCurrentGroupSet();
};
void tst_QPalette::roleValues_data()
@@ -118,23 +124,35 @@ void tst_QPalette::resolve()
QVERIFY(p2ResolvedTo1 != p2);
}
+
+static void compareAllPaletteData(const QPalette &firstPalette, const QPalette &secondPalette)
+{
+ QCOMPARE(firstPalette, secondPalette);
+
+ // For historical reasons, operator== compares only brushes, but it's not enough for proper
+ // comparison after move/copy, because some additional data can also be moved/copied.
+ // Let's compare this data here.
+ QCOMPARE(firstPalette.resolve(), secondPalette.resolve());
+ QCOMPARE(firstPalette.currentColorGroup(), secondPalette.currentColorGroup());
+}
+
void tst_QPalette::copySemantics()
{
QPalette src(Qt::red), dst;
const QPalette control = src; // copy construction
QVERIFY(src != dst);
QVERIFY(!src.isCopyOf(dst));
- QCOMPARE(src, control);
+ compareAllPaletteData(src, control);
QVERIFY(src.isCopyOf(control));
dst = src; // copy assignment
- QCOMPARE(dst, src);
- QCOMPARE(dst, control);
+ compareAllPaletteData(dst, src);
+ compareAllPaletteData(dst, control);
QVERIFY(dst.isCopyOf(src));
dst = QPalette(Qt::green);
QVERIFY(dst != src);
QVERIFY(dst != control);
- QCOMPARE(src, control);
+ compareAllPaletteData(src, control);
QVERIFY(!dst.isCopyOf(src));
QVERIFY(src.isCopyOf(control));
}
@@ -144,13 +162,13 @@ void tst_QPalette::moveSemantics()
QPalette src(Qt::red), dst;
const QPalette control = src;
QVERIFY(src != dst);
- QCOMPARE(src, control);
+ compareAllPaletteData(src, control);
QVERIFY(!dst.isCopyOf(src));
QVERIFY(!dst.isCopyOf(control));
dst = std::move(src); // move assignment
QVERIFY(!dst.isCopyOf(src)); // isCopyOf() works on moved-from palettes, too
QVERIFY(dst.isCopyOf(control));
- QCOMPARE(dst, control);
+ compareAllPaletteData(dst, control);
src = control; // check moved-from 'src' can still be assigned to (doesn't crash)
QVERIFY(src.isCopyOf(dst));
QVERIFY(src.isCopyOf(control));
@@ -158,7 +176,7 @@ void tst_QPalette::moveSemantics()
QVERIFY(!src.isCopyOf(dst));
QVERIFY(!src.isCopyOf(dst2));
QVERIFY(!src.isCopyOf(control));
- QCOMPARE(dst2, control);
+ compareAllPaletteData(dst2, control);
QVERIFY(dst2.isCopyOf(dst));
QVERIFY(dst2.isCopyOf(control));
// check moved-from 'src' can still be destroyed (doesn't crash)
@@ -194,5 +212,62 @@ void tst_QPalette::setBrush()
QVERIFY(pp.isCopyOf(p));
}
+void tst_QPalette::isBrushSet()
+{
+ QPalette p;
+
+ // Set only one color group
+ p.setBrush(QPalette::Active, QPalette::Mid, QBrush(Qt::red));
+ QVERIFY(p.isBrushSet(QPalette::Active, QPalette::Mid));
+ QVERIFY(!p.isBrushSet(QPalette::Inactive, QPalette::Mid));
+ QVERIFY(!p.isBrushSet(QPalette::Disabled, QPalette::Mid));
+
+ // Set all color groups
+ p.setBrush(QPalette::LinkVisited, QBrush(Qt::green));
+ QVERIFY(p.isBrushSet(QPalette::Active, QPalette::LinkVisited));
+ QVERIFY(p.isBrushSet(QPalette::Inactive, QPalette::LinkVisited));
+ QVERIFY(p.isBrushSet(QPalette::Disabled, QPalette::LinkVisited));
+}
+
+void tst_QPalette::setAllPossibleBrushes()
+{
+ QPalette p;
+
+ QCOMPARE(p.resolve(), QPalette::ResolveMask(0));
+
+ for (int r = 0; r < QPalette::NColorRoles; ++r) {
+ p.setBrush(QPalette::All, QPalette::ColorRole(r), Qt::red);
+ }
+
+ for (int r = 0; r < QPalette::NColorRoles; ++r) {
+ for (int g = 0; g < QPalette::NColorGroups; ++g) {
+ QVERIFY(p.isBrushSet(QPalette::ColorGroup(g), QPalette::ColorRole(r)));
+ }
+ }
+}
+
+void tst_QPalette::noBrushesSetForDefaultPalette()
+{
+ QCOMPARE(QPalette().resolve(), QPalette::ResolveMask(0));
+}
+
+void tst_QPalette::cannotCheckIfInvalidBrushSet()
+{
+ QPalette p(Qt::red);
+
+ QVERIFY(!p.isBrushSet(QPalette::All, QPalette::LinkVisited));
+ QVERIFY(!p.isBrushSet(QPalette::Active, QPalette::NColorRoles));
+}
+
+void tst_QPalette::checkIfBrushForCurrentGroupSet()
+{
+ QPalette p;
+
+ p.setCurrentColorGroup(QPalette::Disabled);
+ p.setBrush(QPalette::Current, QPalette::Link, QBrush(Qt::yellow));
+
+ QVERIFY(p.isBrushSet(QPalette::Current, QPalette::Link));
+}
+
QTEST_MAIN(tst_QPalette)
#include "tst_qpalette.moc"
diff --git a/tests/auto/gui/kernel/qpixelformat/CMakeLists.txt b/tests/auto/gui/kernel/qpixelformat/CMakeLists.txt
new file mode 100644
index 0000000000..43deb02af1
--- /dev/null
+++ b/tests/auto/gui/kernel/qpixelformat/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qpixelformat.pro.
+
+#####################################################################
+## tst_qpixelformat Test:
+#####################################################################
+
+add_qt_test(tst_qpixelformat
+ SOURCES
+ tst_qpixelformat.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qrasterwindow/CMakeLists.txt b/tests/auto/gui/kernel/qrasterwindow/CMakeLists.txt
new file mode 100644
index 0000000000..61e1be44fd
--- /dev/null
+++ b/tests/auto/gui/kernel/qrasterwindow/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qrasterwindow.pro.
+
+#####################################################################
+## tst_qrasterwindow Test:
+#####################################################################
+
+add_qt_test(tst_qrasterwindow
+ SOURCES
+ tst_qrasterwindow.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qscreen/CMakeLists.txt b/tests/auto/gui/kernel/qscreen/CMakeLists.txt
new file mode 100644
index 0000000000..2e2a04f969
--- /dev/null
+++ b/tests/auto/gui/kernel/qscreen/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qscreen.pro.
+
+#####################################################################
+## tst_qscreen Test:
+#####################################################################
+
+add_qt_test(tst_qscreen
+ SOURCES
+ tst_qscreen.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qsurfaceformat/CMakeLists.txt b/tests/auto/gui/kernel/qsurfaceformat/CMakeLists.txt
new file mode 100644
index 0000000000..148ab2be8d
--- /dev/null
+++ b/tests/auto/gui/kernel/qsurfaceformat/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qsurfaceformat.pro.
+
+#####################################################################
+## tst_qsurfaceformat Test:
+#####################################################################
+
+add_qt_test(tst_qsurfaceformat
+ SOURCES
+ tst_qsurfaceformat.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/gui/kernel/qtouchevent/CMakeLists.txt b/tests/auto/gui/kernel/qtouchevent/CMakeLists.txt
new file mode 100644
index 0000000000..2a74918f8a
--- /dev/null
+++ b/tests/auto/gui/kernel/qtouchevent/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qtouchevent.pro.
+
+#####################################################################
+## tst_qtouchevent Test:
+#####################################################################
+
+add_qt_test(tst_qtouchevent
+ SOURCES
+ tst_qtouchevent.cpp
+ LIBRARIES
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/tests/auto/gui/kernel/qwindow/CMakeLists.txt b/tests/auto/gui/kernel/qwindow/CMakeLists.txt
new file mode 100644
index 0000000000..c5a56a5a06
--- /dev/null
+++ b/tests/auto/gui/kernel/qwindow/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Generated from qwindow.pro.
+
+#####################################################################
+## tst_qwindow Test:
+#####################################################################
+
+add_qt_test(tst_qwindow
+ SOURCES
+ tst_qwindow.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qwindow CONDITION QT_FEATURE_dynamicgl AND WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ user32
+)