summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-05 17:42:33 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-05 17:42:33 +0100
commit733ace5a7ad5b9e9f93ac87667d7d37fa5f894d5 (patch)
treea88031a8e1ac30986567070728e29ed1366d0962 /tests
parenteaff48d3622bbb0e18e79f79aac6d1ac1b7e2760 (diff)
parent835b8213905b315645bc60ff5f2ab99340d075a2 (diff)
Merge remote-tracking branch 'origin/release' into stable
Conflicts: configure mkspecs/macx-ios-clang/features/default_post.prf tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp Change-Id: Iaba97eed2272bccf54289640b8197d40e22f7bf5
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/concurrent/concurrent.pro1
-rw-r--r--tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro5
-rw-r--r--tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp87
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp1
-rw-r--r--tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp5
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp1
6 files changed, 98 insertions, 2 deletions
diff --git a/tests/auto/concurrent/concurrent.pro b/tests/auto/concurrent/concurrent.pro
index 20bad24fc1..e67c51aae3 100644
--- a/tests/auto/concurrent/concurrent.pro
+++ b/tests/auto/concurrent/concurrent.pro
@@ -3,6 +3,7 @@ SUBDIRS=\
qtconcurrentfilter \
qtconcurrentiteratekernel \
qtconcurrentmap \
+ qtconcurrentmedian \
qtconcurrentrun \
qtconcurrentthreadengine
diff --git a/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro
new file mode 100644
index 0000000000..1eb27d825a
--- /dev/null
+++ b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qtconcurrentmedian
+QT = core testlib concurrent
+SOURCES = tst_qtconcurrentmedian.cpp
+DEFINES += QT_STRICT_ITERATORS
diff --git a/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp b/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp
new file mode 100644
index 0000000000..c9fbc790bd
--- /dev/null
+++ b/tests/auto/concurrent/qtconcurrentmedian/tst_qtconcurrentmedian.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtconcurrentmedian.h>
+
+#include <QtTest/QtTest>
+
+class tst_QtConcurrentMedian: public QObject
+{
+ Q_OBJECT
+private slots:
+ void median_data();
+ void median();
+};
+
+void tst_QtConcurrentMedian::median_data()
+{
+ QTest::addColumn<QList<int> >("values");
+ QTest::addColumn<int>("expectedMedian");
+
+ QTest::newRow("size=1")
+ << (QList<int>() << 1)
+ << 1;
+
+ QTest::newRow("size=2")
+ << (QList<int>() << 3 << 2)
+ << 3;
+
+ QTest::newRow("size=3")
+ << (QList<int>() << 3 << 1 << 2)
+ << 2;
+
+ QTest::newRow("gcc bug 58800 (nth_element)")
+ << (QList<int>() << 207089 << 202585 << 180067 << 157549 << 211592 << 216096 << 207089)
+ << 207089;
+}
+
+void tst_QtConcurrentMedian::median()
+{
+ QFETCH(QList<int> , values);
+ QFETCH(int, expectedMedian);
+
+ QtConcurrent::Median<int> m(values.size());
+ foreach (int value, values)
+ m.addValue(value);
+ QCOMPARE(m.median(), expectedMedian);
+}
+
+QTEST_MAIN(tst_QtConcurrentMedian)
+#include "tst_qtconcurrentmedian.moc"
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 6c26ddb293..fc1d0e34cb 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -4221,6 +4221,7 @@ void tst_QGraphicsItem::cursor()
QCursor cursor = view.viewport()->cursor();
{
+ QTest::mouseMove(view.viewport(), QPoint(100, 50));
QMouseEvent event(QEvent::MouseMove, QPoint(100, 50), Qt::NoButton, 0, 0);
QApplication::sendEvent(view.viewport(), &event);
}
diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
index 6c04e5b39a..e2b2fb9551 100644
--- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
@@ -1043,13 +1043,14 @@ void tst_QColumnView::dynamicModelChanges()
ColumnView view;
view.setModel(&model);
view.setItemDelegate(&delegate);
+ centerOnScreen(&view);
view.show();
QStandardItem *item = new QStandardItem(QLatin1String("item"));
model.appendRow(item);
- QTest::qWait(200); //let the time for painting to occur
- QCOMPARE(delegate.paintedIndexes.count(), 1);
+ QVERIFY(QTest::qWaitForWindowExposed(&view)); //let the time for painting to occur
+ QTRY_COMPARE(delegate.paintedIndexes.count(), 1);
QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0));
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 81ed983d0f..9e181c0676 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -598,6 +598,7 @@ void tst_QMenu::layoutDirection()
centerOnScreen(&win);
QMenu menu(&win);
+ menu.addAction("foo");
menu.move(win.geometry().topRight() + QPoint(50, 0));
menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu));