Merge "Refine InsetsSourceTest#testGetIndex,testGetType" into udc-dev am: 6593d03bc6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23156661 Change-Id: I37f23a9610bac388db742ac6e28a6389c15918ea Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user