Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeevPavel committed Oct 29, 2024
1 parent 50e14ca commit 83da902
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import org.jetbrains.skia.tests.assertContentCloseEnough
import org.jetbrains.skia.tests.makeFromResource
import org.jetbrains.skiko.tests.*
import kotlin.math.ceil
import kotlin.math.floor
import kotlin.math.truncate
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
Expand Down Expand Up @@ -195,8 +197,12 @@ class ParagraphTest {
it.build()
}.layout(Float.POSITIVE_INFINITY)
assertEquals(1, paragraph.lineNumber)

val maxIntrinsicWidth = paragraph.maxIntrinsicWidth
val isMaxIntrinsicWidthRound = maxIntrinsicWidth == truncate(maxIntrinsicWidth)
val expectedLines = if (unexpectedWrapsPresent && isMaxIntrinsicWidthRound) 2 else 1

paragraph.layout(ceil(paragraph.maxIntrinsicWidth))
val expectedLines = if (unexpectedWrapsPresent) 2 else 1
assertEquals(expectedLines, paragraph.lineNumber)
paragraph.layout(paragraph.maxIntrinsicWidth)
assertEquals(expectedLines, paragraph.lineNumber)
Expand Down

0 comments on commit 83da902

Please sign in to comment.