benjamin84 / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

Component-less click method #139

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
N/A

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
Alpha 1

Please provide any additional information below.

-I'm extending Fest-Swing to add support for a custom Swing table.  I want
the ability to tell fest-swing robot do a click "here" another word, click
at point p without the translation relative to a component center performed
in RobotEventGenerator.moveMouse() method.  
-In particular in my driver class I'm already able to figure out the Point
object of where I want to click on so having a component-less click()
method is very nice feature.   

Right now I modified RobotEventGenerator.moveMouse() method as follows:

public void moveMouse(Component c, int x, int y) {
    try {
        if ( null == c)
        {
            robot.mouseMove(x, y);
        }
        else
        {
            Point point = locationOnScreenOf(c);
            if (point == null) return;
            point.translate(x, y);
            robot.mouseMove(point.x, point.y);
        }

    } catch (IllegalComponentStateException e) {}
  }

In my custom driver code I can do a component-less click:  
   Point p <-- custom swing table returns p
   robot.click(null, p, mouseButton,  times);

Original issue reported on code.google.com by viet....@gmail.com on 27 May 2008 at 3:50

GoogleCodeExporter commented 9 years ago

Original comment by Alex.Rui...@gmail.com on 27 May 2008 at 4:27

GoogleCodeExporter commented 9 years ago
We cannot implement this enhancenment. We have two mechanisms for generating 
user 
inputs AWT Robot (RobotEventGenerator) and posting AWT events 
(AWTEventGenerator). 
Both generators should provide exactly the same functionality (users can change 
the 
event generation mechanism and their tests should always work.)

The problem is that we cannot change RobotEventGenerator only. In the case of 
AWTEventGenerator, we cannot simulate moving the mouse pointer to an absolute 
coordinate. To post a AWT event we need a reference to a GUI component.

We can only move the mouse pointer to an absolute position and without a 
Component 
using the AWT Robot.

If you know a way to simulate mouse movements to an absolute position, please 
let us 
know. Another solution would be to have your fixture deal with relative 
coordinates, 
instead of absolute ones.

You can try to get a relative position to your custom table this way:

Point relative = SwingUtilities.convertPoint(null, point, customTable);

For now, we are closing this enhancement request.

Regards,
-Yvonne

Original comment by wanghy1...@gmail.com on 2 Jun 2008 at 3:52

GoogleCodeExporter commented 9 years ago
Set the module as a label, instead of being part of the title.

Original comment by Alex.Rui...@gmail.com on 1 Dec 2008 at 1:58

GoogleCodeExporter commented 9 years ago
Reopening this issue. Now that we have removed AWT mode, we can have a 
component-less
click method.

Original comment by Alex.Rui...@gmail.com on 29 Dec 2008 at 6:48

GoogleCodeExporter commented 9 years ago
r2110 and r2111

Original comment by Alex.Rui...@gmail.com on 29 Dec 2008 at 4:35

GoogleCodeExporter commented 9 years ago
More changes at r2116

Original comment by Alex.Rui...@gmail.com on 30 Dec 2008 at 12:44