Skip to content

Commit 52edb02

Browse files
committed
Try generating landscape screenshots again
1 parent 676eca3 commit 52edb02

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/uitests/src/test/kotlin/base/ScreenshotTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import app.cash.paparazzi.Paparazzi
2323
import app.cash.paparazzi.RenderExtension
2424
import app.cash.paparazzi.TestName
2525
import com.android.resources.NightMode
26+
import com.android.resources.ScreenOrientation
2627
import io.element.android.compound.theme.ElementTheme
2728
import sergio.sastre.composable.preview.scanner.android.AndroidPreviewInfo
2829
import sergio.sastre.composable.preview.scanner.core.preview.ComposablePreview
@@ -122,6 +123,7 @@ object PaparazziPreviewRule {
122123
): Paparazzi {
123124
val densityScale = deviceConfig.density.dpiValue / 160f
124125
val customScreenHeight = preview.previewInfo.heightDp.takeIf { it >= 0 }?.let { it * densityScale }?.toInt()
126+
val isLandscape = preview.previewInfo.device.contains("landscape")
125127
return Paparazzi(
126128
deviceConfig = deviceConfig.copy(
127129
nightMode = when (preview.previewInfo.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES) {
@@ -131,6 +133,7 @@ object PaparazziPreviewRule {
131133
locale = locale,
132134
softButtons = false,
133135
screenHeight = customScreenHeight ?: deviceConfig.screenHeight,
136+
orientation = if (isLandscape) ScreenOrientation.LANDSCAPE else ScreenOrientation.PORTRAIT,
134137
),
135138
maxPercentDifference = 0.01,
136139
renderExtensions = renderExtensions,

0 commit comments

Comments
 (0)