开发者

How can I test drag-and-drop functionality between applications?

开发者 https://www.devze.com 2023-02-14 05:06 出处:网络
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'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);
0

精彩评论

暂无评论...
验证码 换一张
取 消