Skip to content

Commit

Permalink
fix: Fix issue #3244 (#3246)
Browse files Browse the repository at this point in the history
* fix: Fix issue #3244

* feat: new Preview

* feat: Test update

* fix: changing maxPercentDifference on PaparazziScreenshotTest.kt

* test:recorded new Screenshot

* refactor: deleting paparazzi test transaction

* refactor: rewrite of test image

* fix: Fix Bugs due to local settings

* fix: add screenshots changed

---------

Co-authored-by: GIUSEPPE BARONE s332157 <s332157@studenti.polito.it>
  • Loading branch information
giuseppe2028 and GIUSEPPE BARONE s332157 committed Jun 23, 2024
1 parent 8f0360f commit d0225de
Show file tree
Hide file tree
Showing 30 changed files with 57 additions and 5 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@ import androidx.compose.runtime.Composable
import app.cash.paparazzi.DeviceConfig
import app.cash.paparazzi.Paparazzi
import com.ivy.design.system.IvyMaterial3Theme
import org.junit.Before
import org.junit.Rule
import java.util.Locale

open class PaparazziScreenshotTest {

@Before
fun setup() {
Locale.setDefault(Locale.US)
}

@get:Rule
val paparazzi = Paparazzi(
deviceConfig = DeviceConfig.PIXEL_6_PRO,
showSystemUi = true,
maxPercentDifference = 0.001
maxPercentDifference = 0.005
)

protected fun snapshot(theme: PaparazziTheme, content: @Composable () -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ package com.ivy.legacy.ui.component.transaction
import androidx.annotation.DrawableRes
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
Expand Down Expand Up @@ -283,6 +286,7 @@ private fun ColumnScope.TransactionTags(tags: ImmutableList<LegacyTag>) {
}
}

@OptIn(ExperimentalLayoutApi::class)
@Composable
private fun TransactionHeaderRow(
transaction: Transaction,
Expand Down Expand Up @@ -310,13 +314,13 @@ private fun TransactionHeaderRow(
)
}
} else {
Row(
FlowRow(
horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier.padding(horizontal = 20.dp),
verticalAlignment = Alignment.CenterVertically
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
if (category != null) {
CategoryBadgeDisplay(category, nav)
Spacer(Modifier.width(12.dp))
}

val account = account(
Expand Down Expand Up @@ -397,7 +401,7 @@ private fun TransactionBadge(
.background(backgroundColor, UI.shapes.rFull)
.clickable {
onClick()
},
}.padding(end = 10.dp),
verticalAlignment = Alignment.CenterVertically
) {
SpacerHor(width = 8.dp)
Expand Down Expand Up @@ -619,6 +623,46 @@ private fun PreviewUpcomingExpense() {
}
}

@Preview
@Composable
private fun PreviewUpcomingExpenseBadgeSecondRow() {
IvyWalletPreview {
LazyColumn(Modifier.fillMaxSize()) {
val cash = Account(name = "Cash", Green.toArgb())
val food = Category(
name = NotBlankTrimmedString.unsafe("Food-Travel-Entertaiment-Food"),
color = ColorInt(Blue.toArgb()),
icon = null,
id = CategoryId(UUID.randomUUID()),
lastUpdated = Instant.EPOCH,
orderNum = 0.0,
removed = false,
)

item {
TransactionCard(
baseData = AppBaseData(
baseCurrency = "BGN",
categories = persistentListOf(food),
accounts = persistentListOf(cash)
),
transaction = Transaction(
accountId = cash.id,
title = "Lidl pazar",
categoryId = food.id.value,
amount = 250.75.toBigDecimal(),
dueDate = timeNowUTC().plusDays(5),
dateTime = null,
type = TransactionType.EXPENSE,
),
onPayOrGet = {},
) {
}
}
}
}
}

@Preview
@Composable
private fun PreviewOverdueExpense() {
Expand Down

0 comments on commit d0225de

Please sign in to comment.