Can I get the X & Y Coordinates of a named Locator?

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Can I get the X & Y Coordinates of a named Locator?

Postby 3061 » Thu Mar 19, 2009 7:32 am

I need to locate a Figure by name and then click just to the right of it, outside the Figure.

The NamedFigureLocator goes to the center of a Figure, but
Code: Select all
XYLocator(newNamedFigureLocator(givenFigureId))

goes to the top left corner of the Figure.

Code: Select all
NamedFigureLocator locator = new NamedFigureLocator(givenFigureId);
ILocator clickLocation = new XYLocator(locator, xOffset, yOffset);
ui.click(clickLocation);


Is there a way to compute xOffset, i.e. get the Width of the named Figure in a GEF Diagram?
Getting the X and Y coordinates of a named Figure would suffice; I could then compute the width.
3061
 
Posts: 42
Joined: Mon Feb 23, 2009 12:43 am

Re: Can I get the X & Y Coordinates of a named Locator?

Postby Phil Quitslund » Fri Mar 20, 2009 1:18 pm

Can you get what you need from the figure itself? That is:

Code: Select all
NamedFigureLocator locator = new NamedFigureLocator(givenFigureId);
IFigureReference fr = (IFigureReference)ui.find(locator);
IFigure figure = fr.getFigure();
Rectangle bounds = figure.getBounds();
...

Hope that helps. Either way, let us know!

-phil
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: Can I get the X & Y Coordinates of a named Locator?

Postby 3061 » Mon Mar 23, 2009 3:01 am

Phil Quitslund wrote:Can you get what you need from the figure itself? That is:

Code: Select all
NamedFigureLocator locator = new NamedFigureLocator(givenFigureId);
IFigureReference fr = (IFigureReference)ui.find(locator);
IFigure figure = fr.getFigure();
Rectangle bounds = figure.getBounds();
...

Hope that helps. Either way, let us know!

-phil


Works nicely, exactly what I needed. It's hard to find that out by using the WindowTester documentation by the way.
Thanks!
3061
 
Posts: 42
Joined: Mon Feb 23, 2009 12:43 am

Re: Can I get the X & Y Coordinates of a named Locator?

Postby Phil Quitslund » Mon Mar 23, 2009 11:47 am

I've opened a ticket to improve our docs to make this easier to discover. Thanks!


-phil
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest