diff --git a/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt b/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt index 432098403f..1aeeed678a 100644 --- a/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt +++ b/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt @@ -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 }