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

Commit 33a7b96f authored by Wes Okuhara's avatar Wes Okuhara
Browse files

Settings: Fix queryShortcuts_shouldSortBasedOnPriority test

Previously this test asserted that the resulting ActivityInfo instances
from the queryShortcuts() method were the same address. While this can
assert general equality, it is more robust to assert the resulting
ResolveInfos- mainly that they are sorted by priority.

Bug: b/314924127
Test: atest SettingsRoboTests:com.android.settings.shortcut.CreateShortcutPreferenceControllerTest
Flag: TEST_ONLY
Change-Id: I00210440c7c1a87a6f8eb7a2866ae8571ec7d053
parent 229a1dbc
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -141,7 +141,6 @@ public class CreateShortcutPreferenceControllerTest {
        assertThat(resultActivityInfo.applicationInfo.isSystemApp()).isTrue();
    }

    @Ignore("b/314924127")
    @Test
    public void queryShortcuts_shouldSortBasedOnPriority() {
        final ResolveInfo ri1 = new ResolveInfo();
@@ -165,8 +164,12 @@ public class CreateShortcutPreferenceControllerTest {
        doReturn(false).when(mController).canShowWifiHotspot();
        final List<ResolveInfo> info = mController.queryShortcuts();
        assertThat(info).hasSize(2);
        assertThat(info.get(0).activityInfo).isEqualTo(ri2.activityInfo);
        assertThat(info.get(1).activityInfo).isEqualTo(ri1.activityInfo);

        final ResolveInfo resultRi1 = info.get(0);
        assertThat(resultRi1.activityInfo.name).isEqualTo(ri2.activityInfo.name);
        final ResolveInfo resultRi2 = info.get(1);
        assertThat(resultRi2.activityInfo.name).isEqualTo(ri1.activityInfo.name);
        assertThat(resultRi1.priority).isLessThan(resultRi2.priority);
    }

    @Test