Skip to content

Commit

Permalink
Merge branch 'main' into feat/test_rating
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonPolle authored Aug 3, 2023
2 parents 748704b + ffaf6cb commit 9681dd8
Show file tree
Hide file tree
Showing 163 changed files with 1,442 additions and 11 deletions.
1 change: 1 addition & 0 deletions appbars/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id("com.android.library")
id("kotlin-android")
id("VitaminComposeLibraryPlugin")
id("VitaminQualityPlugin")
id("com.vanniktech.maven.publish")
}

Expand Down
4 changes: 4 additions & 0 deletions badges/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ plugins {
id("com.android.library")
id("kotlin-android")
id("VitaminComposeLibraryPlugin")
id("VitaminQualityPlugin")
id("com.vanniktech.maven.publish")
id("app.cash.paparazzi")
}

dependencies {
api(project(":foundation:foundation"))
implementation(AndroidX.compose.ui.tooling)
testImplementation("com.google.testparameterinjector:test-parameter-injector:1.8")
testImplementation(project(":foundation:foundation-icons"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.decathlon.vitamin.badges

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.cash.paparazzi.Paparazzi
import com.decathlon.vitamin.badges.utils.BadgesVariantsFactory
import com.decathlon.vitamin.badges.utils.Theme
import com.decathlon.vitamin.badges.utils.Variant
import com.decathlon.vitamin.compose.foundation.VitaminTheme
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith


@RunWith(TestParameterInjector::class)
class VitaminBadgesPrimaryTest(
@TestParameter val variant: Variant
) {

@get:Rule
val paparazzi = Paparazzi()

@Test
fun medium(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = variant.name, style = VitaminTheme.typography.subtitle1)
BadgesVariantsFactory.Badges(
variant = variant
)
}
}
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package com.decathlon.vitamin.badges

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.cash.paparazzi.Paparazzi
import com.decathlon.vitamin.badges.utils.BadgesVariantsFactory
import com.decathlon.vitamin.badges.utils.Theme
import com.decathlon.vitamin.badges.utils.Variant
import com.decathlon.vitamin.compose.badges.VitaminBadgeSizes
import com.decathlon.vitamin.compose.foundation.VitaminTheme
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith


@RunWith(TestParameterInjector::class)
class VitaminCountBadgesPrimaryTest(
@TestParameter val variant: Variant
) {

@get:Rule
val paparazzi = Paparazzi()

@Test
fun small(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = variant.name, style = VitaminTheme.typography.subtitle1)
Row (horizontalArrangement = Arrangement.spacedBy(16.dp)) {
BadgesVariantsFactory.CountBadges(
count = 120,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
BadgesVariantsFactory.CountBadges(
count = 50,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
BadgesVariantsFactory.CountBadges(
count = 1,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
BadgesVariantsFactory.CountBadges(
count = 0,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
}
}
}
}
}
}


@Test
fun medium(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = variant.name, style = VitaminTheme.typography.subtitle1)
Row (horizontalArrangement = Arrangement.spacedBy(16.dp)) {
BadgesVariantsFactory.CountBadges(
count = 120,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
BadgesVariantsFactory.CountBadges(
count = 50,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
BadgesVariantsFactory.CountBadges(
count = 1,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
BadgesVariantsFactory.CountBadges(
count = 0,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
}
}
}
}
}
}

@Test
fun large(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = variant.name, style = VitaminTheme.typography.subtitle1)
Row (horizontalArrangement = Arrangement.spacedBy(16.dp)) {
BadgesVariantsFactory.CountBadges(
count = 120,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
BadgesVariantsFactory.CountBadges(
count = 50,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
BadgesVariantsFactory.CountBadges(
count = 1,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
BadgesVariantsFactory.CountBadges(
count = 0,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
}
}
}
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package com.decathlon.vitamin.badges

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.cash.paparazzi.Paparazzi
import com.decathlon.vitamin.badges.utils.BadgesVariantsFactory
import com.decathlon.vitamin.badges.utils.Theme
import com.decathlon.vitamin.badges.utils.Variant
import com.decathlon.vitamin.compose.badges.VitaminBadgeSizes
import com.decathlon.vitamin.compose.foundation.VitaminTheme
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith


@RunWith(TestParameterInjector::class)
class VitaminStandaloneBadgesPrimaryTest(
@TestParameter val variant: Variant
) {

@get:Rule
val paparazzi = Paparazzi()

@Test
fun small(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = variant.name, style = VitaminTheme.typography.subtitle1)
Row (horizontalArrangement = Arrangement.spacedBy(16.dp)) {
BadgesVariantsFactory.StandaloneBadges(
count = 120,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
BadgesVariantsFactory.StandaloneBadges(
count = 50,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
BadgesVariantsFactory.StandaloneBadges(
count = 1,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
BadgesVariantsFactory.StandaloneBadges(
count = 0,
variant = variant,
sizes = VitaminBadgeSizes.small()
)
}
}
}
}
}
}


@Test
fun medium(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = variant.name, style = VitaminTheme.typography.subtitle1)
Row (horizontalArrangement = Arrangement.spacedBy(16.dp)) {
BadgesVariantsFactory.StandaloneBadges(
count = 120,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
BadgesVariantsFactory.StandaloneBadges(
count = 50,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
BadgesVariantsFactory.StandaloneBadges(
count = 1,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
BadgesVariantsFactory.StandaloneBadges(
count = 0,
variant = variant,
sizes = VitaminBadgeSizes.medium()
)
}
}
}
}
}
}

@Test
fun large(@TestParameter theme: Theme) {
paparazzi.snapshot {
VitaminTheme(theme == Theme.Dark) {
Scaffold { padding ->
Column(
modifier = Modifier.padding(padding),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(text = variant.name, style = VitaminTheme.typography.subtitle1)
Row (horizontalArrangement = Arrangement.spacedBy(16.dp)) {
BadgesVariantsFactory.StandaloneBadges(
count = 120,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
BadgesVariantsFactory.StandaloneBadges(
count = 50,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
BadgesVariantsFactory.StandaloneBadges(
count = 1,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
BadgesVariantsFactory.StandaloneBadges(
count = 0,
variant = variant,
sizes = VitaminBadgeSizes.large()
)
}
}
}
}
}
}
}

Loading

0 comments on commit 9681dd8

Please sign in to comment.