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

Commit 98cb3354 authored by Tyler Freeman's avatar Tyler Freeman
Browse files

fix(magnification): fix AccessibilityManagerServiceTest on Wear

This test only makes sense if the test device supports Window
Magnification. Skip it otherwise.

This seems safer than mocking the package manager to lie about the
device supporting Window Magnification, since we don't know what other
parts of the system may have a dependency on that feature.

Bug: 299541066
Bug: 281124729

Test: atest com.android.server.accessibility.AccessibilityManagerServiceTest
Change-Id: Ice7a101fffb6a15b83d42c9ab12d992ecd269fe8
parent da5bccd9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static com.android.internal.accessibility.AccessibilityShortcutController
import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.assertThrows;
import static org.junit.Assume.assumeTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -428,6 +429,10 @@ public class AccessibilityManagerServiceTest {
    @SmallTest
    @Test
    public void testChangeMagnificationModeOnTestDisplay_capabilitiesIsAll_transitMode() {
        // This test only makes sense for devices that support Window magnification
        assumeTrue(mTestableContext.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_WINDOW_MAGNIFICATION));

        final AccessibilityUserState userState = mA11yms.mUserStates.get(
                mA11yms.getCurrentUserIdLocked());
        userState.setMagnificationCapabilitiesLocked(