Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ val accountCardScreenshotConfig = object: ComposableTestCase {
}
}

val searchScreenshotConfig = object: ComposableTestCase {
override val id = "Compose-SearchBar"

val boxTestCase = object: ComposableTestCase {
override val id = "Composable-BoxWithBorders"
override val width = ViewGroup.LayoutParams.WRAP_CONTENT
override val height = ViewGroup.LayoutParams.WRAP_CONTENT

@Composable
override fun createUi() {
SearchBar()
BoxWithBorders()
}
}

val composableTestCases = listOf(accountCardScreenshotConfig, searchScreenshotConfig)
val composableTestCases = listOf(accountCardScreenshotConfig, boxTestCase)
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun AccountCard(name: String, position: String) {
color = Color(0xFFE8F8F8),
shape = RoundedCornerShape(8.dp)
)
.padding(8.dp),
.padding(4.dp),
verticalAlignment = Alignment.CenterVertically
) {
Image(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.github.murzagalin.snapshot_testing.composable

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp


@Composable
fun BoxWithBorders(modifier: Modifier = Modifier) {
Box(
modifier = modifier
.border(2.dp, Color.Red)
.padding(8.dp)
.border(2.dp, Color.Blue)
.background(Color.White)
.padding(8.dp)
.size(48.dp)
)
}

@Preview
@Composable
fun PreviewBoxWithBorders() {
BoxWithBorders()
}
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/search_background.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#EFEFEF"/>
<solid android:color="#FFFFFF"/>
<corners android:radius="8dp"/>
</shape>