diff --git a/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUICheckBoxScreenShotTest.kt b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUICheckBoxScreenShotTest.kt new file mode 100644 index 00000000..c5e0bd15 --- /dev/null +++ b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUICheckBoxScreenShotTest.kt @@ -0,0 +1,32 @@ +package com.tarkalabs.uicomponents.screenshots + +import com.tarkalabs.uicomponents.components.checkbox.TUICheckBox +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +open class TUICheckBoxScreenShotTest( + private val isChecked: Boolean, + private val testName: String, + private val darkTheme: Boolean, +) : ComposeScreenshotComparator() { + + companion object { + @JvmStatic + @Parameterized.Parameters + fun data(): Collection> { + val booleanList = listOf(true, false) + return mutableListOf>().apply { + for (darkTheme in booleanList) + for (isChecked in booleanList) + add(arrayOf(isChecked, "darkTheme_${darkTheme}_checked_{$isChecked}", darkTheme)) + } + } + } + + @Test fun testTUICheckBoxScreenshot() = + compareScreenshotFor(darkTheme, "_testTUICheckBox_$testName") { + TUICheckBox(checked = isChecked, onCheckedChange = {}) + } +} \ No newline at end of file diff --git a/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUIMultiLevelSelectionHeaderScreenshotTest.kt b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUIMultiLevelSelectionHeaderScreenshotTest.kt new file mode 100644 index 00000000..b681551d --- /dev/null +++ b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUIMultiLevelSelectionHeaderScreenshotTest.kt @@ -0,0 +1,44 @@ +package com.tarkalabs.uicomponents.screenshots + +import com.tarkalabs.uicomponents.components.TUIMultiLevelSelectorHeader +import com.tarkalabs.uicomponents.components.TUIStatus +import com.tarkalabs.uicomponents.components.TUIStatusIndicator +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +class TUIMultiLevelSelectionHeaderScreenshotTest( + private val darkTheme: Boolean, + private val isSelected: Boolean, + private val testName: String, +) : ComposeScreenshotComparator() { + + companion object { + @JvmStatic + @Parameterized.Parameters + fun data(): Collection> { + + val booleanValues = listOf(true, false) + + val testData = arrayListOf>() + + for (darkTheme in booleanValues) + for (isSelected in booleanValues) + testData.add( + arrayOf( + darkTheme, isSelected, "darkTheme_${darkTheme}_isSelected_${isSelected}" + ) + ) + + return testData + } + } + + @Test + fun testTUMultiLevelSelectionHeader() { + compareScreenshotFor(darkTheme = darkTheme, imageName = testName) { + TUIMultiLevelSelectorHeader(title = "Title", isSelected = isSelected, onClick = {}) + } + } +} \ No newline at end of file diff --git a/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUINavigationRowScreenShotTest.kt b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUINavigationRowScreenShotTest.kt new file mode 100644 index 00000000..865e1e35 --- /dev/null +++ b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUINavigationRowScreenShotTest.kt @@ -0,0 +1,50 @@ +package com.tarkalabs.uicomponents.screenshots + +import com.tarkalabs.tarkaicons.AddCircle24 +import com.tarkalabs.tarkaicons.TarkaIcon +import com.tarkalabs.tarkaicons.TarkaIcons +import com.tarkalabs.uicomponents.components.TUINavigationRow +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +open class TUINavigationRowScreenShotTest( + private val showArrowRight: Boolean, + private val leadingIcon: TarkaIcon?, + private val testName: String, + private val darkTheme: Boolean, +) : ComposeScreenshotComparator() { + + companion object { + @JvmStatic + @Parameterized.Parameters + fun data(): Collection> { + val booleans = listOf(true, false) + val icons: List = listOf(null, TarkaIcons.Filled.AddCircle24) + return mutableListOf>().apply { + for (darkTheme in booleans) + for (showArrow in booleans) + for (icon in icons) + add( + arrayOf( + showArrow, + icon, + "darkTheme_${darkTheme}_showArrow_{$showArrow}_${if (icon == null) null else "Icon"}", + darkTheme + ) + ) + } + } + } + + @Test fun testNavigationRow() = + compareScreenshotFor(darkTheme, "_testNavigationRow_$testName") { + TUINavigationRow( + title = "Title", + leadingIcon = leadingIcon, + onClick = {}, + showRightArrow = showArrowRight + ) + } +} \ No newline at end of file diff --git a/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUISearchBarScreenshotTest.kt b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUISearchBarScreenshotTest.kt new file mode 100644 index 00000000..041683a2 --- /dev/null +++ b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUISearchBarScreenshotTest.kt @@ -0,0 +1,59 @@ +package com.tarkalabs.uicomponents.screenshots + +import com.tarkalabs.tarkaicons.Person24 +import com.tarkalabs.tarkaicons.TarkaIcon +import com.tarkalabs.tarkaicons.TarkaIcons +import com.tarkalabs.uicomponents.components.TUISearchBar +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +class TUISearchBarScreenshotTest( + private val darkTheme: Boolean, + private val leadingIcon: TarkaIcon?, + private val query: String, + private val placeHolder: String, + private val testName: String, +) : ComposeScreenshotComparator() { + + companion object { + @JvmStatic + @Parameterized.Parameters + fun data(): Collection> { + + val darkThemeValues = listOf(true, false) + val leadingIconValues = listOf(TarkaIcons.Regular.Person24, null) + val queryValues = listOf("", "Query") + val placeHoldersValues = listOf("null", "Hint") + + val testData = arrayListOf>() + + for (darkTheme in darkThemeValues) + for (leadingIconValue in leadingIconValues) + for (queryValue in queryValues) + for (placeHoldersValue in placeHoldersValues) + testData.add( + arrayOf( + darkTheme, leadingIconValue, queryValue, placeHoldersValue, + "darkTheme_${darkTheme}_leadingIconValue_${if (leadingIconValue == null) "null" else "normal"}_query_${queryValue}_placeHolder_${placeHoldersValue}" + ) + ) + + return testData + } + } + + @Test + fun testTUISearchBar() { + compareScreenshotFor(darkTheme = darkTheme, imageName = testName) { + TUISearchBar( + query = query, + placeholder = placeHolder, + leadingIcon = leadingIcon, + onQueryTextChange = {}, + onLeadingIconClick = {}, + ) + } + } +} \ No newline at end of file diff --git a/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUIStatusIndicatorScreenshotTest.kt b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUIStatusIndicatorScreenshotTest.kt new file mode 100644 index 00000000..010a17cd --- /dev/null +++ b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUIStatusIndicatorScreenshotTest.kt @@ -0,0 +1,44 @@ +package com.tarkalabs.uicomponents.screenshots + +import com.tarkalabs.uicomponents.components.TUIStatus +import com.tarkalabs.uicomponents.components.TUIStatusIndicator +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +class TUIStatusIndicatorScreenshotTest( + private val darkTheme: Boolean, + private val status: TUIStatus, + private val testName: String, +) : ComposeScreenshotComparator() { + + companion object { + @JvmStatic + @Parameterized.Parameters + fun data(): Collection> { + + val darkThemeValues = listOf(true, false) + val tuiStatuses = TUIStatus.values() + + val testData = arrayListOf>() + + for (darkTheme in darkThemeValues) + for (tuiStatus in tuiStatuses) + testData.add( + arrayOf( + darkTheme, tuiStatus, "darkTheme_${darkTheme}_TUIStatus_${tuiStatus}" + ) + ) + + return testData + } + } + + @Test + fun testTUIStatusIndicator() { + compareScreenshotFor(darkTheme = darkTheme, imageName = testName) { + TUIStatusIndicator(text = "Value", status = status) + } + } +} \ No newline at end of file diff --git a/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUITextRowScreenshotTest.kt b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUITextRowScreenshotTest.kt new file mode 100644 index 00000000..5ddd77f0 --- /dev/null +++ b/tarkaui/src/androidTest/java/com/tarkalabs/uicomponents/screenshots/TUITextRowScreenshotTest.kt @@ -0,0 +1,78 @@ +package com.tarkalabs.uicomponents.screenshots + +import com.tarkalabs.tarkaicons.Person24 +import com.tarkalabs.tarkaicons.TarkaIcon +import com.tarkalabs.tarkaicons.TarkaIcons +import com.tarkalabs.uicomponents.components.TUITextRow +import com.tarkalabs.uicomponents.components.TextRowStyle +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +class TUITextRowScreenshotTest( + private val darkTheme: Boolean, + private val style: TextRowStyle, + private val iconOne: TarkaIcon?, + private val iconTwo: TarkaIcon?, + private val infoIcon: TarkaIcon?, + private val buttonTitle: String?, + private val testName: String, +) : ComposeScreenshotComparator() { + + companion object { + @JvmStatic + @Parameterized.Parameters + fun data(): Collection> { + + val darkThemeValues = listOf(true, false) + val iconValues = listOf(TarkaIcons.Regular.Person24, null) + val buttonTitleValues = listOf(null, "Button") + val styles = listOf(TextRowStyle.Title, TextRowStyle.TitleWithDescription("description")) + val testData = arrayListOf>() + + for (darkTheme in darkThemeValues) + for (style in styles) + for (iconOne in iconValues) { + for (iconTwo in iconValues) { + for (infoIcon in iconValues) { + for (buttonTitleValue in buttonTitleValues) { + testData.add( + arrayOf( + darkTheme, + style, + iconOne, + iconTwo, + infoIcon, + buttonTitleValue, + "darkTheme_${darkTheme}_style_${style}_iconOne_${iconOne.iconName()}_iconTwo_${iconTwo.iconName()}_infoicon_${infoIcon.iconName()}_buttonTitle_${buttonTitleValue}" + ) + ) + } + } + } + } + + + return testData + } + } + + @Test + fun testTUIStatusIndicator() { + compareScreenshotFor(darkTheme = darkTheme, imageName = testName) { + TUITextRow( + title = "Some Title", + style = style, + iconOne = iconOne, + iconTwo = iconTwo, + buttonTitle = buttonTitle, + infoIcon = infoIcon, + ) + } + } +} + +fun TarkaIcon?.iconName(name: String = "normal"): String { + return if (this == null) "null" else name +} \ No newline at end of file