I'm working on creating keyboard events for use in unit tests, and my
first test case isn't working: a cross-platform test to verify that
the escape key closes a floating palette. This is built-in behavior
on Cocoa, but I still want the test to run and pass.
..where 'inChar' and 'lower' are 27 (escape), and inVirtualKey is 53.
I've tried sending the event directly to the window, but that didn't
work either. No errors, exceptions, or console messages; nothing
happens.
I thought maybe the event was getting deferred somehow so that the
test was checking too soon to see if the window had closed. But if I
set a breakpoint in my windowDidResignKey: and hit the escape key
manually, I see the window being closed in the same call chain as
[NSApp sendEvent:] - as called by Carbon, since I'm dealing with
Cocoa windows in a Carbon app.