Loading packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/qs/QSLongPressEffectTest.kt +20 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,26 @@ class QSLongPressEffectTest : SysuiTestCase() { assertThat(longPressEffect.state).isEqualTo(QSLongPressEffect.State.TIMEOUT_WAIT) } @Test fun onActionDown_whileClicked_startsWait() = testWhileInState(QSLongPressEffect.State.CLICKED) { // GIVEN an action down event occurs longPressEffect.handleActionDown() // THEN the effect moves to the TIMEOUT_WAIT state assertThat(longPressEffect.state).isEqualTo(QSLongPressEffect.State.TIMEOUT_WAIT) } @Test fun onActionDown_whileLongClicked_startsWait() = testWhileInState(QSLongPressEffect.State.LONG_CLICKED) { // GIVEN an action down event occurs longPressEffect.handleActionDown() // THEN the effect moves to the TIMEOUT_WAIT state assertThat(longPressEffect.state).isEqualTo(QSLongPressEffect.State.TIMEOUT_WAIT) } @Test fun onActionCancel_whileWaiting_goesIdle() = testWhileInState(QSLongPressEffect.State.TIMEOUT_WAIT) { Loading packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +5 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,11 @@ constructor( fun handleActionDown() { logEvent(qsTile?.tileSpec, state, "action down received") when (state) { State.IDLE -> { State.IDLE, // ACTION_DOWN typically only happens in State.IDLE but including CLICKED and // LONG_CLICKED just to be safe`b State.CLICKED, State.LONG_CLICKED -> { setState(State.TIMEOUT_WAIT) } State.RUNNING_BACKWARDS_FROM_UP, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/qs/QSLongPressEffectTest.kt +20 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,26 @@ class QSLongPressEffectTest : SysuiTestCase() { assertThat(longPressEffect.state).isEqualTo(QSLongPressEffect.State.TIMEOUT_WAIT) } @Test fun onActionDown_whileClicked_startsWait() = testWhileInState(QSLongPressEffect.State.CLICKED) { // GIVEN an action down event occurs longPressEffect.handleActionDown() // THEN the effect moves to the TIMEOUT_WAIT state assertThat(longPressEffect.state).isEqualTo(QSLongPressEffect.State.TIMEOUT_WAIT) } @Test fun onActionDown_whileLongClicked_startsWait() = testWhileInState(QSLongPressEffect.State.LONG_CLICKED) { // GIVEN an action down event occurs longPressEffect.handleActionDown() // THEN the effect moves to the TIMEOUT_WAIT state assertThat(longPressEffect.state).isEqualTo(QSLongPressEffect.State.TIMEOUT_WAIT) } @Test fun onActionCancel_whileWaiting_goesIdle() = testWhileInState(QSLongPressEffect.State.TIMEOUT_WAIT) { Loading
packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +5 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,11 @@ constructor( fun handleActionDown() { logEvent(qsTile?.tileSpec, state, "action down received") when (state) { State.IDLE -> { State.IDLE, // ACTION_DOWN typically only happens in State.IDLE but including CLICKED and // LONG_CLICKED just to be safe`b State.CLICKED, State.LONG_CLICKED -> { setState(State.TIMEOUT_WAIT) } State.RUNNING_BACKWARDS_FROM_UP, Loading