PreviewUrl: fix layout issue and add more tests
This commit is contained in:
parent
5d3682cd44
commit
c2c9e37a36
@ -50,6 +50,13 @@ internal class UrlsExtractorTest : InstrumentedTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun withoutProtocolTest() {
|
||||
createEvent(body = "www.matrix.org")
|
||||
.let { urlsExtractor.extract(it) }
|
||||
.size shouldBeEqualTo 0
|
||||
}
|
||||
|
||||
@Test
|
||||
fun oneUrlWithParamTest() {
|
||||
createEvent(body = "https://matrix.org?foo=bar")
|
||||
@ -60,6 +67,16 @@ internal class UrlsExtractorTest : InstrumentedTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun oneUrlWithParamsTest() {
|
||||
createEvent(body = "https://matrix.org?foo=bar&bar=foo")
|
||||
.let { urlsExtractor.extract(it) }
|
||||
.let { result ->
|
||||
result.size shouldBeEqualTo 1
|
||||
result[0] shouldBeEqualTo "https://matrix.org?foo=bar&bar=foo"
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun oneUrlInlinedTest() {
|
||||
createEvent(body = "Hello https://matrix.org, how are you?")
|
||||
|
@ -117,7 +117,7 @@ class PreviewUrlView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun renderLoading() {
|
||||
// TODO
|
||||
// Just hide for the moment
|
||||
isVisible = false
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@
|
||||
android:maxLines="4"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/url_preview_left_border"
|
||||
app:layout_constraintTop_toBottomOf="@+id/url_preview_image"
|
||||
tools:text="The British perfumer says removing actor John Boyega from his own advert was “utterly despicable”." />
|
||||
@ -68,6 +69,7 @@
|
||||
android:singleLine="true"
|
||||
android:textColor="?riotx_text_tertiary"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/url_preview_left_border"
|
||||
app:layout_constraintTop_toBottomOf="@+id/url_preview_description"
|
||||
tools:text="BBC News" />
|
||||
|
Loading…
Reference in New Issue
Block a user