in reply to Re: Re: Including a Gtk2 app in a Test
in thread Including a Gtk2 app in a Test

You can probably rewrite foo.pl like this:

sub foo { # original foo.pl code here return "all right"; } foo() unless defined caller(); # call foo() unless require'd

And then in your tests do something like

# Test::More style used.... use Test::More tests => 1; require "foo.pl"; is(foo(),"all right","Foo() executed normally")
Update: You'll probably not want everything in the foo() function, just the stuff that's needed to set up the gui.

For instance, the run loop will probably be set up by the test module (but I'm only guessing, I've never used the Gtk test modules).

Update 2:: Actually, most of the above is wrong. It will give you some hints on how to solve your problem, though. I'm going to eat something now.

Joost.

Replies are listed 'Best First'.
Re: Re: Re: Re: Including a Gtk2 app in a Test
by mutated (Monk) on Apr 26, 2004 at 19:37 UTC
    Actually it was helpful! thanks Joost, it's got me on the road to being able to use Gtk2::Test::Helper as kvale suggested which is what I was looking for.


    daN.