mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
- There's a DeviceProfile state that is dynamic on a specific device class (based on a fw resource), this causes problems with the dump tests which compare the device profile against static prior dumps. For now, we can just update the expected dump based on the state of the resource to ensure that the current device profile state on this device matches. To do this, we also need to consolidate the various duplicate methods to assert the current and golden dumps match to have a common place to adjust the expected dump. Bug: 315230497 Test: atest DeviceProfileDumpTest Test: atest DeviceProfileAlternativeDisplaysDumpTest Change-Id: I5130d330878757702af07e166a669cc76452b271
159 lines
4.8 KiB
Kotlin
159 lines
4.8 KiB
Kotlin
/*
|
|
* Copyright (C) 2023 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.launcher3.nonquickstep
|
|
|
|
import android.content.Context
|
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
import androidx.test.filters.SmallTest
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
|
import com.android.launcher3.AbstractDeviceProfileTest
|
|
import com.android.launcher3.DeviceProfile
|
|
import com.android.launcher3.InvariantDeviceProfile
|
|
import com.google.common.truth.Truth.assertThat
|
|
import org.junit.Test
|
|
import org.junit.runner.RunWith
|
|
|
|
/** Tests for DeviceProfile. */
|
|
@SmallTest
|
|
@RunWith(AndroidJUnit4::class)
|
|
class DeviceProfileDumpTest : AbstractDeviceProfileTest() {
|
|
private val folderName: String = "DeviceProfileDumpTest"
|
|
@Test
|
|
fun phonePortrait3Button() {
|
|
initializeVarsForPhone(deviceSpecs["phone"]!!, isGestureMode = false)
|
|
val dp = getDeviceProfileForGrid("5_by_5")
|
|
|
|
assertDump(dp, "phonePortrait3Button")
|
|
}
|
|
|
|
@Test
|
|
fun phonePortrait() {
|
|
initializeVarsForPhone(deviceSpecs["phone"]!!)
|
|
val dp = getDeviceProfileForGrid("5_by_5")
|
|
|
|
assertDump(dp, "phonePortrait")
|
|
}
|
|
|
|
@Test
|
|
fun phoneVerticalBar3Button() {
|
|
initializeVarsForPhone(deviceSpecs["phone"]!!, isVerticalBar = true, isGestureMode = false)
|
|
val dp = getDeviceProfileForGrid("5_by_5")
|
|
|
|
assertDump(dp, "phoneVerticalBar3Button")
|
|
}
|
|
|
|
@Test
|
|
fun phoneVerticalBar() {
|
|
initializeVarsForPhone(deviceSpecs["phone"]!!, isVerticalBar = true)
|
|
val dp = getDeviceProfileForGrid("5_by_5")
|
|
|
|
assertDump(dp, "phoneVerticalBar")
|
|
}
|
|
|
|
@Test
|
|
fun tabletLandscape3Button() {
|
|
initializeVarsForTablet(deviceSpecs["tablet"]!!, isLandscape = true, isGestureMode = false)
|
|
val dp = getDeviceProfileForGrid("6_by_5")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "tabletLandscape3Button")
|
|
}
|
|
|
|
@Test
|
|
fun tabletLandscape() {
|
|
initializeVarsForTablet(deviceSpecs["tablet"]!!, isLandscape = true)
|
|
val dp = getDeviceProfileForGrid("6_by_5")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "tabletLandscape")
|
|
}
|
|
|
|
@Test
|
|
fun tabletPortrait3Button() {
|
|
initializeVarsForTablet(deviceSpecs["tablet"]!!, isGestureMode = false)
|
|
val dp = getDeviceProfileForGrid("6_by_5")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "tabletPortrait3Button")
|
|
}
|
|
|
|
@Test
|
|
fun tabletPortrait() {
|
|
initializeVarsForTablet(deviceSpecs["tablet"]!!)
|
|
val dp = getDeviceProfileForGrid("6_by_5")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "tabletPortrait")
|
|
}
|
|
|
|
@Test
|
|
fun twoPanelLandscape3Button() {
|
|
initializeVarsForTwoPanel(
|
|
deviceSpecs["twopanel-tablet"]!!,
|
|
deviceSpecs["twopanel-phone"]!!,
|
|
isLandscape = true,
|
|
isGestureMode = false
|
|
)
|
|
val dp = getDeviceProfileForGrid("4_by_4")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "twoPanelLandscape3Button")
|
|
}
|
|
|
|
@Test
|
|
fun twoPanelLandscape() {
|
|
initializeVarsForTwoPanel(
|
|
deviceSpecs["twopanel-tablet"]!!,
|
|
deviceSpecs["twopanel-phone"]!!,
|
|
isLandscape = true
|
|
)
|
|
val dp = getDeviceProfileForGrid("4_by_4")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "twoPanelLandscape")
|
|
}
|
|
|
|
@Test
|
|
fun twoPanelPortrait3Button() {
|
|
initializeVarsForTwoPanel(
|
|
deviceSpecs["twopanel-tablet"]!!,
|
|
deviceSpecs["twopanel-phone"]!!,
|
|
isGestureMode = false
|
|
)
|
|
val dp = getDeviceProfileForGrid("4_by_4")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "twoPanelPortrait3Button")
|
|
}
|
|
|
|
@Test
|
|
fun twoPanelPortrait() {
|
|
initializeVarsForTwoPanel(deviceSpecs["twopanel-tablet"]!!, deviceSpecs["twopanel-phone"]!!)
|
|
val dp = getDeviceProfileForGrid("4_by_4")
|
|
dp.isTaskbarPresentInApps = true
|
|
|
|
assertDump(dp, "twoPanelPortrait")
|
|
}
|
|
|
|
private fun getDeviceProfileForGrid(gridName: String): DeviceProfile {
|
|
return InvariantDeviceProfile(context, gridName).getDeviceProfile(context)
|
|
}
|
|
|
|
private fun assertDump(dp: DeviceProfile, filename: String) {
|
|
assertDump(dp, folderName, filename);
|
|
}
|
|
}
|