summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/other/macgui/guitest.cpp25
-rw-r--r--tests/auto/other/macgui/guitest.h3
2 files changed, 15 insertions, 13 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