austgl / robotium

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

solo.clickLongOnTextAndPress doesn't work for me #183

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
i am using solo.clickLongOnTextAndPress to pop the context menu from long 
clicking a listview's item. But it doesn't work.

What is the expected output? What do you see instead?
Long press the listview's item and pop context menu and click the menu item.
But it doesn't work.

What version of the product are you using? On what operating system?
robotium-3.0 on windows7

Please provide any additional information below.
i follow a method to emulate long press from
http://stackoverflow.com/questions/2914681/how-do-you-send-a-long-press-from-an-
instrumentationtestcase

at first it also doesn't work and i changed the sleep time and then it works:
 private void longClickDpadCenter() {
    try {
        getInstrumentation().sendKeySync(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_CENTER));
        Thread.sleep((int) (ViewConfiguration.getLongPressTimeout() * 2.5f));
        getInstrumentation().sendKeySync(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_CENTER));
    } catch (Exception e) {
        Log.e(TAG, "Long click error", e);
    }
    }

i not sure whether it is because Solo's sleep time is not long enough to make 
this long press.

Original issue reported on code.google.com by wlmqdz@gmail.com on 15 Nov 2011 at 9:24

GoogleCodeExporter commented 9 years ago
Thanks for this. The time will be increased in the next release. Please use 
clickLongOnText(int time) and then clickInList(int line) instead. 

Original comment by renasr...@gmail.com on 15 Nov 2011 at 9:55

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

Original comment by renasr...@gmail.com on 9 Jan 2012 at 12:00