austgl / robotium

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

clickOnView doesn't work if center of view is not on screen #154

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a ListView with some lines with big height, so that the last line is 
only slightly visible
2. try clickOnView on it.

What is the expected output?
The view is clicked

What do you see instead?
The view is not clicked and no error or boolean false is returned.

What version of the product are you using? On what operating system?
Robotium 2.5, Android 2.2

Please provide any additional information below.
I've used HorizontalScrollView instead, but reading the code, it should 
probably fail on ListView as well, the problem is in:

public void clickOnScreen(View view, boolean longClick, int time) {
    ...

    view.getLocationOnScreen(xy);

    final int viewWidth = view.getWidth();
    final int viewHeight = view.getHeight();
    final float x = xy[0] + (viewWidth / 2.0f);
    float y = xy[1] + (viewHeight / 2.0f);

    // WE SHOULD CHECK HERE IF X/Y IS OUTSIDE OF SCREEN

    ...
}

Original issue reported on code.google.com by gaz...@gmail.com on 12 Sep 2011 at 11:11

GoogleCodeExporter commented 9 years ago
Thanks for this.

Original comment by renasr...@gmail.com on 13 Sep 2011 at 8:28

GoogleCodeExporter commented 9 years ago
This has been corrected in Robotium 3.0. Please note that 
finishOpenedActivities() replaces finalize().

Original comment by renasr...@gmail.com on 14 Nov 2011 at 6:33