mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Add tests to cover the new feature
This commit is contained in:
parent
e8fbbe2b97
commit
96b186ca8c
@ -96,5 +96,30 @@ class SpanUtilsTest : InstrumentedTest {
|
||||
spanUtils.canUseTextFuture(string) shouldBeEqualTo trueIfAlwaysAllowed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test get binding options regular`() {
|
||||
val string = SpannableString("Text")
|
||||
val result = spanUtils.getBindingOptions(string)
|
||||
result.canUseTextFuture shouldBeEqualTo true
|
||||
result.preventMutation shouldBeEqualTo false
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test get binding options strikethrough`() {
|
||||
val string = SpannableString("Text with strikethrough")
|
||||
string.setSpan(StrikethroughSpan(), 10, 23, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
val result = spanUtils.getBindingOptions(string)
|
||||
result.canUseTextFuture shouldBeEqualTo false
|
||||
result.preventMutation shouldBeEqualTo false
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test get binding options MetricAffectingSpan`() {
|
||||
val string = SpannableString("Emoji \uD83D\uDE2E\u200D\uD83D\uDCA8")
|
||||
val result = spanUtils.getBindingOptions(string)
|
||||
result.canUseTextFuture shouldBeEqualTo false
|
||||
result.preventMutation shouldBeEqualTo true
|
||||
}
|
||||
|
||||
private fun trueIfAlwaysAllowed() = Build.VERSION.SDK_INT < Build.VERSION_CODES.P
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user