From 7054585f618299b8ff2af8a1063d7d2b39b4d1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADn?= Date: Tue, 14 Nov 2023 12:24:20 +0100 Subject: [PATCH] minor comments --- .../test/java/com/telefonica/mistica/button/ButtonTest.kt | 3 +-- .../com/telefonica/mistica/compose/button/ButtonKtTest.kt | 4 ++-- .../com/telefonica/mistica/testutils/ScreenshotUtils.kt | 2 +- .../test/java/com/telefonica/mistica/testutils/TestUtils.kt | 6 ------ 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/library/src/test/java/com/telefonica/mistica/button/ButtonTest.kt b/library/src/test/java/com/telefonica/mistica/button/ButtonTest.kt index a3910e497..263bf0343 100644 --- a/library/src/test/java/com/telefonica/mistica/button/ButtonTest.kt +++ b/library/src/test/java/com/telefonica/mistica/button/ButtonTest.kt @@ -15,7 +15,6 @@ import com.telefonica.mistica.compose.theme.brand.MovistarBrand import com.telefonica.mistica.compose.theme.brand.VivoBrand import com.telefonica.mistica.testutils.ScreenshotsTest import com.telefonica.mistica.testutils.TestUtils.getAllBrands -import com.telefonica.mistica.testutils.TestUtils.getAllButtonStyles import com.telefonica.mistica.testutils.TestUtils.isInverse import com.telefonica.mistica.util.getThemeColor import org.junit.Rule @@ -83,7 +82,7 @@ internal class ButtonTest( @ParameterizedRobolectricTestRunner.Parameters(name = "ButtonXML {1} {0} icon={2}") fun brands(): List> { val allBrands = getAllBrands() - val buttonStyles = getAllButtonStyles() + val buttonStyles = ButtonStyle.values().toList() val icons = listOf(false, true) return allBrands.flatMap { brand -> buttonStyles.flatMap { buttonStyle -> diff --git a/library/src/test/java/com/telefonica/mistica/compose/button/ButtonKtTest.kt b/library/src/test/java/com/telefonica/mistica/compose/button/ButtonKtTest.kt index 9cfcf02a0..2f9071cd4 100644 --- a/library/src/test/java/com/telefonica/mistica/compose/button/ButtonKtTest.kt +++ b/library/src/test/java/com/telefonica/mistica/compose/button/ButtonKtTest.kt @@ -54,7 +54,7 @@ internal class ButtonKtTest(private val brand: Brand, private val style: ButtonS } private fun `then screenshot is OK`(brand: Brand, style: ButtonStyle, icon: Boolean, darkTheme: Boolean) { - val iconSuffix = if(icon) { + val iconSuffix = if (icon) { "icon" } else { null @@ -67,7 +67,7 @@ internal class ButtonKtTest(private val brand: Brand, private val style: ButtonS @ParameterizedRobolectricTestRunner.Parameters(name = "Button {1} {0} icon={2} darkTheme={3}") fun brands(): List> { val allBrands = TestUtils.getAllBrands() - val buttonStyles = TestUtils.getAllButtonStyles() + val buttonStyles = ButtonStyle.values().toList() val icons = listOf(false, true) val darkTheme = listOf(false, true) return allBrands.flatMap { brand -> diff --git a/library/src/test/java/com/telefonica/mistica/testutils/ScreenshotUtils.kt b/library/src/test/java/com/telefonica/mistica/testutils/ScreenshotUtils.kt index 84c6f7efe..194906093 100644 --- a/library/src/test/java/com/telefonica/mistica/testutils/ScreenshotUtils.kt +++ b/library/src/test/java/com/telefonica/mistica/testutils/ScreenshotUtils.kt @@ -22,7 +22,7 @@ object ScreenshotUtils { "dark".takeIf { darkTheme } ).joinToString(separator = "_") - return """screenshots/$nonNullParams""".plus(".png").replace("\\s+".toRegex(), "") + return "screenshots/$nonNullParams.png".replace("\\s+".toRegex(), "") } } diff --git a/library/src/test/java/com/telefonica/mistica/testutils/TestUtils.kt b/library/src/test/java/com/telefonica/mistica/testutils/TestUtils.kt index cde961bac..fadbf6e8b 100644 --- a/library/src/test/java/com/telefonica/mistica/testutils/TestUtils.kt +++ b/library/src/test/java/com/telefonica/mistica/testutils/TestUtils.kt @@ -35,12 +35,6 @@ object TestUtils { TelefonicaBrand, ) - fun getAllButtonStyles() = listOf( - ButtonStyle.PRIMARY, ButtonStyle.PRIMARY_SMALL, ButtonStyle.SECONDARY, ButtonStyle.SECONDARY_SMALL, ButtonStyle.DANGER, - ButtonStyle.DANGER_SMALL, ButtonStyle.LINK, ButtonStyle.PRIMARY_INVERSE, ButtonStyle.PRIMARY_SMALL_INVERSE, ButtonStyle.SECONDARY_INVERSE, - ButtonStyle.SECONDARY_SMALL_INVERSE, ButtonStyle.LINK_INVERSE - ) - fun ButtonStyle.isInverse() = when(this) { ButtonStyle.PRIMARY_INVERSE, ButtonStyle.PRIMARY_SMALL_INVERSE,