summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-26 22:30:27 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-26 22:35:48 +0100
commit4a8273a6fc2e741e811cf5dabc9a3c240306cf7f (patch)
tree2148abc88f8543eecdc0b97b2dd92594836af9b2 /tests/auto/other
parent036c5db468164297d213764c59a4b59daa76d90a (diff)
parent1c2be58fecaff1de5f2849192eb712984ebd59bd (diff)
Merge remote-tracking branch 'origin/stable' into dev
For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/macgui/guitest.cpp25
-rw-r--r--tests/auto/other/macgui/guitest.h3
-rw-r--r--tests/auto/other/qobjectrace/tst_qobjectrace.cpp76
3 files changed, 72 insertions, 32 deletions
diff --git a/tests/auto/other/macgui/guitest.cpp b/tests/auto/other/macgui/guitest.cpp
index d7431dd88e..3359e7d935 100644
--- a/tests/auto/other/macgui/guitest.cpp
+++ b/tests/auto/other/macgui/guitest.cpp
@@ -144,22 +144,25 @@ WidgetNavigator::~WidgetNavigator()
namespace NativeEvents {
#ifdef Q_OS_MAC
- void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons, MousePosition updateMouse)
+ void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons)
{
CGPoint position;
position.x = globalPos.x();
position.y = globalPos.y();
- const bool updateMousePosition = (updateMouse == UpdatePosition);
-
- // Mouse down.
- CGPostMouseEvent(position, updateMousePosition, 3,
- (buttons & Qt::LeftButton) ? true : false,
- (buttons & Qt::MidButton/* Middlebutton! */) ? true : false,
- (buttons & Qt::RightButton) ? true : false);
-
- // Mouse up.
- CGPostMouseEvent(position, updateMousePosition, 3, false, false, false);
+ CGEventType mouseDownType = (buttons & Qt::LeftButton) ? kCGEventLeftMouseDown :
+ (buttons & Qt::RightButton) ? kCGEventRightMouseDown :
+ kCGEventOtherMouseDown;
+ CGMouseButton mouseButton = mouseDownType == kCGEventOtherMouseDown ? kCGMouseButtonCenter : kCGEventLeftMouseDown;
+ CGEventRef mouseEvent = CGEventCreateMouseEvent(NULL, mouseDownType, position, mouseButton);
+ CGEventPost(kCGHIDEventTap, mouseEvent);
+
+ CGEventType mouseUpType = (buttons & Qt::LeftButton) ? kCGEventLeftMouseUp :
+ (buttons & Qt::RightButton) ? kCGEventRightMouseUp :
+ kCGEventOtherMouseUp;
+ CGEventSetType(mouseEvent, mouseUpType);
+ CGEventPost(kCGHIDEventTap, mouseEvent);
+ CFRelease(mouseEvent);
}
#else
# error Oops, NativeEvents::mouseClick() is not implemented on this platform.
diff --git a/tests/auto/other/macgui/guitest.h b/tests/auto/other/macgui/guitest.h
index 569a67d7fe..6fc4eac59f 100644
--- a/tests/auto/other/macgui/guitest.h
+++ b/tests/auto/other/macgui/guitest.h
@@ -86,11 +86,10 @@ private:
(Implemented so far: mouseClick on Mac)
*/
namespace NativeEvents {
- enum MousePosition { UpdatePosition, DontUpdatePosition };
/*
Simulates a mouse click with button at globalPos.
*/
- void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons, MousePosition updateMouse = DontUpdatePosition);
+ void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons);
};
class ColorWidget : public QWidget
diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
index ab05c64fe5..71a90e83f7 100644
--- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
@@ -47,6 +47,12 @@
enum { OneMinute = 60 * 1000,
TwoMinutes = OneMinute * 2 };
+
+struct Functor
+{
+ void operator()() const {};
+};
+
class tst_QObjectRace: public QObject
{
Q_OBJECT
@@ -122,11 +128,7 @@ signals:
private slots:
void checkStopWatch()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
- if (stopWatch.elapsed() >= OneMinute / 2)
-#else
- if (stopWatch.elapsed() >= OneMinute)
-#endif
+ if (stopWatch.elapsed() >= 5000)
quit();
QObject o;
@@ -188,16 +190,34 @@ class MyObject : public QObject
void signal7();
};
+namespace {
+const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()),
+ SLOT(slot4()) , SLOT(slot5()) , SLOT(slot6()),
+ SLOT(slot7()) };
+
+const char *_signals[] = { SIGNAL(signal1()), SIGNAL(signal2()), SIGNAL(signal3()),
+ SIGNAL(signal4()), SIGNAL(signal5()), SIGNAL(signal6()),
+ SIGNAL(signal7()) };
+typedef void (MyObject::*PMFType)();
+const PMFType _slotsPMF[] = { &MyObject::slot1, &MyObject::slot2, &MyObject::slot3,
+ &MyObject::slot4, &MyObject::slot5, &MyObject::slot6,
+ &MyObject::slot7 };
+
+const PMFType _signalsPMF[] = { &MyObject::signal1, &MyObject::signal2, &MyObject::signal3,
+ &MyObject::signal4, &MyObject::signal5, &MyObject::signal6,
+ &MyObject::signal7 };
+
+}
class DestroyThread : public QThread
{
Q_OBJECT
- QObject **objects;
+ MyObject **objects;
int number;
public:
- void setObjects(QObject **o, int n)
+ void setObjects(MyObject **o, int n)
{
objects = o;
number = n;
@@ -206,8 +226,29 @@ public:
}
void run() {
- for(int i = 0; i < number; i++)
+ for (int i = number-1; i >= 0; --i) {
+ /* Do some more connection and disconnection between object in this thread that have not been destroyed yet */
+
+ const int nAlive = i+1;
+ connect (objects[((i+1)*31) % nAlive], _signals[(12*i)%7], objects[((i+2)*37) % nAlive], _slots[(15*i+2)%7] );
+ disconnect(objects[((i+1)*31) % nAlive], _signals[(12*i)%7], objects[((i+2)*37) % nAlive], _slots[(15*i+2)%7] );
+
+ connect (objects[((i+4)*41) % nAlive], _signalsPMF[(18*i)%7], objects[((i+5)*43) % nAlive], _slotsPMF[(19*i+2)%7] );
+ disconnect(objects[((i+4)*41) % nAlive], _signalsPMF[(18*i)%7], objects[((i+5)*43) % nAlive], _slotsPMF[(19*i+2)%7] );
+
+ QMetaObject::Connection c = connect(objects[((i+5)*43) % nAlive], _signalsPMF[(9*i+1)%7], Functor());
+ disconnect(c);
+
+ disconnect(objects[i], _signalsPMF[(10*i+5)%7], 0, 0);
+ disconnect(objects[i], _signals[(11*i+6)%7], 0, 0);
+
+ disconnect(objects[i], 0, objects[(i*17+6) % nAlive], 0);
+ if (i%4 == 1) {
+ disconnect(objects[i], 0, 0, 0);
+ }
+
delete objects[i];
+ }
}
};
@@ -216,27 +257,24 @@ public:
void tst_QObjectRace::destroyRace()
{
- enum { ThreadCount = 10, ObjectCountPerThread = 733,
+ enum { ThreadCount = 10, ObjectCountPerThread = 2777,
ObjectCount = ThreadCount * ObjectCountPerThread };
- const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()),
- SLOT(slot4()) , SLOT(slot5()) , SLOT(slot6()),
- SLOT(slot7()) };
-
- const char *_signals[] = { SIGNAL(signal1()), SIGNAL(signal2()), SIGNAL(signal3()),
- SIGNAL(signal4()), SIGNAL(signal5()), SIGNAL(signal6()),
- SIGNAL(signal7()) };
-
- QObject *objects[ObjectCount];
+ MyObject *objects[ObjectCount];
for (int i = 0; i < ObjectCount; ++i)
objects[i] = new MyObject;
- for (int i = 0; i < ObjectCount * 11; ++i) {
+ for (int i = 0; i < ObjectCount * 17; ++i) {
connect(objects[(i*13) % ObjectCount], _signals[(2*i)%7],
objects[((i+2)*17) % ObjectCount], _slots[(3*i+2)%7] );
connect(objects[((i+6)*23) % ObjectCount], _signals[(5*i+4)%7],
objects[((i+8)*41) % ObjectCount], _slots[(i+6)%7] );
+
+ connect(objects[(i*67) % ObjectCount], _signalsPMF[(2*i)%7],
+ objects[((i+1)*71) % ObjectCount], _slotsPMF[(3*i+2)%7] );
+ connect(objects[((i+3)*73) % ObjectCount], _signalsPMF[(5*i+4)%7],
+ objects[((i+5)*79) % ObjectCount], Functor() );
}
DestroyThread *threads[ThreadCount];