Callbacks not firing with Ruby/GTK inside of test cases?

Hi All,

Hope all is going well.

I’ve developed a simple GUI using Glade and are using the Ruby
libglade bindings (awesome stuff) to present the GUI to the user. At
this stage I’ve got a simple test case that using the
Test::Unit::TestCase base class and all it does is create the GUI and
wait for feedback.

The problem is that none of the callbacks work when you click on
buttons, etc. They need to be there otherwise the GUI won’t be
created, but unfortunately I can’t move onto any of the next screens
as the buttons activate but the callbacks aren’t fired.

Is Ruby/GTK somehow incompatible/conflicting with the reflection
going on inside of Test::Unit::TestCase.

Has anyone else seen this behaviour as well? Any thoughts what might
be going wrong?

Cheers,

Marcus


This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

Hi,

I think there was a similar issue a few mounths ago and the answer was
to use the “testrb” program instead of using “ruby” to run your tests.

Mathieu

Marcus C. a écrit :

The problem is that none of the callbacks work when you click on
Cheers,
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642


ruby-gnome2-devel-en mailing list
[email protected]
ruby-gnome2-devel-en List Signup and Options


Mathieu B.
http://www.mblondel.org

Hi Mathieu,

Thanks mate, I’m actually running the tests through Rake - presumably
that doesn’t use testrb (or the same autorunner classes) internally?

Quite strange behaviour, I’ll try it with testrb then. Thanks for the
tip.

Cheers,

Marcus

For some strange reason, Ruby-GNOME2 needs to be loaded before
Test::Unit. If you just make sure that all require ‘gtk2’ statements
come before require ‘test/unit’, you should be fine. If you are
running tests using the Rake, you can do the following in the TestTask
definition:

Rake::TestTask.new do |t|
t.test_files = FileList[‘test/test*.rb’]
t.verbose = true
t.ruby_opts << ‘-rgtk2’
end

This will ensure that Ruby-GNOME2 is loaded before anything else. It
is a very silly problem which will hopefully be corrected in a future
release.

Hi Daniel,

Awesome mate, that was it - works fine now with the “t.ruby_opts << ‘-
rgtk2’” added to my Rakefile.

Thanks for everyone’s help.

Cheers,

Marcus

Hi,

On Mon, 10 Apr 2006 00:40:46 -0400
“Daniel H.” [email protected] wrote:

For some strange reason, Ruby-GNOME2 needs to be loaded before
Test::Unit.

The problem is both of Ruby/GLib and Test::Unit use “at_exit” to
run test scripts.

IMO, Test::Unit shouldn’t use it because you can’t run test
libraries/applications which use “at_exit”.
#So you need to use testrb instead of ruby command.

If you interested in this issue, find this ML again.

This will ensure that Ruby-GNOME2 is loaded before anything else. It
is a very silly problem which will hopefully be corrected in a future
release.

It may be silly, but I don’t have another good idea.
So it won’t be changed by me.
I hope you’ll fix it and post your patch here ;).


.:% Masao M.[email protected]


This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642