From: Massimiliano Mirra Date: 2001-12-16T23:32:33+09:00 Subject: [ruby-talk:28678] Re: GUI testing with GTK? On Sun, Dec 16, 2001 at 10:14:27PM +0900, Massimiliano Mirra wrote: > What I am looking for is a way to send events to the interface > from the code itself, so that it could be tested without user > intervention. This is what I have found: The widget.add_events method does not add events to widget event queue, instead it adds event *handlers* to the widget. It takes the return value from a widget.signal_connect as an argument, e.g.: window = Gtk::Window.new handler_ref = window.signal_connect('delete_event') { Gtk.main_quit } some_other_widget.add_events(handler_ref) * * * In order to get what I was aiming to, i.e. adding events to a widget event queue (for the purpose of automated testing but probably useful in other cases too), in C one would use the following functions from the GTK API: void gtk_signal_emit(GtkObject *object, guint signal_id, ...) void gtk_signal_emit_by_name(GtkObject *object, const gchar *name, ...) Or I think so (told you I'm just a C kid). Unfortunately neither signal_emit and signal_emit_by_name appear to be in the Ruby bindings. (hint, hint ;-) ) Massimiliano