xiaofans / robotium

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

solo.clickLongOnScreen cannot work #343

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Add solo.clickLongOnScreen into test operation

What is the expected output? What do you see instead?
The item list should be displayed for long clicking on screen. But actually no 
list is displayed. 

What version of the product are you using? On what operating system?
robotium-solo-3.5.jar    on linux operating system

Please provide any additional information below.
This function work well on robotium-solo-3.4.1.jar and before.

Original issue reported on code.google.com by onlyfors...@gmail.com on 19 Oct 2012 at 2:18

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. Does it work better if you use: 
clickLongOnScreen(float x, float y, int time) instead? With time set to 
something high. Also which version of Android are you running on?

Original comment by renasr...@gmail.com on 19 Oct 2012 at 4:08

GoogleCodeExporter commented 9 years ago
Also not work if I using clickLongOnScreen(float x, float y, int time) with 
high time set(such as 8s).    Android version: 4.1.1 

Original comment by onlyfors...@gmail.com on 19 Oct 2012 at 5:42

GoogleCodeExporter commented 9 years ago
Please use 8000 as time. It's in milliseconds.
Den 19 okt 2012 07:43 skrev <robotium@googlecode.com>:

Original comment by renasr...@gmail.com on 19 Oct 2012 at 6:20

GoogleCodeExporter commented 9 years ago
We used 8000 as time(8s). 

Original comment by onlyfors...@gmail.com on 19 Oct 2012 at 8:10

GoogleCodeExporter commented 9 years ago
Would it be possible for you to send me a sample app that exhibits this issue?

Original comment by renasr...@gmail.com on 19 Oct 2012 at 8:20

GoogleCodeExporter commented 9 years ago
I think it is a common issue for clickLongOnScreen. Always happened when I 
using this method.

Original comment by onlyfors...@gmail.com on 22 Oct 2012 at 2:52

GoogleCodeExporter commented 9 years ago
I am not able to reproduce the issue. Have tried all the clickLong methods on 
4.1.1 and they work well. That is why I am asking for a sample app that 
exhibits this issue. 

Original comment by renasr...@gmail.com on 22 Oct 2012 at 6:26

GoogleCodeExporter commented 9 years ago
Thanks again for reporting this. The behaviour of the old clickOnScreen (it 
used a deprecated method) will be included in the next release. 

Original comment by renasr...@gmail.com on 23 Oct 2012 at 8:37

GoogleCodeExporter commented 9 years ago
Thanks again for reporting this. It has been fixed in Robotium 3.6.

Original comment by renasr...@gmail.com on 19 Nov 2012 at 6:06

GoogleCodeExporter commented 9 years ago
Hello!
I have tested clickLongOnScreen() function with Google Maps MapView.
It does not work on some devices and simulators.

Does not work on:
1. Galaxy S (2.3.7)
2. Android 4.2 simulator

So still buggy.

Original comment by shared.a...@gmail.com on 27 Nov 2012 at 9:48

GoogleCodeExporter commented 9 years ago
Robotium 3.6

Original comment by shared.a...@gmail.com on 27 Nov 2012 at 9:48

GoogleCodeExporter commented 9 years ago
I found woraround for this bug in Robotium 3.6:

The issue is in calling of ViewConfiguration.getTouchSlop() in robotium's 
clickLongOnScreen(). This method is deprecated and may work incorrecly on some 
devices.

I just copy this function in my test and use it instead of 
solo.clickLongOnScreen():

public void clickLongOnScreen(float x, float y, int time)
    {
        final Instrumentation inst = getInstrumentation();
        long downTime = SystemClock.uptimeMillis();
        long eventTime = SystemClock.uptimeMillis();
        MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0);
        try
        {
            inst.sendPointerSync(event);
        }
        catch(SecurityException e)
        {
            Log.e("TYPHOON_TEST", e.getMessage());
        }
        eventTime = SystemClock.uptimeMillis();
        event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE,
                x + 1.0f,
                y + 1.0f, 0);
        inst.sendPointerSync(event);
        try
        {
            Thread.sleep(time);
        }
        catch(InterruptedException e)
        {
            Log.e("TYPHOON_TEST", e.getMessage());
        }
        eventTime = SystemClock.uptimeMillis();
        event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, x, y, 0);
        inst.sendPointerSync(event);
        try
        {
            Thread.sleep(500);
        }
        catch(InterruptedException e)
        {
            Log.e("TYPHOON_TEST", e.getMessage());
        }
    }

Original comment by shared.a...@gmail.com on 27 Nov 2012 at 10:38

GoogleCodeExporter commented 9 years ago
Issue 361 has been merged into this issue.

Original comment by renasr...@gmail.com on 27 Nov 2012 at 4:13

GoogleCodeExporter commented 9 years ago
Opening up this issue again.

Original comment by renasr...@gmail.com on 28 Nov 2012 at 4:29

GoogleCodeExporter commented 9 years ago
This has been fixed in Robotium 4.0.

Original comment by renasr...@gmail.com on 27 Feb 2013 at 6:24