Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/logging/QSTileLoggerTest.kt +4 −8 Original line number Original line Diff line number Diff line Loading @@ -115,7 +115,7 @@ class QSTileLoggerTest : SysuiTestCase() { underTest.logUserActionPipeline( underTest.logUserActionPipeline( TileSpec.create("test_spec"), TileSpec.create("test_spec"), QSTileUserAction.Click(null), QSTileUserAction.Click(null), QSTileState.build({ Icon.Resource(0, ContentDescription.Resource(0)) }, "") {}, QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), "") {}, "test_data", "test_data", ) ) Loading @@ -141,7 +141,7 @@ class QSTileLoggerTest : SysuiTestCase() { fun testLogStateUpdate() { fun testLogStateUpdate() { underTest.logStateUpdate( underTest.logStateUpdate( TileSpec.create("test_spec"), TileSpec.create("test_spec"), QSTileState.build({ Icon.Resource(0, ContentDescription.Resource(0)) }, "") {}, QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), "") {}, "test_data", "test_data", ) ) Loading @@ -162,18 +162,14 @@ class QSTileLoggerTest : SysuiTestCase() { @Test @Test fun testLogForceUpdate() { fun testLogForceUpdate() { underTest.logForceUpdate( underTest.logForceUpdate(TileSpec.create("test_spec")) TileSpec.create("test_spec"), ) assertThat(logBuffer.getStringBuffer()).contains("tile data force update") assertThat(logBuffer.getStringBuffer()).contains("tile data force update") } } @Test @Test fun testLogInitialUpdate() { fun testLogInitialUpdate() { underTest.logInitialRequest( underTest.logInitialRequest(TileSpec.create("test_spec")) TileSpec.create("test_spec"), ) assertThat(logBuffer.getStringBuffer()).contains("tile data initial update") assertThat(logBuffer.getStringBuffer()).contains("tile data initial update") } } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt +3 −3 Original line number Original line Diff line number Diff line Loading @@ -85,8 +85,8 @@ class QSTileViewModelImplTest : SysuiTestCase() { object : QSTileDataToStateMapper<Any> { object : QSTileDataToStateMapper<Any> { override fun map(config: QSTileConfig, data: Any): QSTileState = override fun map(config: QSTileConfig, data: Any): QSTileState = QSTileState.build( QSTileState.build( { Icon.Resource(0, ContentDescription.Resource(0)) }, Icon.Resource(0, ContentDescription.Resource(0)), data.toString() data.toString(), ) {} ) {} } } }, }, Loading Loading @@ -116,7 +116,7 @@ class QSTileViewModelImplTest : SysuiTestCase() { .isEqualTo( .isEqualTo( "test_spec:\n" + "test_spec:\n" + " QSTileState(" + " QSTileState(" + "icon=() -> com.android.systemui.common.shared.model.Icon?, " + "icon=Resource(res=0, contentDescription=Resource(res=0)), " + "iconRes=null, " + "iconRes=null, " + "label=test_data, " + "label=test_data, " + "activationState=INACTIVE, " + "activationState=INACTIVE, " + Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt +5 −5 Original line number Original line Diff line number Diff line Loading @@ -66,7 +66,7 @@ class AirplaneModeMapperTest : SysuiTestCase() { createAirplaneModeState( createAirplaneModeState( QSTileState.ActivationState.ACTIVE, QSTileState.ActivationState.ACTIVE, context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_ACTIVE], context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_ACTIVE], R.drawable.qs_airplane_icon_on R.drawable.qs_airplane_icon_on, ) ) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) } } Loading @@ -81,7 +81,7 @@ class AirplaneModeMapperTest : SysuiTestCase() { createAirplaneModeState( createAirplaneModeState( QSTileState.ActivationState.INACTIVE, QSTileState.ActivationState.INACTIVE, context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_INACTIVE], context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_INACTIVE], R.drawable.qs_airplane_icon_off R.drawable.qs_airplane_icon_off, ) ) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) } } Loading @@ -89,11 +89,11 @@ class AirplaneModeMapperTest : SysuiTestCase() { private fun createAirplaneModeState( private fun createAirplaneModeState( activationState: QSTileState.ActivationState, activationState: QSTileState.ActivationState, secondaryLabel: String, secondaryLabel: String, iconRes: Int iconRes: Int, ): QSTileState { ): QSTileState { val label = context.getString(R.string.airplane_mode) val label = context.getString(R.string.airplane_mode) return QSTileState( return QSTileState( { Icon.Loaded(context.getDrawable(iconRes)!!, null) }, Icon.Loaded(context.getDrawable(iconRes)!!, null), iconRes, iconRes, label, label, activationState, activationState, Loading @@ -103,7 +103,7 @@ class AirplaneModeMapperTest : SysuiTestCase() { null, null, QSTileState.SideViewIcon.None, QSTileState.SideViewIcon.None, QSTileState.EnabledState.ENABLED, QSTileState.EnabledState.ENABLED, Switch::class.qualifiedName Switch::class.qualifiedName, ) ) } } } } packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt +10 −10 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,7 @@ class AlarmTileMapperTest : SysuiTestCase() { .apply { addOverride(R.drawable.ic_alarm, TestStubDrawable()) } .apply { addOverride(R.drawable.ic_alarm, TestStubDrawable()) } .resources, .resources, context.theme, context.theme, fakeClock fakeClock, ) ) } } Loading @@ -69,7 +69,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val expectedState = val expectedState = createAlarmTileState( createAlarmTileState( QSTileState.ActivationState.INACTIVE, QSTileState.ActivationState.INACTIVE, context.getString(R.string.qs_alarm_tile_no_alarm) context.getString(R.string.qs_alarm_tile_no_alarm), ) ) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) } } Loading @@ -85,7 +85,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatter24Hour.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatter24Hour.format(localDateTime) val expectedState = val expectedState = Loading @@ -104,7 +104,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedState = val expectedState = Loading @@ -124,7 +124,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedState = val expectedState = Loading @@ -144,7 +144,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedState = val expectedState = Loading @@ -164,7 +164,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedState = val expectedState = Loading @@ -174,11 +174,11 @@ class AlarmTileMapperTest : SysuiTestCase() { private fun createAlarmTileState( private fun createAlarmTileState( activationState: QSTileState.ActivationState, activationState: QSTileState.ActivationState, secondaryLabel: String secondaryLabel: String, ): QSTileState { ): QSTileState { val label = context.getString(R.string.status_bar_alarm) val label = context.getString(R.string.status_bar_alarm) return QSTileState( return QSTileState( { Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null) }, Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null), R.drawable.ic_alarm, R.drawable.ic_alarm, label, label, activationState, activationState, Loading @@ -188,7 +188,7 @@ class AlarmTileMapperTest : SysuiTestCase() { null, null, QSTileState.SideViewIcon.Chevron, QSTileState.SideViewIcon.Chevron, QSTileState.EnabledState.ENABLED, QSTileState.EnabledState.ENABLED, Switch::class.qualifiedName Switch::class.qualifiedName, ) ) } } } } packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -253,7 +253,7 @@ class BatterySaverTileMapperTest : SysuiTestCase() { ): QSTileState { ): QSTileState { val label = context.getString(R.string.battery_detail_switch_title) val label = context.getString(R.string.battery_detail_switch_title) return QSTileState( return QSTileState( { Icon.Loaded(context.getDrawable(iconRes)!!, null) }, Icon.Loaded(context.getDrawable(iconRes)!!, null), iconRes, iconRes, label, label, activationState, activationState, Loading @@ -265,7 +265,7 @@ class BatterySaverTileMapperTest : SysuiTestCase() { stateDescription, stateDescription, QSTileState.SideViewIcon.None, QSTileState.SideViewIcon.None, QSTileState.EnabledState.ENABLED, QSTileState.EnabledState.ENABLED, Switch::class.qualifiedName Switch::class.qualifiedName, ) ) } } } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/logging/QSTileLoggerTest.kt +4 −8 Original line number Original line Diff line number Diff line Loading @@ -115,7 +115,7 @@ class QSTileLoggerTest : SysuiTestCase() { underTest.logUserActionPipeline( underTest.logUserActionPipeline( TileSpec.create("test_spec"), TileSpec.create("test_spec"), QSTileUserAction.Click(null), QSTileUserAction.Click(null), QSTileState.build({ Icon.Resource(0, ContentDescription.Resource(0)) }, "") {}, QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), "") {}, "test_data", "test_data", ) ) Loading @@ -141,7 +141,7 @@ class QSTileLoggerTest : SysuiTestCase() { fun testLogStateUpdate() { fun testLogStateUpdate() { underTest.logStateUpdate( underTest.logStateUpdate( TileSpec.create("test_spec"), TileSpec.create("test_spec"), QSTileState.build({ Icon.Resource(0, ContentDescription.Resource(0)) }, "") {}, QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), "") {}, "test_data", "test_data", ) ) Loading @@ -162,18 +162,14 @@ class QSTileLoggerTest : SysuiTestCase() { @Test @Test fun testLogForceUpdate() { fun testLogForceUpdate() { underTest.logForceUpdate( underTest.logForceUpdate(TileSpec.create("test_spec")) TileSpec.create("test_spec"), ) assertThat(logBuffer.getStringBuffer()).contains("tile data force update") assertThat(logBuffer.getStringBuffer()).contains("tile data force update") } } @Test @Test fun testLogInitialUpdate() { fun testLogInitialUpdate() { underTest.logInitialRequest( underTest.logInitialRequest(TileSpec.create("test_spec")) TileSpec.create("test_spec"), ) assertThat(logBuffer.getStringBuffer()).contains("tile data initial update") assertThat(logBuffer.getStringBuffer()).contains("tile data initial update") } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt +3 −3 Original line number Original line Diff line number Diff line Loading @@ -85,8 +85,8 @@ class QSTileViewModelImplTest : SysuiTestCase() { object : QSTileDataToStateMapper<Any> { object : QSTileDataToStateMapper<Any> { override fun map(config: QSTileConfig, data: Any): QSTileState = override fun map(config: QSTileConfig, data: Any): QSTileState = QSTileState.build( QSTileState.build( { Icon.Resource(0, ContentDescription.Resource(0)) }, Icon.Resource(0, ContentDescription.Resource(0)), data.toString() data.toString(), ) {} ) {} } } }, }, Loading Loading @@ -116,7 +116,7 @@ class QSTileViewModelImplTest : SysuiTestCase() { .isEqualTo( .isEqualTo( "test_spec:\n" + "test_spec:\n" + " QSTileState(" + " QSTileState(" + "icon=() -> com.android.systemui.common.shared.model.Icon?, " + "icon=Resource(res=0, contentDescription=Resource(res=0)), " + "iconRes=null, " + "iconRes=null, " + "label=test_data, " + "label=test_data, " + "activationState=INACTIVE, " + "activationState=INACTIVE, " + Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt +5 −5 Original line number Original line Diff line number Diff line Loading @@ -66,7 +66,7 @@ class AirplaneModeMapperTest : SysuiTestCase() { createAirplaneModeState( createAirplaneModeState( QSTileState.ActivationState.ACTIVE, QSTileState.ActivationState.ACTIVE, context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_ACTIVE], context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_ACTIVE], R.drawable.qs_airplane_icon_on R.drawable.qs_airplane_icon_on, ) ) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) } } Loading @@ -81,7 +81,7 @@ class AirplaneModeMapperTest : SysuiTestCase() { createAirplaneModeState( createAirplaneModeState( QSTileState.ActivationState.INACTIVE, QSTileState.ActivationState.INACTIVE, context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_INACTIVE], context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_INACTIVE], R.drawable.qs_airplane_icon_off R.drawable.qs_airplane_icon_off, ) ) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) } } Loading @@ -89,11 +89,11 @@ class AirplaneModeMapperTest : SysuiTestCase() { private fun createAirplaneModeState( private fun createAirplaneModeState( activationState: QSTileState.ActivationState, activationState: QSTileState.ActivationState, secondaryLabel: String, secondaryLabel: String, iconRes: Int iconRes: Int, ): QSTileState { ): QSTileState { val label = context.getString(R.string.airplane_mode) val label = context.getString(R.string.airplane_mode) return QSTileState( return QSTileState( { Icon.Loaded(context.getDrawable(iconRes)!!, null) }, Icon.Loaded(context.getDrawable(iconRes)!!, null), iconRes, iconRes, label, label, activationState, activationState, Loading @@ -103,7 +103,7 @@ class AirplaneModeMapperTest : SysuiTestCase() { null, null, QSTileState.SideViewIcon.None, QSTileState.SideViewIcon.None, QSTileState.EnabledState.ENABLED, QSTileState.EnabledState.ENABLED, Switch::class.qualifiedName Switch::class.qualifiedName, ) ) } } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt +10 −10 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,7 @@ class AlarmTileMapperTest : SysuiTestCase() { .apply { addOverride(R.drawable.ic_alarm, TestStubDrawable()) } .apply { addOverride(R.drawable.ic_alarm, TestStubDrawable()) } .resources, .resources, context.theme, context.theme, fakeClock fakeClock, ) ) } } Loading @@ -69,7 +69,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val expectedState = val expectedState = createAlarmTileState( createAlarmTileState( QSTileState.ActivationState.INACTIVE, QSTileState.ActivationState.INACTIVE, context.getString(R.string.qs_alarm_tile_no_alarm) context.getString(R.string.qs_alarm_tile_no_alarm), ) ) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState) } } Loading @@ -85,7 +85,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatter24Hour.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatter24Hour.format(localDateTime) val expectedState = val expectedState = Loading @@ -104,7 +104,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedState = val expectedState = Loading @@ -124,7 +124,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedState = val expectedState = Loading @@ -144,7 +144,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime) val expectedState = val expectedState = Loading @@ -164,7 +164,7 @@ class AlarmTileMapperTest : SysuiTestCase() { val localDateTime = val localDateTime = LocalDateTime.ofInstant( LocalDateTime.ofInstant( Instant.ofEpochMilli(triggerTime), Instant.ofEpochMilli(triggerTime), TimeZone.getDefault().toZoneId() TimeZone.getDefault().toZoneId(), ) ) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime) val expectedState = val expectedState = Loading @@ -174,11 +174,11 @@ class AlarmTileMapperTest : SysuiTestCase() { private fun createAlarmTileState( private fun createAlarmTileState( activationState: QSTileState.ActivationState, activationState: QSTileState.ActivationState, secondaryLabel: String secondaryLabel: String, ): QSTileState { ): QSTileState { val label = context.getString(R.string.status_bar_alarm) val label = context.getString(R.string.status_bar_alarm) return QSTileState( return QSTileState( { Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null) }, Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null), R.drawable.ic_alarm, R.drawable.ic_alarm, label, label, activationState, activationState, Loading @@ -188,7 +188,7 @@ class AlarmTileMapperTest : SysuiTestCase() { null, null, QSTileState.SideViewIcon.Chevron, QSTileState.SideViewIcon.Chevron, QSTileState.EnabledState.ENABLED, QSTileState.EnabledState.ENABLED, Switch::class.qualifiedName Switch::class.qualifiedName, ) ) } } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -253,7 +253,7 @@ class BatterySaverTileMapperTest : SysuiTestCase() { ): QSTileState { ): QSTileState { val label = context.getString(R.string.battery_detail_switch_title) val label = context.getString(R.string.battery_detail_switch_title) return QSTileState( return QSTileState( { Icon.Loaded(context.getDrawable(iconRes)!!, null) }, Icon.Loaded(context.getDrawable(iconRes)!!, null), iconRes, iconRes, label, label, activationState, activationState, Loading @@ -265,7 +265,7 @@ class BatterySaverTileMapperTest : SysuiTestCase() { stateDescription, stateDescription, QSTileState.SideViewIcon.None, QSTileState.SideViewIcon.None, QSTileState.EnabledState.ENABLED, QSTileState.EnabledState.ENABLED, Switch::class.qualifiedName Switch::class.qualifiedName, ) ) } } } }