Add screenshot test for Settings screen

This commit is contained in:
Torsten Grote
2026-03-31 17:58:51 -03:00
parent 73234bdd92
commit dca94898c5
3 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package org.fdroid.ui.settings
import android.content.res.Configuration
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.android.tools.screenshot.PreviewTest
import java.lang.System.currentTimeMillis
import java.util.concurrent.TimeUnit.HOURS
import kotlinx.coroutines.flow.MutableStateFlow
import me.zhanghai.compose.preference.MapPreferences
import org.fdroid.ui.ScreenshotTest
@Composable
@PreviewTest
@Preview(showBackground = true, showSystemUi = true, heightDp = 1400)
fun SettingsTest() =
ScreenshotTest(showBottomBar = false) {
Settings(model = getSettingsModel(), isBigScreen = false, onSaveLogcat = {}, onBackClicked = {})
}
@Composable
@PreviewTest
@Preview(
showBackground = true,
showSystemUi = true,
uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL,
heightDp = 1400,
)
fun SettingsNightTest() =
ScreenshotTest(showBottomBar = false) {
Settings(model = getSettingsModel(), isBigScreen = false, onSaveLogcat = {}, onBackClicked = {})
}
private fun getSettingsModel(
nextRepoUpdate: Long = currentTimeMillis() - HOURS.toMillis(12),
nextAppUpdate: Long = Long.MAX_VALUE,
) =
SettingsModel(
prefsFlow = MutableStateFlow(MapPreferences(emptyMap())),
nextRepoUpdateFlow = MutableStateFlow(nextRepoUpdate),
nextAppUpdateFlow = MutableStateFlow(nextAppUpdate),
)

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:71f406a178f4a466d27c9a1483046a249688370daeb95b15878729934ccee8af
size 235934

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ab1c8e0bdc1c1a148a287020d299b08d060dc8315068d3f9ca5fd412f21227e
size 235866