|
|
@ -307,7 +307,7 @@ class ComposeResourceTest { |
|
|
|
@OptIn(ExperimentalResourceApi::class) |
|
|
|
@OptIn(ExperimentalResourceApi::class) |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testGetResourceBytes() = runTest { |
|
|
|
fun testGetResourceBytes() = runTest { |
|
|
|
val env = getSystemEnvironment() |
|
|
|
val env = getSystemResourceEnvironment() |
|
|
|
val imageBytes = getDrawableResourceBytes(env, TestDrawableResource("1.png")) |
|
|
|
val imageBytes = getDrawableResourceBytes(env, TestDrawableResource("1.png")) |
|
|
|
assertEquals(946, imageBytes.size) |
|
|
|
assertEquals(946, imageBytes.size) |
|
|
|
val fontBytes = getFontResourceBytes(env, TestFontResource("font_awesome.otf")) |
|
|
|
val fontBytes = getFontResourceBytes(env, TestFontResource("font_awesome.otf")) |
|
|
@ -319,11 +319,13 @@ class ComposeResourceTest { |
|
|
|
fun testGetResourceEnvironment() = runComposeUiTest { |
|
|
|
fun testGetResourceEnvironment() = runComposeUiTest { |
|
|
|
var environment: ResourceEnvironment? = null |
|
|
|
var environment: ResourceEnvironment? = null |
|
|
|
setContent { |
|
|
|
setContent { |
|
|
|
|
|
|
|
CompositionLocalProvider(LocalComposeEnvironment provides TestComposeEnvironment) { |
|
|
|
environment = rememberResourceEnvironment() |
|
|
|
environment = rememberResourceEnvironment() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
waitForIdle() |
|
|
|
waitForIdle() |
|
|
|
|
|
|
|
|
|
|
|
val systemEnvironment = getSystemEnvironment() |
|
|
|
val systemEnvironment = getSystemResourceEnvironment() |
|
|
|
assertEquals(systemEnvironment, environment) |
|
|
|
assertEquals(systemEnvironment, environment) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|