sending keystrokes to applications



For testing purposes I am trying to send keystrokes to the application.
In the t/ directory of Gtk2 I found several cases where a signal was connected
to a function and then the test uses signal_emit to invoke that signal handler.

e.g. How can I check that pressing F1 in the application has the desired effect?
I created an app where I connected F1 to two different menu options on purpose
and now I am trying to test this.


I tried

    Gtk2::AccelGroups->activate ($object, $accel_key, $accel_mods)

but I could not make it work

First of all I could only send keys with a modifier (such as Ctr-S)

    Gtk2::AccelGroups->activate(get_widget('main'),
$Gtk2::Gdk::Keysyms{s}, 'control-mask');

but I could not figure out how to send a simple F1 or 's'.

Then, while I could make use of the above code witin the application
when it was in the
test script it did not react. As I understand it is because the Gtk2->main loop
does not work in the test. Can I somehow solve this?


Gabor



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]