mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
This update slightly changes the calculation method for Overview UI placement, in order to line up better with spec. (The previous calculation caused a small 30dp divergence on tablets.) Bug: 236760307 Test: Manual by measuring pixels and comparing to spec Change-Id: I94e9e7b5a6a24c37693425ac8ec71cd066003658
481 lines
11 KiB
Kotlin
481 lines
11 KiB
Kotlin
/*
|
|
* Copyright (C) 2022 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
|
|
|
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
import androidx.test.filters.SmallTest
|
|
import com.android.launcher3.DeviceProfile
|
|
import com.android.launcher3.DeviceProfileBaseTest
|
|
import com.google.common.truth.Truth.assertThat
|
|
import org.junit.Before
|
|
import org.junit.Test
|
|
import org.junit.runner.RunWith
|
|
|
|
/**
|
|
* Tests for DeviceProfile for landscape phone with vertical bar and 3-Button navigation.
|
|
*/
|
|
@SmallTest
|
|
@RunWith(AndroidJUnit4::class)
|
|
class DeviceProfileVerticalBar3ButtonTest : DeviceProfileBaseTest() {
|
|
|
|
lateinit var dp: DeviceProfile
|
|
|
|
@Before
|
|
fun before() {
|
|
initializeVarsForPhone(isVerticalBar = true, isGestureMode = false)
|
|
dp = newDP()
|
|
}
|
|
|
|
@Test
|
|
fun isScalableGrid() {
|
|
assertThat(dp.isScalableGrid).isFalse()
|
|
}
|
|
|
|
@Test
|
|
fun cellWidthPx() {
|
|
assertThat(dp.cellWidthPx).isEqualTo(210)
|
|
}
|
|
|
|
@Test
|
|
fun cellHeightPx() {
|
|
assertThat(dp.cellHeightPx).isEqualTo(221)
|
|
}
|
|
|
|
@Test
|
|
fun getCellSizeX() {
|
|
assertThat(dp.cellSize.x).isEqualTo(675)
|
|
}
|
|
|
|
@Test
|
|
fun getCellSizeY() {
|
|
assertThat(dp.cellSize.y).isEqualTo(321)
|
|
}
|
|
|
|
@Test
|
|
fun cellLayoutBorderSpacePxX() {
|
|
assertThat(dp.cellLayoutBorderSpacePx.x).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun cellLayoutBorderSpacePxY() {
|
|
assertThat(dp.cellLayoutBorderSpacePx.y).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun cellLayoutPaddingPxLeft() {
|
|
assertThat(dp.cellLayoutPaddingPx.left).isEqualTo(70)
|
|
}
|
|
|
|
@Test
|
|
fun cellLayoutPaddingPxTop() {
|
|
assertThat(dp.cellLayoutPaddingPx.top).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun cellLayoutPaddingPxRight() {
|
|
assertThat(dp.cellLayoutPaddingPx.right).isEqualTo(70)
|
|
}
|
|
|
|
@Test
|
|
fun cellLayoutPaddingPxBottom() {
|
|
assertThat(dp.cellLayoutPaddingPx.bottom).isEqualTo(53)
|
|
}
|
|
|
|
@Test
|
|
fun iconSizePx() {
|
|
assertThat(dp.iconSizePx).isEqualTo(196)
|
|
}
|
|
|
|
@Test
|
|
fun iconTextSizePx() {
|
|
assertThat(dp.iconTextSizePx).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun iconDrawablePaddingPx() {
|
|
assertThat(dp.iconDrawablePaddingPx).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun folderCellWidthPx() {
|
|
assertThat(dp.folderCellWidthPx).isEqualTo(260)
|
|
}
|
|
|
|
@Test
|
|
fun folderCellHeightPx() {
|
|
assertThat(dp.folderCellHeightPx).isEqualTo(304)
|
|
}
|
|
|
|
@Test
|
|
fun folderChildIconSizePx() {
|
|
assertThat(dp.folderChildIconSizePx).isEqualTo(196)
|
|
}
|
|
|
|
@Test
|
|
fun folderChildTextSizePx() {
|
|
assertThat(dp.folderChildTextSizePx).isEqualTo(49)
|
|
}
|
|
|
|
@Test
|
|
fun folderChildDrawablePaddingPx() {
|
|
assertThat(dp.folderChildDrawablePaddingPx).isEqualTo(14)
|
|
}
|
|
|
|
@Test
|
|
fun folderCellLayoutBorderSpaceOriginalPx() {
|
|
assertThat(dp.folderCellLayoutBorderSpaceOriginalPx).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun folderCellLayoutBorderSpacePxX() {
|
|
assertThat(dp.folderCellLayoutBorderSpacePx.x).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun folderCellLayoutBorderSpacePxY() {
|
|
assertThat(dp.folderCellLayoutBorderSpacePx.y).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun bottomSheetTopPadding() {
|
|
assertThat(dp.bottomSheetTopPadding).isEqualTo(53)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsShiftRange() {
|
|
assertThat(dp.allAppsShiftRange).isEqualTo(1050)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsTopPadding() {
|
|
assertThat(dp.allAppsTopPadding).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsIconSizePx() {
|
|
assertThat(dp.allAppsIconSizePx).isEqualTo(196)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsIconTextSizePx() {
|
|
assertThat(dp.allAppsIconTextSizePx).isEqualTo(49)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsIconDrawablePaddingPx() {
|
|
assertThat(dp.allAppsIconDrawablePaddingPx).isEqualTo(28)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsCellHeightPx() {
|
|
assertThat(dp.allAppsCellHeightPx).isEqualTo(422)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsCellWidthPx() {
|
|
assertThat(dp.allAppsCellWidthPx).isEqualTo(252)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsBorderSpacePxX() {
|
|
assertThat(dp.allAppsBorderSpacePx.x).isEqualTo(56)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsBorderSpacePxY() {
|
|
assertThat(dp.allAppsBorderSpacePx.y).isEqualTo(56)
|
|
}
|
|
|
|
@Test
|
|
fun numShownAllAppsColumns() {
|
|
assertThat(dp.numShownAllAppsColumns).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsLeftRightPadding() {
|
|
assertThat(dp.allAppsLeftRightPadding).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun allAppsLeftRightMargin() {
|
|
assertThat(dp.allAppsLeftRightMargin).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatBarSizePx() {
|
|
assertThat(dp.hotseatBarSizePx).isEqualTo(336)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatCellHeightPx() {
|
|
assertThat(dp.hotseatCellHeightPx).isEqualTo(221)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatBarBottomSpacePx() {
|
|
assertThat(dp.hotseatBarBottomSpacePx).isEqualTo(168)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatBarSidePaddingStartPx() {
|
|
assertThat(dp.hotseatBarSidePaddingStartPx).isEqualTo(84)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatBarSidePaddingEndPx() {
|
|
assertThat(dp.hotseatBarSidePaddingEndPx).isEqualTo(56)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatQsbSpace() {
|
|
assertThat(dp.hotseatQsbSpace).isEqualTo(126)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatQsbHeight() {
|
|
assertThat(dp.hotseatQsbHeight).isEqualTo(221)
|
|
}
|
|
|
|
@Test
|
|
fun springLoadedHotseatBarTopMarginPx() {
|
|
assertThat(dp.springLoadedHotseatBarTopMarginPx).isEqualTo(158)
|
|
}
|
|
|
|
@Test
|
|
fun numShownHotseatIcons() {
|
|
assertThat(dp.numShownHotseatIcons).isEqualTo(4)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatBorderSpace() {
|
|
assertThat(dp.hotseatBorderSpace).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun isQsbInline() {
|
|
assertThat(dp.isQsbInline).isEqualTo(false)
|
|
}
|
|
|
|
@Test
|
|
fun qsbWidth() {
|
|
assertThat(dp.qsbWidth).isEqualTo(2221)
|
|
}
|
|
|
|
@Test
|
|
fun isTaskbarPresent() {
|
|
assertThat(dp.isTaskbarPresent).isEqualTo(false)
|
|
}
|
|
|
|
@Test
|
|
fun isTaskbarPresentInApps() {
|
|
assertThat(dp.isTaskbarPresentInApps).isEqualTo(false)
|
|
}
|
|
|
|
@Test
|
|
fun taskbarSize() {
|
|
assertThat(dp.taskbarSize).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun desiredWorkspaceHorizontalMarginPx() {
|
|
assertThat(dp.desiredWorkspaceHorizontalMarginPx).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun workspacePaddingLeft() {
|
|
assertThat(dp.workspacePadding.left).isEqualTo(14)
|
|
}
|
|
|
|
@Test
|
|
fun workspacePaddingTop() {
|
|
assertThat(dp.workspacePadding.top).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun workspacePaddingRight() {
|
|
assertThat(dp.workspacePadding.right).isEqualTo(266)
|
|
}
|
|
|
|
@Test
|
|
fun workspacePaddingBottom() {
|
|
assertThat(dp.workspacePadding.bottom).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun iconScale() {
|
|
assertThat(dp.iconScale).isEqualTo(1)
|
|
}
|
|
|
|
@Test
|
|
fun cellScaleToFit() {
|
|
assertThat(dp.cellScaleToFit).isEqualTo(1.0f)
|
|
}
|
|
|
|
@Test
|
|
fun workspaceTopPadding() {
|
|
assertThat(dp.workspaceTopPadding).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun workspaceBottomPadding() {
|
|
assertThat(dp.workspaceBottomPadding).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun overviewTaskMarginPx() {
|
|
assertThat(dp.overviewTaskMarginPx).isEqualTo(56)
|
|
}
|
|
|
|
@Test
|
|
fun overviewTaskIconSizePx() {
|
|
assertThat(dp.overviewTaskIconSizePx).isEqualTo(168)
|
|
}
|
|
|
|
@Test
|
|
fun overviewTaskIconDrawableSizePx() {
|
|
assertThat(dp.overviewTaskIconDrawableSizePx).isEqualTo(154)
|
|
}
|
|
|
|
@Test
|
|
fun overviewTaskIconDrawableSizeGridPx() {
|
|
assertThat(dp.overviewTaskIconDrawableSizeGridPx).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun overviewTaskThumbnailTopMarginPx() {
|
|
assertThat(dp.overviewTaskThumbnailTopMarginPx).isEqualTo(224)
|
|
}
|
|
|
|
@Test
|
|
fun overviewActionsTopMarginPx() {
|
|
assertThat(dp.overviewActionsTopMarginPx).isEqualTo(42)
|
|
}
|
|
|
|
@Test
|
|
fun overviewActionsHeight() {
|
|
assertThat(dp.overviewActionsHeight).isEqualTo(168)
|
|
}
|
|
|
|
@Test
|
|
fun overviewActionsButtonSpacing() {
|
|
assertThat(dp.overviewActionsButtonSpacing).isEqualTo(126)
|
|
}
|
|
|
|
@Test
|
|
fun overviewPageSpacing() {
|
|
assertThat(dp.overviewPageSpacing).isEqualTo(56)
|
|
}
|
|
|
|
@Test
|
|
fun overviewRowSpacing() {
|
|
assertThat(dp.overviewRowSpacing).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun overviewGridSideMargin() {
|
|
assertThat(dp.overviewGridSideMargin).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun dropTargetBarTopMarginPx() {
|
|
assertThat(dp.dropTargetBarTopMarginPx).isEqualTo(21)
|
|
}
|
|
|
|
@Test
|
|
fun dropTargetBarSizePx() {
|
|
assertThat(dp.dropTargetBarSizePx).isEqualTo(126)
|
|
}
|
|
|
|
@Test
|
|
fun dropTargetBarBottomMarginPx() {
|
|
assertThat(dp.dropTargetBarBottomMarginPx).isEqualTo(21)
|
|
}
|
|
|
|
@Test
|
|
fun workspaceSpringLoadedMinNextPageVisiblePx() {
|
|
assertThat(dp.workspaceSpringLoadedMinNextPageVisiblePx).isEqualTo(84)
|
|
}
|
|
|
|
@Test
|
|
fun getWorkspaceSpringLoadScale() {
|
|
assertThat(dp.workspaceSpringLoadScale).isEqualTo(0.8880597f)
|
|
}
|
|
|
|
@Test
|
|
fun getCellLayoutHeight() {
|
|
assertThat(dp.cellLayoutHeight).isEqualTo(1340)
|
|
}
|
|
|
|
@Test
|
|
fun getCellLayoutWidth() {
|
|
assertThat(dp.cellLayoutWidth).isEqualTo(2840)
|
|
}
|
|
|
|
@Test
|
|
fun getPanelCount() {
|
|
assertThat(dp.panelCount).isEqualTo(1)
|
|
}
|
|
|
|
@Test
|
|
fun isVerticalBarLayout() {
|
|
assertThat(dp.isVerticalBarLayout).isEqualTo(true)
|
|
}
|
|
|
|
@Test
|
|
fun getCellLayoutSpringLoadShrunkTop() {
|
|
assertThat(dp.cellLayoutSpringLoadShrunkTop).isEqualTo(168)
|
|
}
|
|
|
|
@Test
|
|
fun getCellLayoutSpringLoadShrunkBottom() {
|
|
assertThat(dp.cellLayoutSpringLoadShrunkBottom).isEqualTo(1358)
|
|
}
|
|
|
|
@Test
|
|
fun getQsbOffsetY() {
|
|
assertThat(dp.qsbOffsetY).isEqualTo(147)
|
|
}
|
|
|
|
@Test
|
|
fun getTaskbarOffsetY() {
|
|
assertThat(dp.taskbarOffsetY).isEqualTo(225)
|
|
}
|
|
|
|
@Test
|
|
fun getHotseatLayoutPaddingLeft() {
|
|
assertThat(dp.getHotseatLayoutPadding(context).left).isEqualTo(56)
|
|
}
|
|
|
|
@Test
|
|
fun getHotseatLayoutPaddingTop() {
|
|
assertThat(dp.getHotseatLayoutPadding(context).top).isEqualTo(0)
|
|
}
|
|
|
|
@Test
|
|
fun getHotseatLayoutPaddingRight() {
|
|
assertThat(dp.getHotseatLayoutPadding(context).right).isEqualTo(84)
|
|
}
|
|
|
|
@Test
|
|
fun getHotseatLayoutPaddingBottom() {
|
|
assertThat(dp.getHotseatLayoutPadding(context).bottom).isEqualTo(165)
|
|
}
|
|
|
|
@Test
|
|
fun hotseatBarEndOffset() {
|
|
assertThat(dp.hotseatBarEndOffset).isEqualTo(0)
|
|
}
|
|
} |