landryshuai / robotium

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

HorizontalScrollView scroll to right #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Create a HorizontalScrollView and views like buttons which spance more than 
screen size
2.From solo getViews and select the invisible button of the HorizontalScrollView
3.And do clickOnView(hiddenButton) expected is action from button
but there was no action performed

What is the expected output? What do you see instead?
Hidden buttons click action has to be performed. I can see the button from 
getViews but click dont give any output.

What version of the product are you using? On what operating system?
1.7 API, Android 2.2, windows XP, on Droid device

Please provide any additional information below.

Original issue reported on code.google.com by malliknm...@gmail.com on 30 Aug 2010 at 6:27

GoogleCodeExporter commented 9 years ago
Addding views to HorizontalScrollView 

Original comment by malliknm...@gmail.com on 30 Aug 2010 at 6:29

GoogleCodeExporter commented 9 years ago
So basically the button is not shown when you want it to be clicked? Robotium 
tries to emulate a real user so therefore if it can not reach the button 
(hidden) it will not be able to click it. You should use scrollToSide() before 
you use clickOnView()/clickOnButton().

Original comment by renasr...@gmail.com on 31 Aug 2010 at 6:10

GoogleCodeExporter commented 9 years ago
I tried it but i have one more scroll view before my HorizontalScrollView on 
the screen.When i try to do scrollToSide() it happens to first scroll view not 
to the
second one where my hidden button is.

Or How to scroll specifice ScrollView if there are more than one on screen.

Original comment by malliknm...@gmail.com on 31 Aug 2010 at 5:33

GoogleCodeExporter commented 9 years ago
Use drag() instead, then you can define yourself how it should drag the screen. 
You might need to use 2 drags after eachother. There is functionality to choose 
which list to scroll but not which scroll view to scroll. 

Original comment by renasr...@gmail.com on 31 Aug 2010 at 6:05

GoogleCodeExporter commented 9 years ago
My  HorizontalScrollView  is very bottom of the screen and my hidden button is 
far right in the scroll view , when i use drag(0,-50,0,0,10) nothing happens.
I am thinking this will move scrollview 50 units left from 0 in x direction and 
keep y the same.

Original comment by malliknm...@gmail.com on 31 Aug 2010 at 6:33

GoogleCodeExporter commented 9 years ago
You should write:

int screenWidth =        
solo.getCurrentActivity().getWindowManager().getDefaultDisplay().getWidth();

drag(0,width -10,0,0,10) //-10  or more depending how far in the right it 
should start to drag.

Original comment by renasr...@gmail.com on 31 Aug 2010 at 6:53

GoogleCodeExporter commented 9 years ago
it should be:
drag(width -10,10,20,20,10) //You want to start the drag from the right. The 20 
is where the dragging in y should start which should be depending on your 
screen height. 

Original comment by renasr...@gmail.com on 31 Aug 2010 at 6:57

GoogleCodeExporter commented 9 years ago
i get below error when i tried your idea.

check this link how my HorizontalScrollView  look like
http://code.google.com/p/mobyfactory-uiwidgets-android/

08-31 15:31:21.435: INFO/TestRunner(2367): 
junit.framework.AssertionFailedError: Application can not be dragged!
08-31 15:31:21.435: INFO/TestRunner(2367):     at 
junit.framework.Assert.fail(Assert.java:47)
08-31 15:31:21.435: INFO/TestRunner(2367):     at 
junit.framework.Assert.assertTrue(Assert.java:20)
08-31 15:31:21.435: INFO/TestRunner(2367):     at 
com.jayway.android.robotium.solo.Scroller.drag(Scroller.java:70)
08-31 15:31:21.435: INFO/TestRunner(2367):     at 
com.jayway.android.robotium.solo.Solo.drag(Solo.java:756)

Original comment by malliknm...@gmail.com on 31 Aug 2010 at 7:35

GoogleCodeExporter commented 9 years ago
try this:

int height =  
solo.getCurrentActivity().getWindowManager().getDefaultDisplay().getHeight();

drag(width -30,20,height-30,height-30,40);

Original comment by renasr...@gmail.com on 31 Aug 2010 at 8:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
According to functionality..

Original comment by renasr...@gmail.com on 1 Sep 2010 at 4:30

GoogleCodeExporter commented 9 years ago
It worked like charm. Awesome.
Thank you

Original comment by malliknm...@gmail.com on 2 Sep 2010 at 1:11