summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-05-30 09:11:01 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-30 09:11:01 -0700
commite49374b36f20d87119b0d16665757ebe9f841358 (patch)
treec7ce2568edc10dbf5d6f52601e6d0d60b17d0740
parent0c01e4dde3056aa498a87943de6acffb706ecca3 (diff)
parent309125545cd7ea00dbf4eca2481f1ce97d2711f6 (diff)
downloadcts-gingerbread.tar.gz
am 30912554: Merge "Use the middle of screen for InstrumentationTest" into gingerbreadgingerbread
* commit '309125545cd7ea00dbf4eca2481f1ce97d2711f6': Use the middle of screen for InstrumentationTest
-rw-r--r--tests/tests/app/src/android/app/cts/InstrumentationTest.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/tests/app/src/android/app/cts/InstrumentationTest.java b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
index e3eb46d6441..6b189699e87 100644
--- a/tests/tests/app/src/android/app/cts/InstrumentationTest.java
+++ b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
@@ -45,6 +45,7 @@ import android.view.SurfaceHolder;
import android.view.View;
import android.view.Window;
import android.view.ViewGroup.LayoutParams;
+import android.util.DisplayMetrics;
import com.android.cts.stub.R;
@@ -71,10 +72,11 @@ public class InstrumentationTest extends InstrumentationTestCase {
mContext = mInstrumentation.getTargetContext();
final long downTime = SystemClock.uptimeMillis();
final long eventTime = SystemClock.uptimeMillis();
- // use coordinates for MotionEvent that do not include the status bar
- // TODO: is there a more deterministic way to get these values
- final long x = 55;
- final long y = 55;
+ //Use the middle of the screen to avoid the status bar.
+ DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
+ final long x = metrics.widthPixels/2;
+ final long y = metrics.heightPixels/2;
+
final int metaState = 0;
mMotionEvent = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y,
metaState);