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

Commit b177c922 authored by Brandon Dayauon's avatar Brandon Dayauon
Browse files

Use setFlags to disable two line toggle flag in tests.

disableFlags for Flags.FLAG_ENABLED_TWOLINE_TOGGLE

bug: 316027081
Test: presubmit/gantry/manual
BubbleTextViewTest: https://screenshot.googleplex.com/8zFHWbwCFyxTTHC
Flag: com.android.launcher3.enable_twoline_toggle DEVELOPMENT
Change-Id: I530126de6ac63395acd2d176935e6f6f9759d4c3
parent 772e0127
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.content.Context
import android.content.res.Configuration
import android.graphics.Point
import android.graphics.Rect
import android.platform.test.flag.junit.SetFlagsRule
import android.platform.test.rule.AllowedDevices
import android.platform.test.rule.DeviceProduct
import android.platform.test.rule.IgnoreLimit
@@ -33,6 +34,7 @@ import com.android.launcher3.util.MainThreadInitializedObject.SandboxContext
import com.android.launcher3.util.NavigationMode
import com.android.launcher3.util.WindowBounds
import com.android.launcher3.util.rule.TestStabilityRule
import com.android.launcher3.util.rule.setFlags
import com.android.launcher3.util.window.CachedDisplayInfo
import com.android.launcher3.util.window.WindowManagerProxy
import com.google.common.truth.Truth
@@ -64,6 +66,8 @@ abstract class AbstractDeviceProfileTest {
    private val windowManagerProxy: WindowManagerProxy = mock()
    private val launcherPrefs: LauncherPrefs = mock()

    @get:Rule val setFlagsRule = SetFlagsRule(SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT)

    @Rule @JvmField val testStabilityRule = TestStabilityRule()

    @Rule @JvmField val limitDevicesRule = LimitDevicesRule()
@@ -270,6 +274,7 @@ abstract class AbstractDeviceProfileTest {
        isGestureMode: Boolean = true,
        densityDpi: Int
    ) {
        setFlagsRule.setFlags(false, Flags.FLAG_ENABLE_TWOLINE_TOGGLE)
        val windowsBounds = perDisplayBoundsCache[displayInfo]!!
        val realBounds = windowsBounds[rotation]
        whenever(windowManagerProxy.getDisplayInfo(any())).thenReturn(displayInfo)
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ public class BubbleTextViewTest {
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        Utilities.enableRunningInTestHarnessForTests();
        mSetFlagsRule.disableFlags(Flags.FLAG_ENABLE_TWOLINE_TOGGLE);
        mContext = new ActivityContextWrapper(getApplicationContext());
        mBubbleTextView = new BubbleTextView(mContext);
        mBubbleTextView.reset();