summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-24 10:33:37 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-01-25 20:06:06 +0100
commit318b58562ae89453fb98e8145cd0440e14ba60b0 (patch)
tree622bc032cf076b4569621032f3a3315d95c3ae88 /src/testlib
parentc28fde3fdac19fd5a5f614bb7983080031c924b3 (diff)
parent79352528a1726b4551ea4d9285dd2394dd0d43da (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/common/msvc-version.conf mkspecs/common/winrt_winphone/qmake.conf mkspecs/features/mac/default_post.prf mkspecs/features/mac/sdk.prf mkspecs/features/qt.prf mkspecs/features/uikit/default_post.prf mkspecs/features/winrt/default_pre.prf mkspecs/winphone-arm-msvc2013/qmake.conf mkspecs/winphone-x86-msvc2013/qmake.conf mkspecs/winrt-arm-msvc2013/qmake.conf mkspecs/winrt-x64-msvc2013/qmake.conf mkspecs/winrt-x86-msvc2013/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/gui/kernel/qwindowsysteminterface.cpp src/network/kernel/qhostaddress.cpp src/plugins/platforms/mirclient/qmirclientplugin.cpp src/plugins/platforms/mirclient/qmirclientplugin.h src/widgets/util/qsystemtrayicon.cpp tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp tools/configure/Makefile.mingw tools/configure/Makefile.win32 Done-with: Jake Petroules <jake.petroules@qt.io> Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Change-Id: I4be3262d3994e11929d3b1ded2c3379783797dbe
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/3rdparty/VALGRIND_LICENSE.txt (renamed from src/testlib/3rdparty/CALLGRIND_LICENSE.txt)4
-rw-r--r--src/testlib/3rdparty/qt_attribution.json11
-rw-r--r--src/testlib/qtestmouse.h15
-rw-r--r--src/testlib/testlib.pro2
4 files changed, 22 insertions, 10 deletions
diff --git a/src/testlib/3rdparty/CALLGRIND_LICENSE.txt b/src/testlib/3rdparty/VALGRIND_LICENSE.txt
index 0a6a793422..714b75e6d1 100644
--- a/src/testlib/3rdparty/CALLGRIND_LICENSE.txt
+++ b/src/testlib/3rdparty/VALGRIND_LICENSE.txt
@@ -1,6 +1,4 @@
- This file is part of callgrind, a valgrind tool for cache simulation
- and call tree tracing.
-
+ Copyright (C) 2000-2007 Julian Seward
Copyright (C) 2003-2007 Josef Weidendorfer. All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/src/testlib/3rdparty/qt_attribution.json b/src/testlib/3rdparty/qt_attribution.json
index d8b0ad1fc7..49d12580bd 100644
--- a/src/testlib/3rdparty/qt_attribution.json
+++ b/src/testlib/3rdparty/qt_attribution.json
@@ -1,17 +1,18 @@
[
{
- "Id": "callgrind",
- "Name": "Callgrind",
+ "Id": "valgrind",
+ "Name": "Valgrind",
"QDocModule": "qttestlib",
"QtUsage": "Used on Linux ond MacOS in the Qt Test module.",
"Files": "valgrind_p.h callgrind_p.h",
- "Description": "Part of Valgrind: an instrumentation framework for building dynamic analysis tools.",
+ "Description": "An instrumentation framework for building dynamic analysis tools.",
"Homepage": "http://valgrind.org/",
"License": "BSD 4-clause \"Original\" or \"Old\" License",
"LicenseId": "BSD-4-Clause",
- "LicenseFile": "CALLGRIND_LICENSE.txt",
- "Copyright": "Copyright (C) 2003-2007 Josef Weidendorfer. All rights reserved."
+ "LicenseFile": "VALGRIND_LICENSE.txt",
+ "Copyright": "Copyright (C) 2000-2007 Julian Seward
+Copyright (C) 2003-2007 Josef Weidendorfer."
},
{
"Id": "cycle",
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 1143361323..166622e950 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -73,6 +73,11 @@ namespace QTest
extern Q_TESTLIB_EXPORT Qt::MouseButton lastMouseButton;
extern Q_TESTLIB_EXPORT int lastMouseTimestamp;
+ // This value is used to emulate timestamps to avoid creating double clicks by mistake.
+ // Use this constant instead of QStyleHints::mouseDoubleClickInterval property to avoid tests
+ // to depend on platform themes.
+ static const int mouseDoubleClickInterval = 500;
+
static void waitForEvents()
{
#ifdef Q_OS_MAC
@@ -125,7 +130,7 @@ namespace QTest
Q_FALLTHROUGH();
case MouseRelease:
qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
- lastMouseTimestamp += 500; // avoid double clicks being generated
+ lastMouseTimestamp += mouseDoubleClickInterval; // avoid double clicks being generated
lastMouseButton = Qt::NoButton;
break;
case MouseMove:
@@ -176,8 +181,10 @@ namespace QTest
if (delay == -1 || delay < defaultMouseDelay())
delay = defaultMouseDelay();
- if (delay > 0)
+ if (delay > 0) {
QTest::qWait(delay);
+ lastMouseTimestamp += delay;
+ }
if (action == MouseClick) {
mouseEvent(MousePress, widget, button, stateKey, pos);
@@ -194,12 +201,16 @@ namespace QTest
{
case MousePress:
me = QMouseEvent(QEvent::MouseButtonPress, pos, widget->mapToGlobal(pos), button, button, stateKey);
+ me.setTimestamp(++lastMouseTimestamp);
break;
case MouseRelease:
me = QMouseEvent(QEvent::MouseButtonRelease, pos, widget->mapToGlobal(pos), button, Qt::MouseButton(), stateKey);
+ me.setTimestamp(++lastMouseTimestamp);
+ lastMouseTimestamp += mouseDoubleClickInterval; // avoid double clicks being generated
break;
case MouseDClick:
me = QMouseEvent(QEvent::MouseButtonDblClick, pos, widget->mapToGlobal(pos), button, button, stateKey);
+ me.setTimestamp(++lastMouseTimestamp);
break;
case MouseMove:
QCursor::setPos(widget->mapToGlobal(pos));
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 5b2205e875..e84651ccd5 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -111,4 +111,6 @@ mac {
!qtHaveModule(widgets): HEADERSCLEAN_EXCLUDE += qtest_widgets.h
+!qtHaveModule(network): HEADERSCLEAN_EXCLUDE += qtest_network.h
+
load(qt_module)