You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SwitchCompat inside a ConstraintLayout inside a NestedScrollView has a height of height=16777214 which causes operations like isCompletelyDisplayed() to fail. This also prevents clicks for a similar reason if you have several switches in the same layout.
The test passes and the height is reported at a sensible value.
Actual Result
The test fails and the height is reported as 16777214
androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'at least 100 percent of the view's area is displayed to the user.' doesn't match the selected view.
Expected: at least 100 percent of the view's area is displayed to the user.
Got: "SwitchCompat{id=2131231095, res-name=switch_compat_2, visibility=VISIBLE, width=320, height=16777214, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@54738eaa, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=1.6777216E7, text=Don't Switch Me, input-type=0, ime-target=false, has-links=false, is-checked=false}"
Note that if I change the view reference to the top most SwitchCompat the test passes. This also passes if I only have a single item inside the ConstraintLayout.
Also note that in the design editor in Android Studio the SwitchCompat looks normal, as it does when you run the app on a device.
Robolectric & Android Version
Roblectric 4.4
Android 7 - SDK / API 24
Link to a public git repo demonstrating the problem:
Description
SwitchCompat inside a ConstraintLayout inside a NestedScrollView has a height of
height=16777214
which causes operations likeisCompletelyDisplayed()
to fail. This also prevents clicks for a similar reason if you have several switches in the same layout.Steps to Reproduce
Expected Result
The test passes and the height is reported at a sensible value.
Actual Result
The test fails and the height is reported as 16777214
Note that if I change the view reference to the top most SwitchCompat the test passes. This also passes if I only have a single item inside the ConstraintLayout.
Also note that in the design editor in Android Studio the SwitchCompat looks normal, as it does when you run the app on a device.
Robolectric & Android Version
Roblectric 4.4
Android 7 - SDK / API 24
Link to a public git repo demonstrating the problem:
Minimal project to reproduce a bug with SwitchCompat NestedScrollView and Robolectric
The text was updated successfully, but these errors were encountered: