Migrate GridOccupancyTest to Robolectric

This allows it to run fast locally on the JVM without an
emulator or physical device.

Change-Id: I416877d7c335a7b9c8dc7a216ecfeb1013f66891
This commit is contained in:
Ryan Lothian 2018-11-05 10:52:40 -05:00
parent b1513bd811
commit f4c42bc79a
1 changed files with 3 additions and 6 deletions

View File

@ -1,10 +1,8 @@
package com.android.launcher3.util; package com.android.launcher3.util;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -13,8 +11,7 @@ import static org.junit.Assert.assertTrue;
/** /**
* Unit tests for {@link GridOccupancy} * Unit tests for {@link GridOccupancy}
*/ */
@SmallTest @RunWith(RobolectricTestRunner.class)
@RunWith(AndroidJUnit4.class)
public class GridOccupancyTest { public class GridOccupancyTest {
@Test @Test
@ -24,7 +21,7 @@ public class GridOccupancyTest {
0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0 1, 1, 0, 0, 0
); );
int[] vacant = new int[2]; int[] vacant = new int[2];
assertTrue(grid.findVacantCell(vacant, 2, 2)); assertTrue(grid.findVacantCell(vacant, 2, 2));