mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-19 14:10:38 -04:00
Add screenshot test for Settings screen
This commit is contained in:
@@ -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),
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:71f406a178f4a466d27c9a1483046a249688370daeb95b15878729934ccee8af
|
||||
size 235934
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8ab1c8e0bdc1c1a148a287020d299b08d060dc8315068d3f9ca5fd412f21227e
|
||||
size 235866
|
||||
Reference in New Issue
Block a user