From dc0b782f999ea2c79725368bf3e81b76638a53ad Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Wed, 21 Aug 2024 14:16:23 +1000 Subject: [PATCH] Trying out testTag for QA --- .../thoughtcrime/securesms/ui/Components.kt | 18 ++++++++++++++++++ .../securesms/ui/components/RadioButton.kt | 9 +++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt index daeb6b853d..bd6b9a3d89 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt @@ -118,6 +118,24 @@ fun OptionsCard(card: OptionsCardData, callbacks: Callbacks) { } } +@Preview +@Composable +fun PreviewOptionsCard() { + PreviewTheme { + OptionsCard( + card = OptionsCardData( + title = GetString.FromString("My Options"), + options = listOf( + RadioOption(1, GetString("Option 1")), + RadioOption(2, GetString("Option 2")), + RadioOption(3, GetString("Option 3")), + ) + ), + callbacks = NoOpCallbacks + ) + } +} + @Composable fun LargeItemButtonWithDrawable( @StringRes textId: Int, diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/RadioButton.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/RadioButton.kt index cabe536767..3302ae9de7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/RadioButton.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/RadioButton.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.RectangleShape +import androidx.compose.ui.platform.testTag import androidx.compose.ui.semantics.Role import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -34,7 +35,6 @@ import network.loki.messenger.libsession_util.util.ExpiryMode import org.thoughtcrime.securesms.conversation.disappearingmessages.ExpiryType import org.thoughtcrime.securesms.ui.GetString import org.thoughtcrime.securesms.ui.RadioOption -import org.thoughtcrime.securesms.ui.contentDescription import org.thoughtcrime.securesms.ui.theme.LocalColors import org.thoughtcrime.securesms.ui.theme.LocalDimensions import org.thoughtcrime.securesms.ui.theme.LocalType @@ -44,8 +44,8 @@ import kotlin.time.Duration.Companion.days @Composable fun RadioButton( - onClick: () -> Unit = {}, modifier: Modifier = Modifier, + onClick: () -> Unit = {}, selected: Boolean = false, enabled: Boolean = true, contentPadding: PaddingValues = PaddingValues(), @@ -120,8 +120,9 @@ fun TitledRadioButton( onClick: () -> Unit ) { RadioButton( - modifier = modifier.heightIn(min = 60.dp) - .contentDescription(option.contentDescription), + modifier = modifier + .heightIn(min = 60.dp) + .testTag(option.contentDescription.string()), onClick = onClick, selected = option.selected, enabled = option.enabled,