Skip to content

Commit

Permalink
ANDROID-14391 Fix roborazzi mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeprubio committed Apr 4, 2024
1 parent e410dfd commit a06fe41
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 114 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
accompanist_version = "0.32.0"
coil_version = '2.5.0'
constraintComposeVersion = '1.0.1'
roborazzi_version = "1.10.1"
roborazzi_version = "1.11.0"
}
repositories {
google()
Expand All @@ -29,7 +29,7 @@ buildscript {
plugins {
id 'org.jetbrains.kotlin.android' version '1.5.21' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' apply false
id "io.github.takahirom.roborazzi" version '1.10.1' apply false
id "io.github.takahirom.roborazzi" version '1.11.0' apply false
}

allprojects {
Expand Down
20 changes: 13 additions & 7 deletions library/src/test/java/com/telefonica/mistica/button/ButtonTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import com.telefonica.mistica.DummyActivity
import com.telefonica.mistica.DummyActivity.Companion.EXTRA_THEME
import com.telefonica.mistica.R
import com.telefonica.mistica.compose.button.ButtonStyle
import com.telefonica.mistica.compose.theme.brand.BlauBrand
import com.telefonica.mistica.compose.theme.brand.Brand
import com.telefonica.mistica.compose.theme.brand.MovistarBrand
import com.telefonica.mistica.compose.theme.brand.O2Brand
import com.telefonica.mistica.compose.theme.brand.TelefonicaBrand
import com.telefonica.mistica.compose.theme.brand.TuBrand
import com.telefonica.mistica.compose.theme.brand.VivoBrand
import com.telefonica.mistica.compose.theme.brand.VivoNewBrand
import com.telefonica.mistica.testutils.ScreenshotsTest
import com.telefonica.mistica.testutils.TestUtils.getAllBrands
import com.telefonica.mistica.testutils.TestUtils.isInverse
Expand Down Expand Up @@ -83,7 +87,7 @@ internal class ButtonTest(
@ParameterizedRobolectricTestRunner.Parameters(name = "ButtonXML {1} {0} icon={2}")
fun brands(): List<Array<Any>> {
val allBrands = getAllBrands()
val buttonStyles = ButtonStyle.values().toList()
val buttonStyles = ButtonStyle.entries
val icons = listOf(false, true)
return allBrands.flatMap { brand ->
buttonStyles.flatMap { buttonStyle ->
Expand All @@ -97,12 +101,14 @@ internal class ButtonTest(
}

fun Brand.getBaseThemeForBrand(): Int = when (this) {
MovistarBrand -> R.style.MisticaTheme_Movistar_test
VivoBrand -> R.style.MisticaTheme_Vivo_test
VivoBrand -> R.style.MisticaTheme_O2_test
VivoBrand -> R.style.MisticaTheme_Blau_test
TuBrand -> R.style.MisticaTheme_Tu_test
else -> R.style.MisticaTheme_Telefonica_test
MovistarBrand -> R.style.MisticaTheme_Movistar
VivoBrand -> R.style.MisticaTheme_Vivo
VivoNewBrand -> R.style.MisticaTheme_VivoNew
O2Brand -> R.style.MisticaTheme_O2
TelefonicaBrand -> R.style.MisticaTheme_Telefonica
TuBrand -> R.style.MisticaTheme_Tu
BlauBrand -> R.style.MisticaTheme_Blau
else -> { throw IllegalArgumentException("Unexpected brand $this") }
}

fun ButtonStyle.getButtonStyleRef() = when (this) {
Expand Down
105 changes: 0 additions & 105 deletions library/src/test/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,109 +14,4 @@
<attr name="secondaryButtonInverse_Small_test" format="reference"/>
<attr name="linkButtonInverse_test" format="reference"/>

<style name="MisticaTheme.Blau.test" parent="MisticaTheme.Blau">
<item name="defaultButtonTest_test">@style/AppTheme.Button.DefaultButton</item>
<item name="defaultButton_Small_test">@style/AppTheme.Button.DefaultButton.Small</item>
<item name="secondaryButton_test">@style/AppTheme.Button.SecondaryButton</item>
<item name="secondaryButton_Small_test">@style/AppTheme.Button.SecondaryButton.Small</item>
<item name="dangerButton_test">@style/AppTheme.Button.DangerButton</item>
<item name="dangerButton_Small_test">@style/AppTheme.Button.DangerButton.Small</item>
<item name="linkButton_test">@style/AppTheme.Button.LinkButton</item>
<item name="primaryButtonInverse_test">@style/AppTheme.Button.PrimaryButtonInverse</item>
<item name="primaryButtonInverse_Small_test">@style/AppTheme.Button.PrimaryButtonInverse.Small</item>
<item name="secondaryButtonInverse_test">@style/AppTheme.Button.SecondaryButtonInverse</item>
<item name="secondaryButtonInverse_Small_test">@style/AppTheme.Button.SecondaryButtonInverse.Small</item>
<item name="linkButtonInverse_test">@style/AppTheme.Button.LinkButtonInverse</item>
</style>

<style name="MisticaTheme.Movistar.test" parent="MisticaTheme.Movistar">
<item name="defaultButtonTest_test">@style/AppTheme.Button.DefaultButton</item>
<item name="defaultButton_Small_test">@style/AppTheme.Button.DefaultButton.Small</item>
<item name="secondaryButton_test">@style/AppTheme.Button.SecondaryButton</item>
<item name="secondaryButton_Small_test">@style/AppTheme.Button.SecondaryButton.Small</item>
<item name="dangerButton_test">@style/AppTheme.Button.DangerButton</item>
<item name="dangerButton_Small_test">@style/AppTheme.Button.DangerButton.Small</item>
<item name="linkButton_test">@style/AppTheme.Button.LinkButton</item>
<item name="primaryButtonInverse_test">@style/AppTheme.Button.PrimaryButtonInverse</item>
<item name="primaryButtonInverse_Small_test">@style/AppTheme.Button.PrimaryButtonInverse.Small</item>
<item name="secondaryButtonInverse_test">@style/AppTheme.Button.SecondaryButtonInverse</item>
<item name="secondaryButtonInverse_Small_test">@style/AppTheme.Button.SecondaryButtonInverse.Small</item>
<item name="linkButtonInverse_test">@style/AppTheme.Button.LinkButtonInverse</item>
</style>

<style name="MisticaTheme.O2.test" parent="MisticaTheme.O2">
<item name="defaultButtonTest_test">@style/AppTheme.Button.DefaultButton</item>
<item name="defaultButton_Small_test">@style/AppTheme.Button.DefaultButton.Small</item>
<item name="secondaryButton_test">@style/AppTheme.Button.SecondaryButton</item>
<item name="secondaryButton_Small_test">@style/AppTheme.Button.SecondaryButton.Small</item>
<item name="dangerButton_test">@style/AppTheme.Button.DangerButton</item>
<item name="dangerButton_Small_test">@style/AppTheme.Button.DangerButton.Small</item>
<item name="linkButton_test">@style/AppTheme.Button.LinkButton</item>
<item name="primaryButtonInverse_test">@style/AppTheme.Button.PrimaryButtonInverse</item>
<item name="primaryButtonInverse_Small_test">@style/AppTheme.Button.PrimaryButtonInverse.Small</item>
<item name="secondaryButtonInverse_test">@style/AppTheme.Button.SecondaryButtonInverse</item>
<item name="secondaryButtonInverse_Small_test">@style/AppTheme.Button.SecondaryButtonInverse.Small</item>
<item name="linkButtonInverse_test">@style/AppTheme.Button.LinkButtonInverse</item>
</style>

<style name="MisticaTheme.Telefonica.test" parent="MisticaTheme.Telefonica">
<item name="defaultButtonTest_test">@style/AppTheme.Button.DefaultButton</item>
<item name="defaultButton_Small_test">@style/AppTheme.Button.DefaultButton.Small</item>
<item name="secondaryButton_test">@style/AppTheme.Button.SecondaryButton</item>
<item name="secondaryButton_Small_test">@style/AppTheme.Button.SecondaryButton.Small</item>
<item name="dangerButton_test">@style/AppTheme.Button.DangerButton</item>
<item name="dangerButton_Small_test">@style/AppTheme.Button.DangerButton.Small</item>
<item name="linkButton_test">@style/AppTheme.Button.LinkButton</item>
<item name="primaryButtonInverse_test">@style/AppTheme.Button.PrimaryButtonInverse</item>
<item name="primaryButtonInverse_Small_test">@style/AppTheme.Button.PrimaryButtonInverse.Small</item>
<item name="secondaryButtonInverse_test">@style/AppTheme.Button.SecondaryButtonInverse</item>
<item name="secondaryButtonInverse_Small_test">@style/AppTheme.Button.SecondaryButtonInverse.Small</item>
<item name="linkButtonInverse_test">@style/AppTheme.Button.LinkButtonInverse</item>
</style>

<style name="MisticaTheme.Vivo.test" parent="MisticaTheme.Vivo">
<item name="defaultButtonTest_test">@style/AppTheme.Button.DefaultButton</item>
<item name="defaultButton_Small_test">@style/AppTheme.Button.DefaultButton.Small</item>
<item name="secondaryButton_test">@style/AppTheme.Button.SecondaryButton</item>
<item name="secondaryButton_Small_test">@style/AppTheme.Button.SecondaryButton.Small</item>
<item name="dangerButton_test">@style/AppTheme.Button.DangerButton</item>
<item name="dangerButton_Small_test">@style/AppTheme.Button.DangerButton.Small</item>
<item name="linkButton_test">@style/AppTheme.Button.LinkButton</item>
<item name="primaryButtonInverse_test">@style/AppTheme.Button.PrimaryButtonInverse</item>
<item name="primaryButtonInverse_Small_test">@style/AppTheme.Button.PrimaryButtonInverse.Small</item>
<item name="secondaryButtonInverse_test">@style/AppTheme.Button.SecondaryButtonInverse</item>
<item name="secondaryButtonInverse_Small_test">@style/AppTheme.Button.SecondaryButtonInverse.Small</item>
<item name="linkButtonInverse_test">@style/AppTheme.Button.LinkButtonInverse</item>
</style>

<style name="MisticaTheme.VivoNew.test" parent="MisticaTheme.VivoNew">
<item name="defaultButtonTest_test">@style/AppTheme.Button.DefaultButton</item>
<item name="defaultButton_Small_test">@style/AppTheme.Button.DefaultButton.Small</item>
<item name="secondaryButton_test">@style/AppTheme.Button.SecondaryButton</item>
<item name="secondaryButton_Small_test">@style/AppTheme.Button.SecondaryButton.Small</item>
<item name="dangerButton_test">@style/AppTheme.Button.DangerButton</item>
<item name="dangerButton_Small_test">@style/AppTheme.Button.DangerButton.Small</item>
<item name="linkButton_test">@style/AppTheme.Button.LinkButton</item>
<item name="primaryButtonInverse_test">@style/AppTheme.Button.PrimaryButtonInverse</item>
<item name="primaryButtonInverse_Small_test">@style/AppTheme.Button.PrimaryButtonInverse.Small</item>
<item name="secondaryButtonInverse_test">@style/AppTheme.Button.SecondaryButtonInverse</item>
<item name="secondaryButtonInverse_Small_test">@style/AppTheme.Button.SecondaryButtonInverse.Small</item>
<item name="linkButtonInverse_test">@style/AppTheme.Button.LinkButtonInverse</item>
</style>

<style name="MisticaTheme.Tu.test" parent="MisticaTheme.Tu">
<item name="defaultButtonTest_test">@style/AppTheme.Button.DefaultButton</item>
<item name="defaultButton_Small_test">@style/AppTheme.Button.DefaultButton.Small</item>
<item name="secondaryButton_test">@style/AppTheme.Button.SecondaryButton</item>
<item name="secondaryButton_Small_test">@style/AppTheme.Button.SecondaryButton.Small</item>
<item name="dangerButton_test">@style/AppTheme.Button.DangerButton</item>
<item name="dangerButton_Small_test">@style/AppTheme.Button.DangerButton.Small</item>
<item name="linkButton_test">@style/AppTheme.Button.LinkButton</item>
<item name="primaryButtonInverse_test">@style/AppTheme.Button.PrimaryButtonInverse</item>
<item name="primaryButtonInverse_Small_test">@style/AppTheme.Button.PrimaryButtonInverse.Small</item>
<item name="secondaryButtonInverse_test">@style/AppTheme.Button.SecondaryButtonInverse</item>
<item name="secondaryButtonInverse_Small_test">@style/AppTheme.Button.SecondaryButtonInverse.Small</item>
<item name="linkButtonInverse_test">@style/AppTheme.Button.LinkButtonInverse</item>
</style>

</resources>

0 comments on commit a06fe41

Please sign in to comment.