Files
Chris233 4496eba30b feat(marketplace): 支持风格包 ZIP 下载与跨设备导入 (#942)
* feat(marketplace): add style pack ZIP downloads

* fix(marketplace): reject file URI download targets
2026-08-10 21:59:10 +08:00

31 lines
830 B
Kotlin

package com.openless.app
import java.io.ByteArrayInputStream
import java.io.IOException
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertThrows
import org.junit.Test
class OpenLessContentReaderTest {
private val archiveLimit = 512 * 1024
@Test
fun readBoundedAcceptsInputAtLimit() {
val bytes = ByteArray(archiveLimit) { index -> (index % 251).toByte() }
val result = OpenLessContentReader.readBounded(ByteArrayInputStream(bytes), archiveLimit)
assertArrayEquals(bytes, result)
}
@Test
fun readBoundedRejectsInputBeyondLimit() {
assertThrows(IOException::class.java) {
OpenLessContentReader.readBounded(
ByteArrayInputStream(ByteArray(archiveLimit + 1)),
archiveLimit,
)
}
}
}