skyisle / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
1 stars 0 forks source link

scrollTo() and isDisplayingAtLeast() has problem for views with paddings on 4.1.2 phone emulators #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
do onView(withId(id)).perform(scrollTo()) on a TextView with paddings

What is the expected output? What do you see instead?
Exception is thrown saying that the view is scrolled but not displayed after 
scroll

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

Please provide any additional information below.
This does not happen in 4.3. My view has 5dp padding at the bottom. The 
resulting width and height are:
View: width 590, height 102
Displaying area: width 590, height 89

The end result is that Espresso thinks it is displaying only 88%, and it asks 
for 90%, so it fails the check. It looks like in Android 4.1.2, the API you use 
considers padding as invisible part of the view.

There are several options to fix this:
1. Lower the threshold to something like 85%. But this is not guaranteed to fix 
all problems
2. Provide another method scrollTo(int displayingAreaAfterScroll), and let the 
user decide.
3. Remove the paddings before you calculate the displaying area in older 
version of Android OS, so the user won't need to handle this. I like this most.

Original issue reported on code.google.com by K76...@gmail.com on 26 Dec 2013 at 5:51

GoogleCodeExporter commented 9 years ago

Original comment by vale...@google.com on 7 May 2014 at 4:52

GoogleCodeExporter commented 9 years ago
I can't seem to reproduce the bug that you've mentioned with a similar-sized 
TextView on an Android 4.1.2 phone emulator. It seems that the padding is taken 
into account when calculating the display area.

Could you post the relevant code to reproduce this behavior?

Original comment by jse...@google.com on 9 Jun 2014 at 11:41

GoogleCodeExporter commented 9 years ago
\

Original comment by vale...@google.com on 20 Dec 2014 at 4:23