summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger Huang <tigerhuang@google.com> 2023-05-12 08:55:21 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-05-12 08:55:21 +0000
commit6593d03bc6e21bab4c7e71f68d542654fde1c95d (patch)
tree701472d7ff77e82bee54aa866c8848ceaeabee3c
parentee760d7e2b932814c02e400a5b6bd1de29fd59d4 (diff)
parentc74e81dd34438052c9f7cd925cd2486c19484a50 (diff)
Merge "Refine InsetsSourceTest#testGetIndex,testGetType" into udc-dev
-rw-r--r--core/tests/coretests/src/android/view/InsetsSourceTest.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/core/tests/coretests/src/android/view/InsetsSourceTest.java b/core/tests/coretests/src/android/view/InsetsSourceTest.java
index 55680abb159d..9595332afc6c 100644
--- a/core/tests/coretests/src/android/view/InsetsSourceTest.java
+++ b/core/tests/coretests/src/android/view/InsetsSourceTest.java
@@ -229,20 +229,36 @@ public class InsetsSourceTest {
@Test
public void testGetIndex() {
- for (int index = 0; index < 2048; index++) {
- for (int type = FIRST; type <= LAST; type = type << 1) {
- final int id = InsetsSource.createId(null, index, type);
- assertEquals(index, InsetsSource.getIndex(id));
+ // Here doesn't iterate all the owners, or the test cannot be done before timeout.
+ for (int owner = 0; owner < 100; owner++) {
+ for (int index = 0; index < 2048; index++) {
+ for (int type = FIRST; type <= LAST; type = type << 1) {
+ final int id = InsetsSource.createId(owner, index, type);
+ final int indexFromId = InsetsSource.getIndex(id);
+ assertEquals("index and indexFromId must be the same. id=" + id
+ + ", owner=" + owner
+ + ", index=" + index
+ + ", type=" + type
+ + ", indexFromId=" + indexFromId + ".", index, indexFromId);
+ }
}
}
}
@Test
public void testGetType() {
- for (int index = 0; index < 2048; index++) {
- for (int type = FIRST; type <= LAST; type = type << 1) {
- final int id = InsetsSource.createId(null, index, type);
- assertEquals(type, InsetsSource.getType(id));
+ // Here doesn't iterate all the owners, or the test cannot be done before timeout.
+ for (int owner = 0; owner < 100; owner++) {
+ for (int index = 0; index < 2048; index++) {
+ for (int type = FIRST; type <= LAST; type = type << 1) {
+ final int id = InsetsSource.createId(owner, index, type);
+ final int typeFromId = InsetsSource.getType(id);
+ assertEquals("type and typeFromId must be the same. id=" + id
+ + ", owner=" + owner
+ + ", index=" + index
+ + ", type=" + type
+ + ", typeFromId=" + typeFromId + ".", type, typeFromId);
+ }
}
}
}