Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ed66550 authored by Tiger Huang's avatar Tiger Huang Committed by Automerger Merge Worker
Browse files

Merge "Refine InsetsSourceTest#testGetIndex,testGetType" into udc-dev am: 6593d03b

parents d1558147 6593d03b
Loading
Loading
Loading
Loading
+24 −8
Original line number Original line Diff line number Diff line
@@ -229,20 +229,36 @@ public class InsetsSourceTest {


    @Test
    @Test
    public void testGetIndex() {
    public void testGetIndex() {
        // 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 index = 0; index < 2048; index++) {
                for (int type = FIRST; type <= LAST; type = type << 1) {
                for (int type = FIRST; type <= LAST; type = type << 1) {
                final int id = InsetsSource.createId(null, index, type);
                    final int id = InsetsSource.createId(owner, index, type);
                assertEquals(index, InsetsSource.getIndex(id));
                    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
    @Test
    public void testGetType() {
    public void testGetType() {
        // 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 index = 0; index < 2048; index++) {
                for (int type = FIRST; type <= LAST; type = type << 1) {
                for (int type = FIRST; type <= LAST; type = type << 1) {
                final int id = InsetsSource.createId(null, index, type);
                    final int id = InsetsSource.createId(owner, index, type);
                assertEquals(type, InsetsSource.getType(id));
                    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);
                }
            }
            }
        }
        }
    }
    }