am 29e1b5d9: Merge "If Display ratio (Height/Width) is 1.7, the button which is generated dynamically is longer and catches the input event. The mockview’s onTouchEvent is not called and causes test failure. We set the height of button as 1/3 of mockview’s Height
* commit '29e1b5d9cedcfbb55b720d0f81da82d712fca289':
If Display ratio (Height/Width) is 1.7, the button which is generated dynamically is longer and catches the input event. The mockview’s onTouchEvent is not called and causes test failure. We set the height of button as 1/3 of mockview’s Height to avoid to block the event delivery.
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index 888bb73..0af3f21 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -247,10 +247,11 @@
Rect rect = new Rect();
final Button button = new Button(mActivity);
final int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT;
+ final int btnHeight = view.getHeight()/3;
runTestOnUiThread(new Runnable() {
public void run() {
mActivity.addContentView(button,
- new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
+ new LinearLayout.LayoutParams(WRAP_CONTENT, btnHeight));
}
});
getInstrumentation().waitForIdleSync();