Re: automation




Scott Lanning said:
I'm trying to figure out how to automate
a browser based on Gtk2::MozEmbed.
The problem is normally you call Gtk2->main()
and there things are stuck, but in this case
I want to be able to script when certain things
should happen rather than wait for events (I don't
even care if the window is shown). So I think I have
to not use `main'. So I'm  experimenting with that.

In the Gtk2 et al test suites, we usually use single-shot idles to handle this
sort of thing.

  Glib::Idle->add (sub {
      $button->clicked;
      Gtk2->main_quit;
      FALSE;
  });
  Gtk2->main;


You can get pretty nutty when you start nesting and chaining these things, so
i recommend creating a wrapper API for it.  In Gtk2::TestHelper there are
run_main(), ok_idle() and is_idle() for this purpose.



-- 
muppet <scott at asofyet dot org>




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