mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
feat(android): add a screenshot test for NetworkPosts
This commit is contained in:
parent
cc5b95e9c8
commit
784dcf16f8
4 changed files with 47 additions and 0 deletions
|
@ -26,6 +26,7 @@ plugins {
|
|||
alias(libs.plugins.kotlin.composeCompiler)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
alias(libs.plugins.navigation.safeargs)
|
||||
alias(libs.plugins.screenshot)
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -40,6 +41,7 @@ android {
|
|||
applicationIdSuffix = ".internal"
|
||||
debuggable(true)
|
||||
}
|
||||
experimentalProperties["android.experimental.enableScreenshotTest"] = true
|
||||
}
|
||||
|
||||
baselineProfile {
|
||||
|
@ -119,6 +121,8 @@ dependencies {
|
|||
|
||||
kapt(libs.dagger.compiler)
|
||||
|
||||
screenshotTestImplementation(libs.androidx.compose.ui.tooling)
|
||||
|
||||
addTestDependencies(project)
|
||||
androidTestImplementation(libs.androidx.test.espresso.core)
|
||||
androidTestImplementation(libs.androidx.test.uiautomator)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:073465fa7a1cbf3c9ed1956451c59c72147c1ec5f7208d3bb648ede8d1411373
|
||||
size 220590
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5911948ab89dfd264561c3ddbf90777477bed7b756375c452b2f2611b036644a
|
||||
size 222316
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright © 2024 Harsh Shandilya.
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
package dev.msfjarvis.claw.android.ui.lists
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.paging.PagingData
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import dev.msfjarvis.claw.common.posts.TEST_POST
|
||||
import dev.msfjarvis.claw.common.posts.TEST_POST_ACTIONS
|
||||
import dev.msfjarvis.claw.common.theme.LobstersTheme
|
||||
import dev.msfjarvis.claw.common.ui.preview.ThemePreviews
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@SuppressLint("ComposePreviewPublic", "ComposeUnstableReceiver")
|
||||
class NetworkPostsTest {
|
||||
@ThemePreviews
|
||||
@Composable
|
||||
fun DefaultPreview() {
|
||||
val items = List(20) { TEST_POST.copy(shortId = "${TEST_POST.shortId}${it}") }
|
||||
val flow = MutableStateFlow(PagingData.from(items))
|
||||
LobstersTheme {
|
||||
NetworkPosts(
|
||||
lazyPagingItems = flow.collectAsLazyPagingItems(),
|
||||
listState = rememberLazyListState(),
|
||||
postActions = TEST_POST_ACTIONS,
|
||||
contentPadding = PaddingValues(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue