summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-06-19 13:12:48 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-06-19 13:12:48 +0200
commit8eabb44f8a3f5c22aed44fbd3e1919cc7e04b1a5 (patch)
tree816f551efc48349b1f08f2899b7a88f0fa6aa882 /tests/auto
parentd0acd26c37c7b98612308e47e635b792949d7210 (diff)
parent74305ba470f48da8b4c4e806fc714fe9f7649156 (diff)
Merge remote-tracking branch 'origin/5.11.1' into 5.11
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cmake/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/test_use_modules_function/CMakeLists.txt18
-rw-r--r--tests/auto/cmake/test_use_modules_function/three.cpp45
-rw-r--r--tests/auto/cmake/test_use_modules_function/two.cpp43
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp65
5 files changed, 170 insertions, 2 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index f1d8657091..ec75ec7caf 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -47,6 +47,7 @@ find_package(Qt5Core REQUIRED)
include("${_Qt5CTestMacros}")
+expect_pass(test_use_modules_function)
expect_pass(test_umbrella_config)
expect_pass(test_wrap_cpp_and_resources)
if (NOT NO_WIDGETS)
diff --git a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
new file mode 100644
index 0000000000..be05c75054
--- /dev/null
+++ b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(test_use_modules_function)
+
+set(CMAKE_AUTOMOC ON)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_executable(two two.cpp)
+add_executable(three three.cpp)
+
+find_package(Qt5Core)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+
+qt5_use_modules(two Test)
+qt5_use_modules(three Gui Test)
diff --git a/tests/auto/cmake/test_use_modules_function/three.cpp b/tests/auto/cmake/test_use_modules_function/three.cpp
new file mode 100644
index 0000000000..507cc8479d
--- /dev/null
+++ b/tests/auto/cmake/test_use_modules_function/three.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 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$
+**
+****************************************************************************/
+
+#include <QtTest>
+#include <QWindow>
+
+class Three : public QObject
+{
+ Q_OBJECT
+public:
+ Three(QObject *parent = 0)
+ {
+ QWindow *w = new QWindow;
+ w->show();
+ }
+};
+
+QTEST_MAIN(Three)
+
+#include "three.moc"
diff --git a/tests/auto/cmake/test_use_modules_function/two.cpp b/tests/auto/cmake/test_use_modules_function/two.cpp
new file mode 100644
index 0000000000..44eb7fe96e
--- /dev/null
+++ b/tests/auto/cmake/test_use_modules_function/two.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 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$
+**
+****************************************************************************/
+
+#include <QtTest>
+
+class Two : public QObject
+{
+ Q_OBJECT
+public:
+ Two(QObject *parent = 0)
+ {
+
+ }
+};
+
+QTEST_MAIN(Two)
+
+#include "two.moc"
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index fd83228c8b..0dd98cf61c 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -43,6 +43,7 @@
#include <qtreewidget.h>
#include <qdebug.h>
#include <qscreen.h>
+#include <qdesktopwidget.h>
typedef QList<int> IntList;
@@ -243,7 +244,7 @@ private slots:
void testMinMaxSectionSize_data();
void testMinMaxSectionSize();
void sizeHintCrash();
-
+ void statusTips();
protected:
void setupTestData(bool use_reset_model = false);
void additionalInit();
@@ -269,7 +270,19 @@ public:
int rowCount(const QModelIndex&) const { return rows; }
int columnCount(const QModelIndex&) const { return cols; }
bool isEditable(const QModelIndex &) const { return true; }
-
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
+ {
+ if (section < 0 || (role != Qt::DisplayRole && role != Qt::StatusTipRole))
+ return QVariant();
+ const int row = (orientation == Qt::Vertical ? section : 0);
+ const int col = (orientation == Qt::Horizontal ? section : 0);
+ if (orientation == Qt::Vertical && row >= rows)
+ return QVariant();
+ if (orientation == Qt::Horizontal && col >= cols)
+ return QVariant();
+ return QLatin1Char('[') + QString::number(row) + QLatin1Char(',')
+ + QString::number(col) + QLatin1String(",0] -- Header");
+ }
QVariant data(const QModelIndex &idx, int) const
{
if (idx.row() < 0 || idx.column() < 0 || idx.column() >= cols || idx.row() >= rows) {
@@ -3325,6 +3338,54 @@ void tst_QHeaderView::testMinMaxSectionSize()
QTRY_COMPARE(header.sectionSize(0), defaultSectionSize);
}
+class StatusTipHeaderView : public QHeaderView
+{
+public:
+ StatusTipHeaderView(Qt::Orientation orientation = Qt::Horizontal, QWidget *parent = 0) :
+ QHeaderView(orientation, parent), gotStatusTipEvent(false) {}
+ bool gotStatusTipEvent;
+ QString statusTipText;
+protected:
+ bool event(QEvent *e)
+ {
+ if (e->type() == QEvent::StatusTip) {
+ gotStatusTipEvent = true;
+ statusTipText = static_cast<QStatusTipEvent *>(e)->tip();
+ }
+ return QHeaderView::event(e);
+ }
+};
+
+void tst_QHeaderView::statusTips()
+{
+ StatusTipHeaderView headerView;
+ QtTestModel model;
+ model.rows = model.cols = 5;
+ headerView.setModel(&model);
+ headerView.viewport()->setMouseTracking(true);
+ headerView.setGeometry(QRect(QPoint(QApplication::desktop()->geometry().center() - QPoint(250, 250)),
+ QSize(500, 500)));
+ headerView.show();
+ qApp->setActiveWindow(&headerView);
+ QVERIFY(QTest::qWaitForWindowActive(&headerView));
+
+ // Ensure it is moved away first and then moved to the relevant section
+ QTest::mouseMove(QApplication::desktop(),
+ headerView.rect().bottomLeft() + QPoint(20, 20));
+ QPoint centerPoint = QRect(headerView.sectionPosition(0), headerView.y(),
+ headerView.sectionSize(0), headerView.height()).center();
+ QTest::mouseMove(headerView.windowHandle(), centerPoint);
+ QTRY_VERIFY(headerView.gotStatusTipEvent);
+ QCOMPARE(headerView.statusTipText, QLatin1String("[0,0,0] -- Header"));
+
+ headerView.gotStatusTipEvent = false;
+ headerView.statusTipText.clear();
+ centerPoint = QRect(headerView.sectionPosition(1), headerView.y(),
+ headerView.sectionSize(1), headerView.height()).center();
+ QTest::mouseMove(headerView.windowHandle(), centerPoint);
+ QTRY_VERIFY(headerView.gotStatusTipEvent);
+ QCOMPARE(headerView.statusTipText, QLatin1String("[0,1,0] -- Header"));
+}
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"