Re: Testing GTK application



On Mon, Aug 01, 2005 at 19:00:40 +0200, Gábor Szabó wrote:
On 8/1/05, muppet <scott asofyet org> wrote:
The same question would apply to testing on X11 as well. Maybe not for the
customers but at least for me :-)

Well, I have managed to find two tools on Sourceforge: X11::GUITest and
ltxf. They both say they are beta and I expect neither of them is
capable of finding which window is what, since that's sealed in the
application and the X server simply has no chance to know...

... except of course if Gtk itself exposed it. I don't think it does,
but it might not be hard to add a debugging more to Gtk in which it
would attach a special property stating the type and address object of
the object to which the window belongs.

You would have to make the application tell you what objects it is
creating. Which leads me to another suggestion -- in debugging mode,
connect a handler to realize signal (I hope it's the one creating the
window) of the widgets you need to control, that would print out
"forreign id" of the Gdk windows. Then look up the windows by ids in
X11::GUITest or ltxf.

At first I thought there is no way to get that native id, but then
I recalled all drawables have it. There are actually three(!) methods
that get it: XID, XWINDOW and get_xid. I assume they match to
GDK_DRAWABLE_XID, GDK_WINDOW_XWINDOW and gdk_drawable_get_xid
respectively, which I further assume to be the same thing anyway.

The take-home message is that win32 testing tools designed to scrape
information from apps that use the Win32 API and controls probably will not
work very usefully with gtk+ or QT, as those toolkits draw everything
themselves.

Actually I would like to have a Perl module (similar to Win32::GuiTest)
that could somehow talk to GTK+ or GDK or whoevere has the information
and I could just call PushButton($button_id)

Hm, that would require the implementing the introspective interface
I talked about above -- having Gtk attach type, name, pointer and such
things to a widget's window as special property, when invoked in
debugging mode. I am not going to implement it though.

I'll check the gtk-devel-list though right now it is more like general
interest than actual
need. It will become a need next week :-)

I fear it's a bit more work than a week to do it properly. You can go
with logging the X ids from the application for now.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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