From c073026c85f516dc637fccf58687cf5002e3492f Mon Sep 17 00:00:00 2001 From: Vladimir Mazunin Date: Fri, 1 Nov 2024 20:47:52 +0400 Subject: [PATCH 1/4] up skiko version to 0.8.18 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cdd5191626228..95ee0c141d520 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -68,7 +68,7 @@ protobuf = "3.22.3" paparazzi = "1.0.0" paparazziNative = "2022.1.1-canary-f5f9f71" shadow = "8.1.1" -skiko = "0.8.17" +skiko = "0.8.18" spdxGradlePlugin = "0.6.0" sqldelight = "1.3.0" retrofit = "2.7.2" From fc67ceabd933c0e0eb09be5fde83f05f0296fd9b Mon Sep 17 00:00:00 2001 From: Vladimir Mazunin Date: Thu, 7 Nov 2024 03:50:07 +0400 Subject: [PATCH 2/4] adjusted failed tests to rounding hack in skiko https://github.com/JetBrains/skiko/pull/997 --- .../compose/ui/text/DesktopParagraphTest.kt | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt index 306118569de1e..4f35b78113761 100644 --- a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt +++ b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt @@ -17,7 +17,6 @@ package androidx.compose.ui.text import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.geometry.Rect import androidx.compose.ui.graphics.Canvas import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.test.junit4.createComposeRule @@ -34,7 +33,6 @@ import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.sp import com.google.common.truth.Truth -import org.junit.Assume.assumeTrue import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -56,6 +54,7 @@ class DesktopParagraphTest { style = FontStyle.Normal ) ) + private val lineMetricsTolerance = 0.0001f @Test fun getBoundingBox_basic() { @@ -70,10 +69,10 @@ class DesktopParagraphTest { for (i in 0..text.length - 1) { val box = paragraph.getBoundingBox(i) - Truth.assertThat(box.left).isEqualTo(i * fontSizeInPx) - Truth.assertThat(box.right).isEqualTo((i + 1) * fontSizeInPx) + Truth.assertThat(box.left).isWithin(lineMetricsTolerance).of(i * fontSizeInPx) + Truth.assertThat(box.right).isWithin(lineMetricsTolerance).of((i + 1) * fontSizeInPx) Truth.assertThat(box.top).isZero() - Truth.assertThat(box.bottom).isEqualTo(fontSizeInPx) + Truth.assertThat(box.bottom).isWithin(lineMetricsTolerance).of(fontSizeInPx) } } } @@ -498,18 +497,20 @@ class DesktopParagraphTest { for (i in ltrText.indices) { Truth.assertThat(paragraph.getHorizontalPosition(i, true)) - .isEqualTo(fontSizeInPx * i) + .isWithin(lineMetricsTolerance) + .of(fontSizeInPx * i) } for (i in 1 until rtlText.length) { Truth.assertThat(paragraph.getHorizontalPosition(i + ltrText.length, true)) - .isEqualTo(width - fontSizeInPx * i) + .isWithin(lineMetricsTolerance) + .of(width - fontSizeInPx * i) } } } @Test - fun getHorizontalPositionForOffset_notPrimary_Bidi_singleLine_textDirectionLtr() { + fun getHorizontalPositionForOffset_notPrimary_Bidi_singleLine_textDirectionLtr() {// with(defaultDensity) { val ltrText = "abc" val rtlText = "\u05D0\u05D1\u05D2" @@ -528,16 +529,19 @@ class DesktopParagraphTest { for (i in ltrText.indices) { Truth.assertThat(paragraph.getHorizontalPosition(i, false)) - .isEqualTo(fontSizeInPx * i) + .isWithin(lineMetricsTolerance) + .of(fontSizeInPx * i) } for (i in rtlText.indices) { Truth.assertThat(paragraph.getHorizontalPosition(i + ltrText.length, false)) - .isEqualTo(width - fontSizeInPx * i) + .isWithin(lineMetricsTolerance) + .of(width - fontSizeInPx * i) } Truth.assertThat(paragraph.getHorizontalPosition(text.length, false)) - .isEqualTo(width - rtlText.length * fontSizeInPx) + .isWithin(lineMetricsTolerance) + .of(width - rtlText.length * fontSizeInPx) } } From 167e03d15fc060f46bf3869ef267374814378df9 Mon Sep 17 00:00:00 2001 From: Vladimir Mazunin Date: Thu, 7 Nov 2024 03:52:02 +0400 Subject: [PATCH 3/4] removed typo --- .../kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt index 4f35b78113761..6a482e232b93f 100644 --- a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt +++ b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt @@ -510,7 +510,7 @@ class DesktopParagraphTest { } @Test - fun getHorizontalPositionForOffset_notPrimary_Bidi_singleLine_textDirectionLtr() {// + fun getHorizontalPositionForOffset_notPrimary_Bidi_singleLine_textDirectionLtr() { with(defaultDensity) { val ltrText = "abc" val rtlText = "\u05D0\u05D1\u05D2" From 5e417a19103061d76e49ccf53a7644180a21147b Mon Sep 17 00:00:00 2001 From: Vladimir Mazunin Date: Thu, 7 Nov 2024 14:15:52 +0400 Subject: [PATCH 4/4] increased tolerance --- .../kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt index 6a482e232b93f..cb26b7902ca57 100644 --- a/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt +++ b/compose/ui/ui-text/src/desktopTest/kotlin/androidx/compose/ui/text/DesktopParagraphTest.kt @@ -54,7 +54,7 @@ class DesktopParagraphTest { style = FontStyle.Normal ) ) - private val lineMetricsTolerance = 0.0001f + private val lineMetricsTolerance = 0.001f @Test fun getBoundingBox_basic() {