From 35fedde768f9391eba51aeb160c31e561b888aab Mon Sep 17 00:00:00 2001 From: Konstantin Tskhovrebov Date: Wed, 24 Apr 2024 11:11:18 +0200 Subject: [PATCH] [resources] Fix test environment. --- .../jetbrains/compose/resources/ComposeResourceTest.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt index 6e191a944c..712e8a8cbf 100644 --- a/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt +++ b/components/resources/library/src/commonTest/kotlin/org/jetbrains/compose/resources/ComposeResourceTest.kt @@ -307,7 +307,7 @@ class ComposeResourceTest { @OptIn(ExperimentalResourceApi::class) @Test fun testGetResourceBytes() = runTest { - val env = getSystemEnvironment() + val env = getSystemResourceEnvironment() val imageBytes = getDrawableResourceBytes(env, TestDrawableResource("1.png")) assertEquals(946, imageBytes.size) val fontBytes = getFontResourceBytes(env, TestFontResource("font_awesome.otf")) @@ -319,11 +319,13 @@ class ComposeResourceTest { fun testGetResourceEnvironment() = runComposeUiTest { var environment: ResourceEnvironment? = null setContent { - environment = rememberResourceEnvironment() + CompositionLocalProvider(LocalComposeEnvironment provides TestComposeEnvironment) { + environment = rememberResourceEnvironment() + } } waitForIdle() - val systemEnvironment = getSystemEnvironment() + val systemEnvironment = getSystemResourceEnvironment() assertEquals(systemEnvironment, environment) } }