mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
Add a refactored TaskThumbnailView
- Live Tile, swipe (left+right) and dismiss working - Tests of ViewModel state transitions - Deprecate the old TaskThumbnailView - Renaming TaskThumbnailView to TaskThumbnailViewDeprecated Fix: 335440878 Fix: 331754672 Bug: 331753115 Test: TaskThumbnailViewModelTest Test: Attached video on bug Flag: ACONFIG com.android.launcher3.enable_refactor_task_thumbnail DEVELOPMENT Change-Id: I063b957fe6e56960970dcaadc641848fbd73251c
This commit is contained in:
committed by
Jordan Silva
parent
782af232e3
commit
e21525da40
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.quickstep.task.thumbnail
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.android.systemui.shared.recents.model.Task
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class TaskThumbnailViewModelTest {
|
||||
private val systemUnderTest = TaskThumbnailViewModel()
|
||||
|
||||
@Test
|
||||
fun initialStateIsUninitialized() {
|
||||
assertThat(systemUnderTest.uiState.value).isEqualTo(TaskThumbnailUiState.Uninitialized)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bindRunningTask_thenStateIs_LiveTile() {
|
||||
val taskThumbnail = TaskThumbnail(Task(), isRunning = true)
|
||||
systemUnderTest.bind(taskThumbnail)
|
||||
|
||||
assertThat(systemUnderTest.uiState.value).isEqualTo(TaskThumbnailUiState.LiveTile)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bindRunningTaskThenStoppedTask_thenStateIs_Uninitialized() {
|
||||
// TODO(b/334825222): Change the expectation here when snapshot state is implemented
|
||||
val task = Task()
|
||||
val runningTask = TaskThumbnail(task, isRunning = true)
|
||||
val stoppedTask = TaskThumbnail(task, isRunning = false)
|
||||
systemUnderTest.bind(runningTask)
|
||||
assertThat(systemUnderTest.uiState.value).isEqualTo(TaskThumbnailUiState.LiveTile)
|
||||
|
||||
systemUnderTest.bind(stoppedTask)
|
||||
assertThat(systemUnderTest.uiState.value).isEqualTo(TaskThumbnailUiState.Uninitialized)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user