Re: Gnome2::IconList bug



On Thu, 2004-01-29 at 16:16, Ross McFarland wrote:

@Gnome2::IconList::ISA = ('Gtk2::Widget');

This now allows me to connect signals to widgets of the aforementioned
class. I believe this is a very simple bug in the declaration of the
class. If there's anything else I might do to help, please ask.

you solution, of course, is a temporary workaround.

i can confirm the problem, looking at the pod of Gnome2::IconList doesn't show
any heirarchy.

from the looks of it (icon list header file) GnomeIconList is a GnomeCanvas
which would mean that Gnome2 probably needs to depend on Gnome2::Canvas, in
fact if i add 'use Gnome2::Canvas;' to Gnome2.pm the problem goes away and the
pod now shows the hierarchy. (note that the real solution will involve more
than just adding the use statement.)

kaffee thoughts?

Yeah, that's exactly the problem.  I don't think it's necessary to
depend on Gnome2::Canvas, though: A simple

  gperl_set_isa ("Gnome2::IconList", "Gtk2::Layout");

seems to fix it for me.  Gtk2::Layout is Gnome2::IconList's next
descendant after Gnome2::Canvas.

Is there anything wrong about this solution that I miss?

this probably means we ought to add some sort of test to verify the hierarchy,
at least one level of it, for all of the objects types. there's plenty of
tests for this object type, but they only test methods on it, not it's
ancestors.

Yeah, that kind of test has been on my todo list for some time now.

probably the simplest thing to do is to make sure that all things that derive
from something, can access a method in the base class of that something. which
in most cases would be Glib::Object. to do this reliably (making sure that we
aren't faked out by overridding of the method in the local class) we could add
something to Gtk2::TestHelper with a Glib::Object package like,
$object->something_unique_in_base_gobject that just returns true and would
never be overridden. that would give us a method to be called only in tests,
on any gobject derived class. we could add others for the few cases of thigns
that aren't gobject derived.

I think it would probably suffice to add isa_ok tests to every test
file.  For Gnome2::IconList, this could look like:

  isa_ok($list, "Glib::Object");
  isa_ok($list, "Gtk2::Object");
  isa_ok($list, "Gtk2::Widget");
  isa_ok($list, "Gtk2::Container");
  isa_ok($list, "Gtk2::Layout");
  # isa_ok($list, "Gnome2::Canvas");
  isa_ok($list, "Gnome2::IconList");

Bye,
-Torsten




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