sangmingming / robotium

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

SearchText() could not work if the list was already reached its bottom #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open a listView and it already reached bottom
2. Try to search a text which was the first serveral elements
3. Check the searchText() action

What is the expected output? What do you see instead?

The text should be found

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

Robotium 2.2 with Win7

Please provide any additional information below.

the source code below should be changed: 
{{{
if(scroll && !scroller.scroll(Scroller.DOWN)){
                logMatchesFound(regex);
                return false;
            }
}}}

Original issue reported on code.google.com by wangxiao...@gmail.com on 18 Apr 2011 at 6:08

GoogleCodeExporter commented 9 years ago
What do you mean the first several elements? Is scrolling up required in order 
for it to be shown?

Original comment by renasr...@gmail.com on 18 Apr 2011 at 12:17

GoogleCodeExporter commented 9 years ago
Yes, that's what I meant. This method only look for elements downwards. If
the List was already displayed with the bottom element, it could not find
the top elements.

Original comment by wangxiao...@gmail.com on 18 Apr 2011 at 12:28

GoogleCodeExporter commented 9 years ago
That is according to design. In lists the views that are not shown do not exist 
(can not be found). You will need to use solo.scrollUp() first until the text 
view is shown and then use searchText(). 

Original comment by renasr...@gmail.com on 18 Apr 2011 at 12:36

GoogleCodeExporter commented 9 years ago
But there is an argument in SearchText() about 'scroll', when without scroll
('isVisable' set to false), it also would automatically scroll to find the
text. But the scroll only roll downwards.
So I think there should be some code changes to make it scroll both
directions.

Original comment by wangxiao...@gmail.com on 18 Apr 2011 at 12:42

GoogleCodeExporter commented 9 years ago
That would not work well as then it would try to scroll down first and if it 
does not find it, it would scroll up, and then scroll down again. You will need 
to use scrollUp() manually and then searchText.

Original comment by renasr...@gmail.com on 18 Apr 2011 at 12:46

GoogleCodeExporter commented 9 years ago
OK. Thanks. And we should use the seachText() method which could disable the
scrolling. I spent hours to find out why it was in an infinite loop to try
to find the first element...

Original comment by wangxiao...@gmail.com on 18 Apr 2011 at 1:12