Revert "Auto generate dark mode previews and screenshots (#776)" (#784)

This reverts commit 79b529193c.
This commit is contained in:
Marco Romano 2023-07-05 15:47:53 +02:00 committed by GitHub
parent e4451c3423
commit f33561c25d
1247 changed files with 1940 additions and 2265 deletions

View file

@ -38,7 +38,5 @@ class ColorTestPreview(
)
}
override val name: String = showkaseBrowserColor.colorName
override fun toString(): String = "Color_${showkaseBrowserColor.colorGroup}_${showkaseBrowserColor.colorName}"
}

View file

@ -25,7 +25,5 @@ class ComponentTestPreview(
@Composable
override fun Content() = showkaseBrowserComponent.component()
override val name: String = showkaseBrowserComponent.componentName
override fun toString(): String = showkaseBrowserComponent.componentKey
}

View file

@ -38,7 +38,6 @@ import com.airbnb.android.showkase.models.Showkase
import com.android.ide.common.rendering.api.SessionParams
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import io.element.android.libraries.designsystem.preview.NIGHT_MODE_NAME
import io.element.android.libraries.theme.ElementTheme
import org.junit.Rule
import org.junit.Test
@ -60,11 +59,7 @@ class ScreenshotTest {
object PreviewProvider : TestParameter.TestParameterValuesProvider {
override fun provideValues(): List<TestPreview> {
val metadata = Showkase.getMetadata()
val components = metadata.componentList.filterNot {
// skip all previews that have "dark" in the name because
// all previews get a dark mode screenshot automatically now
it.componentKey.contains("dark", true)
}.map(::ComponentTestPreview)
val components = metadata.componentList.map(::ComponentTestPreview)
val colors = metadata.colorList.map(::ColorTestPreview)
val typography = metadata.typographyList.map(::TypographyTestPreview)
@ -100,10 +95,6 @@ class ScreenshotTest {
),
LocalConfiguration provides Configuration().apply {
setLocales(LocaleList(localeStr.toLocale()))
// Dark mode previews have name "N" so their component is subfixed with "- N"
if (componentTestPreview.name.contains("- $NIGHT_MODE_NAME")){
uiMode = Configuration.UI_MODE_NIGHT_YES
}
},
// Needed so that UI that uses it don't crash during screenshot tests
LocalOnBackPressedDispatcherOwner provides object : OnBackPressedDispatcherOwner {

View file

@ -21,6 +21,4 @@ import androidx.compose.runtime.Composable
interface TestPreview {
@Composable
fun Content()
val name: String
}

View file

@ -44,7 +44,5 @@ class TypographyTestPreview(
)
}
override val name: String = showkaseBrowserTypography.typographyName
override fun toString(): String = "Typo_${showkaseBrowserTypography.typographyGroup}_${showkaseBrowserTypography.typographyName}"
}