Test that blurhash is correctly used and fix issue on StickerContent.
This commit is contained in:
parent
45295c2d8a
commit
ef52f2a645
2 changed files with 21 additions and 15 deletions
|
|
@ -114,7 +114,8 @@ internal fun InReplyToDetails.metadata(): InReplyToMetadata? = when (eventConten
|
||||||
AttachmentThumbnailInfo(
|
AttachmentThumbnailInfo(
|
||||||
thumbnailSource = MediaSource(eventContent.url),
|
thumbnailSource = MediaSource(eventContent.url),
|
||||||
textContent = eventContent.body,
|
textContent = eventContent.body,
|
||||||
type = AttachmentThumbnailType.Image
|
type = AttachmentThumbnailType.Image,
|
||||||
|
blurHash = eventContent.info.blurhash,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
is PollContent -> InReplyToMetadata.Thumbnail(
|
is PollContent -> InReplyToMetadata.Thumbnail(
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import io.element.android.libraries.matrix.test.A_USER_ID
|
||||||
import io.element.android.libraries.matrix.test.media.aMediaSource
|
import io.element.android.libraries.matrix.test.media.aMediaSource
|
||||||
import io.element.android.libraries.matrix.test.timeline.aMessageContent
|
import io.element.android.libraries.matrix.test.timeline.aMessageContent
|
||||||
import io.element.android.libraries.matrix.test.timeline.aPollContent
|
import io.element.android.libraries.matrix.test.timeline.aPollContent
|
||||||
|
import io.element.android.libraries.matrix.ui.components.A_BLUR_HASH
|
||||||
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailInfo
|
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailInfo
|
||||||
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailType
|
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailType
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
|
|
@ -82,7 +83,7 @@ class InReplyToMetadataKtTest {
|
||||||
messageType = ImageMessageType(
|
messageType = ImageMessageType(
|
||||||
body = "body",
|
body = "body",
|
||||||
source = aMediaSource(),
|
source = aMediaSource(),
|
||||||
info = null,
|
info = anImageInfo(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).metadata()
|
).metadata()
|
||||||
|
|
@ -94,7 +95,7 @@ class InReplyToMetadataKtTest {
|
||||||
thumbnailSource = aMediaSource(),
|
thumbnailSource = aMediaSource(),
|
||||||
textContent = "body",
|
textContent = "body",
|
||||||
type = AttachmentThumbnailType.Image,
|
type = AttachmentThumbnailType.Image,
|
||||||
blurHash = null,
|
blurHash = A_BLUR_HASH,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -108,15 +109,7 @@ class InReplyToMetadataKtTest {
|
||||||
anInReplyToDetails(
|
anInReplyToDetails(
|
||||||
eventContent = StickerContent(
|
eventContent = StickerContent(
|
||||||
body = "body",
|
body = "body",
|
||||||
info = ImageInfo(
|
info = anImageInfo(),
|
||||||
height = null,
|
|
||||||
width = null,
|
|
||||||
mimetype = null,
|
|
||||||
size = null,
|
|
||||||
thumbnailInfo = null,
|
|
||||||
thumbnailSource = aMediaSource(),
|
|
||||||
blurhash = null
|
|
||||||
),
|
|
||||||
url = "url"
|
url = "url"
|
||||||
)
|
)
|
||||||
).metadata()
|
).metadata()
|
||||||
|
|
@ -128,7 +121,7 @@ class InReplyToMetadataKtTest {
|
||||||
thumbnailSource = aMediaSource(url = "url"),
|
thumbnailSource = aMediaSource(url = "url"),
|
||||||
textContent = "body",
|
textContent = "body",
|
||||||
type = AttachmentThumbnailType.Image,
|
type = AttachmentThumbnailType.Image,
|
||||||
blurHash = null,
|
blurHash = A_BLUR_HASH,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -152,7 +145,7 @@ class InReplyToMetadataKtTest {
|
||||||
size = null,
|
size = null,
|
||||||
thumbnailInfo = null,
|
thumbnailInfo = null,
|
||||||
thumbnailSource = aMediaSource(),
|
thumbnailSource = aMediaSource(),
|
||||||
blurhash = null
|
blurhash = A_BLUR_HASH
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -165,7 +158,7 @@ class InReplyToMetadataKtTest {
|
||||||
thumbnailSource = aMediaSource(),
|
thumbnailSource = aMediaSource(),
|
||||||
textContent = "body",
|
textContent = "body",
|
||||||
type = AttachmentThumbnailType.Video,
|
type = AttachmentThumbnailType.Video,
|
||||||
blurHash = null,
|
blurHash = A_BLUR_HASH,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -454,6 +447,18 @@ fun anInReplyToDetails(
|
||||||
textContent = textContent,
|
textContent = textContent,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun anImageInfo(): ImageInfo {
|
||||||
|
return ImageInfo(
|
||||||
|
height = 100,
|
||||||
|
width = 100,
|
||||||
|
mimetype = "image/jpeg",
|
||||||
|
size = 1000,
|
||||||
|
thumbnailInfo = null,
|
||||||
|
thumbnailSource = aMediaSource(),
|
||||||
|
blurhash = A_BLUR_HASH,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun testEnv(content: @Composable () -> Any?): Any? {
|
private fun testEnv(content: @Composable () -> Any?): Any? {
|
||||||
var result: Any? = null
|
var result: Any? = null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue