aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Demin <igor.demin@jetbrains.com>2020-10-22 12:56:44 +0300
committerIgor Demin <igor.demin@jetbrains.com>2020-10-22 13:07:35 +0300
commitb56ca32355c88bbfec7b9972c42d395769f7fc33 (patch)
tree8e45747850a5d4befe052301fe451d1177c9afea
parent89554fe998c0403e45d4036942ac399b7428e764 (diff)
downloadsupport-b56ca32355c88bbfec7b9972c42d395769f7fc33.tar.gz
Desktop: fix tests
We should always use TestComposeWindow/DesktopScreenshotTestRule/createComposeRule if we test compose classes. Otherwise there will be an error sometimes: java.lang.UnsatisfiedLinkError: 'long org.jetbrains.skija.Paint._nGetFinalizer()' (because initCompose() may be not called before test) Test: ./gradlew jvmTest desktopTest -Pandroidx.compose.multiplatformEnabled=true Change-Id: I71ca818ebb892c81186b758e4d5286c7eb05c768
-rw-r--r--compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/SkijaLayerTest.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/SkijaLayerTest.kt b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/SkijaLayerTest.kt
index 2d255796624..f837ab9f1b7 100644
--- a/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/SkijaLayerTest.kt
+++ b/compose/ui/ui/src/desktopTest/kotlin/androidx/compose/ui/platform/SkijaLayerTest.kt
@@ -25,13 +25,18 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.round
+import androidx.ui.test.createComposeRule
import org.junit.Assert.assertEquals
+import org.junit.Rule
import org.junit.Test
import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.roundToInt
class SkijaLayerTest {
+ @get:Rule
+ val rule = createComposeRule()
+
private val layer = TestSkijaLayer()
private val matrix = Matrix()
private val cos45 = cos(PI / 4)