Re: sending keystrokes to applications
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: sending keystrokes to applications
- Date: Tue, 20 May 2008 20:51:31 +0200
Gabor Szabo wrote:
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.
For GUI testing, you might want to have a look at Dogtail and/or LDTP.
<http://people.redhat.com/zcerza/dogtail/>
<http://ldtp.freedesktop.org/wiki/>
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'.
The third argument is of type Gtk2::Gdk::ModifierType, which is a flags
value. That means it can also be empty, which is achieved by using
undef or [].
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?
You can either run the main loop and then stop it from some callback via
Gtk2->main_quit, or you can try running just enough main loop iterations:
while (Gtk2->events_pending ()) {
Gtk2->main_iteration ();
}
--
Bye,
-Torsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]