sangmingming / robotium

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

isSpinnerTextSelected wrong result #81

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Choose an item in a Spinner
2. call Solo.isSpinnerTextSelected(itemtext)
3. call Solo.searchText(itemtext)

What is the expected output? What do you see instead?
expected:
2. true
3. true
instead:
2. false
3. true

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

Please provide any additional information below.
In Checker.java the function
public boolean isSpinnerTextSelected(int spinnerIndex, String text)
the line: 
TextView textView = (TextView) spinner.getChildAt(0);
Why the zero value?
Why not like this:
TextView textView = (TextView) 
spinner.getChildAt(spinner.getSelectedItemPosition()); ?

Original issue reported on code.google.com by JoaRe...@gmail.com on 8 Mar 2011 at 9:41

GoogleCodeExporter commented 9 years ago
Thanks for this. It will be fixed in the next version.

Original comment by renasr...@gmail.com on 8 Mar 2011 at 10:36

GoogleCodeExporter commented 9 years ago
This has been corrected in Robotium 2.3.

Original comment by renasr...@gmail.com on 21 Apr 2011 at 5:47

GoogleCodeExporter commented 9 years ago
spinner.getChildAt(0) was working fine for me in Robotium 2.2. I've just 
switched today and I'm getting a NullPointerException since the spinner object 
has always one child (the currently selected one). 
As far as I know, getChildAt() depends on the Views.. and not on the 
index/position of the total items (children != items).. right?

Original comment by rodrigo1...@gmail.com on 25 Apr 2011 at 9:22

GoogleCodeExporter commented 9 years ago
You get a NullPointerException exception everytime you try to use it?

Original comment by renasr...@gmail.com on 26 Apr 2011 at 5:01

GoogleCodeExporter commented 9 years ago
Everytime the selectedItemPosition is != 0. So for example if in the spinner I 
have 3 items and I have this code, I would get the NullPointerException 
.. GROUP_SPINNER_INDEX = 0;
.. MOVE_DOWN_ONE_ITEM = 1;

solo.isSpinnerTextSelected(GROUP_SPINNER_INDEX, "Item position 0"); // No error
solo.pressSpinnerItem(GROUP_SPINNER_INDEX, MOVE_DOWN_ONE_ITEM);
solo.isSpinnerTextSelected(GROUP_SPINNER_INDEX, "Item postion 1"); // 
NullPointerException

Original comment by rodrigo1...@gmail.com on 26 Apr 2011 at 2:29

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. It will be fixed in the next release. I would 
recommend you to use 2.2 instead. The differences between the two are minor.

Original comment by renasr...@gmail.com on 27 Apr 2011 at 7:01

GoogleCodeExporter commented 9 years ago
This has been corrected in Robotium 2.4.

Original comment by renasr...@gmail.com on 13 Jul 2011 at 5:30