diff --git a/mirai-core-mock/src/internal/MockBotImpl.kt b/mirai-core-mock/src/internal/MockBotImpl.kt index df36f7956c..0e7e67fe15 100644 --- a/mirai-core-mock/src/internal/MockBotImpl.kt +++ b/mirai-core-mock/src/internal/MockBotImpl.kt @@ -185,7 +185,12 @@ internal class MockBotImpl( val md5 = resource.md5 val format = resource.formatName - return MockImage(generateImageId(md5, format), bot.tmpResourceServer.uploadResourceAsImage(resource).toString()) + // todo width, height ? + return MockImage( + imageId = generateImageId(md5, format), + urlPath = bot.tmpResourceServer.uploadResourceAsImage(resource).toString(), + size = resource.size + ) } override fun toString(): String { diff --git a/mirai-core-mock/test/ImageUploadTest.kt b/mirai-core-mock/test/ImageUploadTest.kt index ab0aeaf6f9..fb4bd8f75b 100644 --- a/mirai-core-mock/test/ImageUploadTest.kt +++ b/mirai-core-mock/test/ImageUploadTest.kt @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import java.net.URL import kotlin.test.assertEquals +import kotlin.test.assertNotEquals import kotlin.test.assertTrue @TestInstance(TestInstance.Lifecycle.PER_METHOD) @@ -44,6 +45,7 @@ internal class ImageUploadTest { assertTrue { data.contentEquals(URL(img.queryUrl()).readBytes()) } + assertNotEquals(0, img.size) } @Test