In small screen, it is better for skip this case.
Although you set px, but leanerlayout is warp_content, if screen is not large engough to
contain child, the height/weight will be the residual space instead of the specific size.
For example,
<LinearLayout android:id="@+id/doubleNestedView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingTop="23px"
android:paddingBottom="31px"
android:paddingLeft="37px"
android:paddingRight="29px"
android:orientation="vertical"
android:background="#00F"
android:importantForAutofill="yes">
<EditText android:id="@+id/tripleNestedView"
android:layout_height="4100px"
android:layout_width="43px"
android:background="#FF0"
android:importantForAutofill="yes" />
</LinearLayout>
height of doubleNestedView is: 670, height of tripleNestedView is: 4100.
You should consider this situation of that the phone's screen is small that can not contain its view.
so it will fail.
assertThat(outerView.getHeight()).isEqualTo(
185 2 // outerView.top
186 + 11 // nestedView.top
187 + 23 // doubleNestedView.top
188 + 41 // tripleNestedView.height
189 + 47 // secondDoubleNestedView.height
190 + 31 // doubleNestedView.bottom
191 + 17 // nestedView.bottom
192 + 5); // outerView.bottom
Fixes: 79958996
Test: ViewAttributesTest#checkViewLocationInAssistStructure
Merged-In: I1a447c4dc9dafeb535f53e59d06d0b551a104873
Change-Id: I1a447c4dc9dafeb535f53e59d06d0b551a104873
3 files changed