summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/macnativeevents
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/other/macnativeevents')
-rw-r--r--tests/auto/other/macnativeevents/BLACKLIST20
-rw-r--r--tests/auto/other/macnativeevents/macnativeevents.pro3
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents.cpp4
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents.h4
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents_mac.cpp42
-rw-r--r--tests/auto/other/macnativeevents/tst_macnativeevents.cpp6
6 files changed, 28 insertions, 51 deletions
diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST
index 3998eb616a..1bc530ecc8 100644
--- a/tests/auto/other/macnativeevents/BLACKLIST
+++ b/tests/auto/other/macnativeevents/BLACKLIST
@@ -21,22 +21,22 @@ osx
osx
[testMouseDragToNonClientArea]
osx
-# QTQAINFRA-1292
-[testPushButtonPressRelease]
-osx-10.11 ci
osx-10.12 ci
-# QTQAINFRA-1292
+# The following key tests fail after switching to synchronous
+# expose events, and we don't know why yet. QTBUG-62042
[testKeyPressOnToplevel]
-osx-10.12 ci
-# QTQAINFRA-1292
+osx
[testModifierShift]
-osx-10.12 ci
-# QTQAINFRA-1292
+osx
[testModifierAlt]
-osx-10.12 ci
-# QTQAINFRA-1292
+osx
[testModifierCtrl]
+osx
+# QTQAINFRA-1292
+[testPushButtonPressRelease]
+osx-10.11 ci
osx-10.12 ci
+
# QTQAINFRA-1292
[testModifierCtrlWithDontSwapCtrlAndMeta]
osx-10.12 ci
diff --git a/tests/auto/other/macnativeevents/macnativeevents.pro b/tests/auto/other/macnativeevents/macnativeevents.pro
index 48ad04bbff..0611377d0b 100644
--- a/tests/auto/other/macnativeevents/macnativeevents.pro
+++ b/tests/auto/other/macnativeevents/macnativeevents.pro
@@ -1,9 +1,8 @@
CONFIG += testcase
TARGET = tst_macnativeevents
-LIBS += -framework Carbon
QT += widgets testlib
HEADERS += qnativeevents.h nativeeventlist.h expectedeventlist.h
-SOURCES += qnativeevents.cpp qnativeevents_mac.cpp
+SOURCES += qnativeevents.cpp qnativeevents_mac.cpp
SOURCES += expectedeventlist.cpp nativeeventlist.cpp
SOURCES += tst_macnativeevents.cpp
diff --git a/tests/auto/other/macnativeevents/qnativeevents.cpp b/tests/auto/other/macnativeevents/qnativeevents.cpp
index 758c0a94b8..f04b33151a 100644
--- a/tests/auto/other/macnativeevents/qnativeevents.cpp
+++ b/tests/auto/other/macnativeevents/qnativeevents.cpp
@@ -72,7 +72,7 @@ void QNativeInput::nativeEvent(QNativeEvent *event)
}
}
-Qt::Native::Status QNativeInput::sendNativeEvent(const QNativeEvent &event, int pid)
+Qt::Native::Status QNativeInput::sendNativeEvent(const QNativeEvent &event)
{
switch (event.id()){
case QNativeMouseMoveEvent::eventId:
@@ -84,7 +84,7 @@ Qt::Native::Status QNativeInput::sendNativeEvent(const QNativeEvent &event, int
case QNativeMouseWheelEvent::eventId:
return sendNativeMouseWheelEvent(static_cast<const QNativeMouseWheelEvent &>(event));
case QNativeKeyEvent::eventId:
- return sendNativeKeyEvent(static_cast<const QNativeKeyEvent &>(event), pid);
+ return sendNativeKeyEvent(static_cast<const QNativeKeyEvent &>(event));
case QNativeModifierEvent::eventId:
return sendNativeModifierEvent(static_cast<const QNativeModifierEvent &>(event));
case QNativeEvent::eventId:
diff --git a/tests/auto/other/macnativeevents/qnativeevents.h b/tests/auto/other/macnativeevents/qnativeevents.h
index 605d6d196e..2e30d849f2 100644
--- a/tests/auto/other/macnativeevents/qnativeevents.h
+++ b/tests/auto/other/macnativeevents/qnativeevents.h
@@ -204,10 +204,10 @@ class QNativeInput
static Qt::Native::Status sendNativeMouseMoveEvent(const QNativeMouseMoveEvent &event);
static Qt::Native::Status sendNativeMouseDragEvent(const QNativeMouseDragEvent &event);
static Qt::Native::Status sendNativeMouseWheelEvent(const QNativeMouseWheelEvent &event);
- static Qt::Native::Status sendNativeKeyEvent(const QNativeKeyEvent &event, int pid = 0);
+ static Qt::Native::Status sendNativeKeyEvent(const QNativeKeyEvent &event);
static Qt::Native::Status sendNativeModifierEvent(const QNativeModifierEvent &event);
// sendNativeEvent will NOT differ from OS to OS.
- static Qt::Native::Status sendNativeEvent(const QNativeEvent &event, int pid = 0);
+ static Qt::Native::Status sendNativeEvent(const QNativeEvent &event);
// The following methods will differ in implementation from OS to OS:
Qt::Native::Status subscribeForNativeEvents();
diff --git a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
index 6671813188..6d7fbbecc1 100644
--- a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
+++ b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "qnativeevents.h"
-#include <Carbon/Carbon.h>
+#include <CoreGraphics/CoreGraphics.h>
#include <QtCore>
// ************************************************************
@@ -176,28 +176,18 @@ static CGEventRef EventHandler_Quartz(CGEventTapProxy proxy, CGEventType type, C
return inEvent;
}
-Qt::Native::Status insertEventHandler_Quartz(QNativeInput *nativeInput, int pid = 0)
+Qt::Native::Status insertEventHandler_Quartz(QNativeInput *nativeInput)
{
uid_t uid = geteuid();
if (uid != 0)
qWarning("MacNativeEvents: You must be root to listen for key events!");
- CFMachPortRef port;
- if (!pid){
- port = CGEventTapCreate(kCGHIDEventTap,
- kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
- kCGEventMaskForAllEvents, EventHandler_Quartz, nativeInput);
- } else {
- ProcessSerialNumber psn;
- GetProcessForPID(pid, &psn);
- port = CGEventTapCreateForPSN(&psn,
- kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
- kCGEventMaskForAllEvents, EventHandler_Quartz, nativeInput);
- }
+ CFMachPortRef port = CGEventTapCreate(kCGHIDEventTap,
+ kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
+ kCGEventMaskForAllEvents, EventHandler_Quartz, nativeInput);
CFRunLoopSourceRef eventSrc = CFMachPortCreateRunLoopSource(NULL, port, 0);
- CFRunLoopAddSource((CFRunLoopRef) GetCFRunLoopFromEventLoop(GetMainEventLoop()),
- eventSrc, kCFRunLoopCommonModes);
+ CFRunLoopAddSource(CFRunLoopGetMain(), eventSrc, kCFRunLoopCommonModes);
return Qt::Native::Success;
}
@@ -207,19 +197,6 @@ Qt::Native::Status removeEventHandler_Quartz()
return Qt::Native::Success; // ToDo:
}
-Qt::Native::Status sendNativeKeyEventToProcess_Quartz(const QNativeKeyEvent &event, int pid)
-{
- ProcessSerialNumber psn;
- GetProcessForPID(pid, &psn);
-
- CGEventRef e = CGEventCreateKeyboardEvent(0, (uint)event.nativeKeyCode, event.press);
- setModifiersFromQNativeEvent(e, event);
- SetFrontProcess(&psn);
- CGEventPostToPSN(&psn, e);
- CFRelease(e);
- return Qt::Native::Success;
-}
-
Qt::Native::Status sendNativeKeyEvent_Quartz(const QNativeKeyEvent &event)
{
CGEventRef e = CGEventCreateKeyboardEvent(0, (uint)event.nativeKeyCode, event.press);
@@ -344,12 +321,9 @@ Qt::Native::Status QNativeInput::sendNativeMouseWheelEvent(const QNativeMouseWhe
return sendNativeMouseWheelEvent_Quartz(event);
}
-Qt::Native::Status QNativeInput::sendNativeKeyEvent(const QNativeKeyEvent &event, int pid)
+Qt::Native::Status QNativeInput::sendNativeKeyEvent(const QNativeKeyEvent &event)
{
- if (!pid)
- return sendNativeKeyEvent_Quartz(event);
- else
- return sendNativeKeyEventToProcess_Quartz(event, pid);
+ return sendNativeKeyEvent_Quartz(event);
}
Qt::Native::Status QNativeInput::sendNativeModifierEvent(const QNativeModifierEvent &event)
diff --git a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
index 5edff7aabe..e8970e6f24 100644
--- a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
+++ b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
@@ -35,10 +35,14 @@
#include "qnativeevents.h"
#include "nativeeventlist.h"
#include "expectedeventlist.h"
-#include <Carbon/Carbon.h>
QT_USE_NAMESPACE
+// Unicode code points for the glyphs associated with these keys
+// Defined by Carbon headers but not anywhere in Cocoa
+static const int kControlUnicode = 0x2303;
+static const int kCommandUnicode = 0x2318;
+
class tst_MacNativeEvents : public QObject
{
Q_OBJECT