Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
rbro112 committed May 24, 2024
1 parent 5df6ba3 commit f8022bb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fun TextRowWithIcon(
@FontScalePreviews
@Composable
fun TextRowWithIconPreviewFromMain() {
throw IllegalStateException("This should not be called")
error("This should not be called")
TextRowWithIcon(
titleText = stringResource(com.emergetools.snapshots.sample.R.string.sample_title),
subtitleText = stringResource(com.emergetools.snapshots.sample.R.string.sample_subtitle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ sealed class SnapshotMetadata {
internal data class SnapshotImageMetadata(
// Used as the primary key
override val name: String,
@Deprecated("Use name instead")
val keyName: String,
// User defined name, or set to defaults by our backend
override val displayName: String?,
// Filename of the outputted image
Expand All @@ -32,7 +30,7 @@ internal data class SnapshotImageMetadata(
override val type: SnapshotType,
// Compose-specific metadata, only set if type == COMPOSABLE
override val composePreviewSnapshotConfig: ComposePreviewSnapshotConfig? = null,
): SnapshotMetadata()
) : SnapshotMetadata()

@Serializable
internal data class SnapshotErrorMetadata(
Expand All @@ -45,4 +43,4 @@ internal data class SnapshotErrorMetadata(
override val type: SnapshotType,
// Compose-specific metadata, only set if type == COMPOSABLE
override val composePreviewSnapshotConfig: ComposePreviewSnapshotConfig? = null,
): SnapshotMetadata()
) : SnapshotMetadata()
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.platform.app.InstrumentationRegistry
import com.emergetools.snapshots.EmergeSnapshots
import com.emergetools.snapshots.SnapshotSaver
import com.emergetools.snapshots.SnapshotType
import com.emergetools.snapshots.SnapshotType.COMPOSABLE
import com.emergetools.snapshots.shared.ComposePreviewSnapshotConfig
import com.emergetools.snapshots.shared.ComposeSnapshots
Expand Down Expand Up @@ -54,6 +52,7 @@ class EmergeComposeSnapshotReflectiveParameterizedInvoker(private val previewCon
val snapshotRule: EmergeSnapshots = EmergeSnapshots()

@Test
@Suppress("TooGenericExceptionCaught")
fun reflectiveComposableInvoker() {
try {
composeRule.setContent {
Expand All @@ -69,10 +68,7 @@ class EmergeComposeSnapshotReflectiveParameterizedInvoker(private val previewCon
SnapshotVariantProvider(previewConfig) {
it.invoke(null, currentComposer, 0)
}
} ?: run {
// TODO: Ryan look to write error to file for better debugging
error("Unable to find composable method: ${previewConfig.originalFqn}")
}
} ?: error("Unable to find composable method: ${previewConfig.originalFqn}")
}
snapshotRule.take(composeRule, previewConfig)
} catch (e: Exception) {
Expand Down

0 comments on commit f8022bb

Please sign in to comment.