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

Commit 63b1cff5 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Adjust test for guts fix flag

We shouldn't disable the tests when the flag is enabled, but instead
just not check that areGutsExposed gets called (since the flag removes
that call).

Flag: TEST_ONLY
Test: ViewConfigCoordinatorTest
Bug: 379267630
Change-Id: I68a11e48e3f12a2fb2cd482ab972f8c49f57b4d9
parent e5dff502
Loading
Loading
Loading
Loading
+20 −12
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.filters.SmallTest
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener
@@ -64,7 +65,8 @@ class ViewConfigCoordinatorTest : SysuiTestCase() {
    fun setUp() {
    fun setUp() {
        whenever(pipeline.allNotifs).thenReturn(listOf(entry))
        whenever(pipeline.allNotifs).thenReturn(listOf(entry))
        whenever(entry.row).thenReturn(row)
        whenever(entry.row).thenReturn(row)
        coordinator = ViewConfigCoordinator(
        coordinator =
            ViewConfigCoordinator(
                configurationController,
                configurationController,
                lockscreenUserManager,
                lockscreenUserManager,
                gutsManager,
                gutsManager,
@@ -95,7 +97,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() {
    fun themeChangePropagatesToEntry() {
    fun themeChangePropagatesToEntry() {
        configurationListener.onThemeChanged()
        configurationListener.onThemeChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).areGutsExposed()
        checkGutsExposedCalled()
        verifyNoMoreInteractions(entry, row)
        verifyNoMoreInteractions(entry, row)
    }
    }


@@ -103,7 +105,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() {
    fun densityChangePropagatesToEntry() {
    fun densityChangePropagatesToEntry() {
        configurationListener.onDensityOrFontScaleChanged()
        configurationListener.onDensityOrFontScaleChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).areGutsExposed()
        checkGutsExposedCalled()
        verifyNoMoreInteractions(entry, row)
        verifyNoMoreInteractions(entry, row)
    }
    }


@@ -127,7 +129,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() {
        verify(entry).row
        verify(entry).row
        verify(row).onUiModeChanged()
        verify(row).onUiModeChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).areGutsExposed()
        checkGutsExposedCalled()
        verifyNoMoreInteractions(entry, row)
        verifyNoMoreInteractions(entry, row)
        clearInvocations(entry, row)
        clearInvocations(entry, row)


@@ -158,7 +160,7 @@ class ViewConfigCoordinatorTest : SysuiTestCase() {
        verify(entry).row
        verify(entry).row
        verify(row).onUiModeChanged()
        verify(row).onUiModeChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).areGutsExposed()
        checkGutsExposedCalled()
        verifyNoMoreInteractions(entry, row)
        verifyNoMoreInteractions(entry, row)
        clearInvocations(entry, row)
        clearInvocations(entry, row)


@@ -194,8 +196,14 @@ class ViewConfigCoordinatorTest : SysuiTestCase() {
        verify(entry).row
        verify(entry).row
        verify(row).onUiModeChanged()
        verify(row).onUiModeChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).onDensityOrFontScaleChanged()
        verify(entry).areGutsExposed()
        checkGutsExposedCalled()
        verifyNoMoreInteractions(entry, row)
        verifyNoMoreInteractions(entry, row)
        clearInvocations(entry, row)
        clearInvocations(entry, row)
    }
    }

    private fun checkGutsExposedCalled() {
        if (!Flags.notificationUndoGutsOnConfigChanged()) {
            verify(entry).areGutsExposed()
        }
    }
}
}