How can I test drag-and-drop functionality between applications?
I'm writing a Cocoa app which allows the user to drag content to another application. I'd like to write an automated GUI test for this behavior.
I can move the mouse cursor using CGDisplayMoveCursorToPoint()
. How开发者_运维技巧 can I issue mousedown and mouseup events to simulate a drag and drop operation?
CGEventRef down = CGEventCreateMouseEvent(eventSource, kCGEventLeftMouseDown,point, 0);
CGEventPost(kCGSessionEventTap, down);
CFRelease(down);
精彩评论