Skip to content

Commit

Permalink
Upgraded Skiko version to 0.8.18 (#1676)
Browse files Browse the repository at this point in the history
Skiko changelog:
JetBrains/skiko@v0.8.17...v0.8.18

Fixes - https://youtrack.jetbrains.com/issue/CMP-6879

### Fixes - Multiple Platforms
Fix Skia paragraph caching performance degradation
  • Loading branch information
mazunin-v-jb committed Nov 7, 2024
1 parent b567d35 commit 1209e6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -56,6 +54,7 @@ class DesktopParagraphTest {
style = FontStyle.Normal
)
)
private val lineMetricsTolerance = 0.001f

@Test
fun getBoundingBox_basic() {
Expand All @@ -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)
}
}
}
Expand Down Expand Up @@ -498,12 +497,14 @@ 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)
}
}
}
Expand All @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protobuf = "3.21.8"
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"
Expand Down

0 comments on commit 1209e6b

Please sign in to comment.