stephenwang1011 / robotium

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

Problems scrolling up in a spinner to select the first item #276

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Implement a GUI with a spinner
2. Make it select the second item when you start the activity during a test, 
either in onCreate or onResume.
3. Run the following code in the test case:
    int pos = solo.getCurrentSpinners().get(0).getSelectedItemPosition();
    solo.pressSpinnerItem(0, 0 - pos);

What is the expected output? What do you see instead?
Expected: Robotium selects the first item in the spinner.
Instead: Robotium presses the second item, the one that was already selected 
when the test started.

What version of the product are you using? On what operating system?
Robotium: 3.2.1, Android: Any, Operating system: Mac OS

Please provide any additional information below.
I am having problems scrolling up in a spinner to select the first item. Here 
is my code:

int pos = solo.getCurrentSpinners().get(0).getSelectedItemPosition();
solo.pressSpinnerItem(0, 0 - pos);

pos is 1 when I debug, and Robotium still presses the spinner on index 1 even 
though I order it to press on -1.

Original issue reported on code.google.com by markus.k...@gmail.com on 7 Jun 2012 at 6:49

GoogleCodeExporter commented 9 years ago
What if you do the following?

solo.pressSpinnerItem(0, -2);
solo.pressSpinnerItem(0, 1);
solo.pressSpinnerItem(0, -1);

Original comment by renasr...@gmail.com on 7 Jun 2012 at 9:38

GoogleCodeExporter commented 9 years ago
I will try. I tried solo.pressSpinnerItem(0, -5); and that worked fine, it 
selected the first item in the list.

Original comment by markus.k...@gmail.com on 7 Jun 2012 at 9:39

GoogleCodeExporter commented 9 years ago
Will open up again when new information is given. 

Original comment by renasr...@gmail.com on 11 Jun 2012 at 4:10