Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded Skiko version to 0.8.18 #1676

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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"
igordmn marked this conversation as resolved.
Show resolved Hide resolved
skiko = "0.8.18"
spdxGradlePlugin = "0.6.0"
sqldelight = "1.3.0"
retrofit = "2.7.2"
Expand Down
Loading