EpicenterCallback should return screen coordinates
Tests fail on ARC where test app is launched as freeform window.
Bug: 160544400
Test: atest android.transition.cts.PropagationTest#testCircularPropagation
Change-Id: I22d8898d5e70fc5c1ea06f24c3f5e2634f6d008b
diff --git a/tests/tests/transition/src/android/transition/cts/PropagationTest.java b/tests/tests/transition/src/android/transition/cts/PropagationTest.java
index 783594c..0d46c74 100644
--- a/tests/tests/transition/src/android/transition/cts/PropagationTest.java
+++ b/tests/tests/transition/src/android/transition/cts/PropagationTest.java
@@ -65,13 +65,18 @@
mTransition.setEpicenterCallback(new Transition.EpicenterCallback() {
@Override
public Rect onGetEpicenter(Transition transition) {
- return new Rect(0, 0, redValues.view.getWidth(), redValues.view.getHeight());
+ final int[] offset = new int[2];
+ redValues.view.getLocationOnScreen(offset);
+
+ return new Rect(
+ offset[0], offset[1],
+ offset[0] + redValues.view.getWidth(), offset[1] + redValues.view.getHeight());
}
});
long redDelay = getDelay(R.id.redSquare);
- // red square's delay should be roughly 0 since it is at the epicenter
- assertEquals(0f, redDelay, 30f);
+ // red square's delay should be 0 since it is at the epicenter
+ assertEquals(0, redDelay);
// The green square is on the upper-right
long greenDelay = getDelay(R.id.greenSquare);