Trying out testTag for QA

This commit is contained in:
ThomasSession 2024-08-21 14:16:23 +10:00
parent eea54d1a17
commit dc0b782f99
2 changed files with 23 additions and 4 deletions

View File

@ -118,6 +118,24 @@ fun <T> OptionsCard(card: OptionsCardData<T>, callbacks: Callbacks<T>) {
} }
} }
@Preview
@Composable
fun PreviewOptionsCard() {
PreviewTheme {
OptionsCard(
card = OptionsCardData(
title = GetString.FromString("My Options"),
options = listOf(
RadioOption<Int>(1, GetString("Option 1")),
RadioOption<Int>(2, GetString("Option 2")),
RadioOption<Int>(3, GetString("Option 3")),
)
),
callbacks = NoOpCallbacks
)
}
}
@Composable @Composable
fun LargeItemButtonWithDrawable( fun LargeItemButtonWithDrawable(
@StringRes textId: Int, @StringRes textId: Int,

View File

@ -27,6 +27,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp 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.conversation.disappearingmessages.ExpiryType
import org.thoughtcrime.securesms.ui.GetString import org.thoughtcrime.securesms.ui.GetString
import org.thoughtcrime.securesms.ui.RadioOption 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.LocalColors
import org.thoughtcrime.securesms.ui.theme.LocalDimensions import org.thoughtcrime.securesms.ui.theme.LocalDimensions
import org.thoughtcrime.securesms.ui.theme.LocalType import org.thoughtcrime.securesms.ui.theme.LocalType
@ -44,8 +44,8 @@ import kotlin.time.Duration.Companion.days
@Composable @Composable
fun RadioButton( fun RadioButton(
onClick: () -> Unit = {},
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
onClick: () -> Unit = {},
selected: Boolean = false, selected: Boolean = false,
enabled: Boolean = true, enabled: Boolean = true,
contentPadding: PaddingValues = PaddingValues(), contentPadding: PaddingValues = PaddingValues(),
@ -120,8 +120,9 @@ fun <T> TitledRadioButton(
onClick: () -> Unit onClick: () -> Unit
) { ) {
RadioButton( RadioButton(
modifier = modifier.heightIn(min = 60.dp) modifier = modifier
.contentDescription(option.contentDescription), .heightIn(min = 60.dp)
.testTag(option.contentDescription.string()),
onClick = onClick, onClick = onClick,
selected = option.selected, selected = option.selected,
enabled = option.enabled, enabled = option.enabled,