summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtest_gui.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtest_gui.h')
-rw-r--r--src/testlib/qtest_gui.h77
1 files changed, 26 insertions, 51 deletions
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index 3368febb87..667debb3c4 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtTest module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** 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 LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTEST_GUI_H
#define QTEST_GUI_H
@@ -53,11 +17,15 @@
#include <QtTest/qtestevent.h>
#include <QtTest/qtestmouse.h>
#include <QtTest/qtesttouch.h>
+#include <QtTest/qtestwheel.h>
#include <QtTest/qtestkeyboard.h>
#include <QtGui/qcolor.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qimage.h>
+#if QT_CONFIG(shortcut)
+#include <QtGui/qkeysequence.h>
+#endif
#include <QtGui/qregion.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
@@ -113,7 +81,7 @@ template<> inline char *toString(const QRegion &region)
return qstrdup(result.constData());
}
-#if !defined(QT_NO_VECTOR2D) || defined(Q_CLANG_QDOC)
+#if !defined(QT_NO_VECTOR2D) || defined(Q_QDOC)
template<> inline char *toString(const QVector2D &v)
{
QByteArray result = "QVector2D(" + QByteArray::number(double(v.x())) + ", "
@@ -121,7 +89,7 @@ template<> inline char *toString(const QVector2D &v)
return qstrdup(result.constData());
}
#endif // !QT_NO_VECTOR2D
-#if !defined(QT_NO_VECTOR3D) || defined(Q_CLANG_QDOC)
+#if !defined(QT_NO_VECTOR3D) || defined(Q_QDOC)
template<> inline char *toString(const QVector3D &v)
{
QByteArray result = "QVector3D(" + QByteArray::number(double(v.x())) + ", "
@@ -129,7 +97,7 @@ template<> inline char *toString(const QVector3D &v)
return qstrdup(result.constData());
}
#endif // !QT_NO_VECTOR3D
-#if !defined(QT_NO_VECTOR4D) || defined(Q_CLANG_QDOC)
+#if !defined(QT_NO_VECTOR4D) || defined(Q_QDOC)
template<> inline char *toString(const QVector4D &v)
{
QByteArray result = "QVector4D(" + QByteArray::number(double(v.x())) + ", "
@@ -139,6 +107,13 @@ template<> inline char *toString(const QVector4D &v)
}
#endif // !QT_NO_VECTOR4D
+#if QT_CONFIG(shortcut)
+template<> inline char *toString(const QKeySequence &keySequence)
+{
+ return toString(keySequence.toString());
+}
+#endif
+
inline bool qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected,
const char *file, int line)
{
@@ -158,17 +133,17 @@ inline bool qCompare(QImage const &t1, QImage const &t2,
qsnprintf(msg, 1024, "Compared QImages differ.\n"
" Actual (%s).isNull(): %d\n"
" Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
- return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(false, msg, actual, expected, file, line);
}
if (t1Null && t2Null)
- return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(true, nullptr, actual, expected, file, line);
if (!qFuzzyCompare(t1.devicePixelRatio(), t2.devicePixelRatio())) {
qsnprintf(msg, 1024, "Compared QImages differ in device pixel ratio.\n"
" Actual (%s): %g\n"
" Expected (%s): %g",
actual, t1.devicePixelRatio(),
expected, t2.devicePixelRatio());
- return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(false, msg, actual, expected, file, line);
}
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QImages differ in size.\n"
@@ -176,17 +151,17 @@ inline bool qCompare(QImage const &t1, QImage const &t2,
" Expected (%s): %dx%d",
actual, t1.width(), t1.height(),
expected, t2.width(), t2.height());
- return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(false, msg, actual, expected, file, line);
}
if (t1.format() != t2.format()) {
qsnprintf(msg, 1024, "Compared QImages differ in format.\n"
" Actual (%s): %d\n"
" Expected (%s): %d",
actual, t1.format(), expected, t2.format());
- return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(false, msg, actual, expected, file, line);
}
return compare_helper(t1 == t2, "Compared values are not the same",
- toString(t1), toString(t2), actual, expected, file, line);
+ actual, expected, file, line);
}
inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, const char *expected,
@@ -200,17 +175,17 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
qsnprintf(msg, 1024, "Compared QPixmaps differ.\n"
" Actual (%s).isNull(): %d\n"
" Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
- return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(false, msg, actual, expected, file, line);
}
if (t1Null && t2Null)
- return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(true, nullptr, actual, expected, file, line);
if (!qFuzzyCompare(t1.devicePixelRatio(), t2.devicePixelRatio())) {
qsnprintf(msg, 1024, "Compared QPixmaps differ in device pixel ratio.\n"
" Actual (%s): %g\n"
" Expected (%s): %g",
actual, t1.devicePixelRatio(),
expected, t2.devicePixelRatio());
- return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(false, msg, actual, expected, file, line);
}
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n"
@@ -218,7 +193,7 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
" Expected (%s): %dx%d",
actual, t1.width(), t1.height(),
expected, t2.width(), t2.height());
- return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
+ return compare_helper(false, msg, actual, expected, file, line);
}
return qCompare(t1.toImage(), t2.toImage(), actual, expected, file, line);
}