Unverified Commit a29d9a61 authored by Ivan Matkov's avatar Ivan Matkov Committed by GitHub

Add `PathBuilder` detach reset behavior tests (#1170)

[SKIKO-1113](https://youtrack.jetbrains.com/issue/SKIKO-1113) Calling
detach() twice in a row on same PathBuilder

Adding more tests to verify behavior from the report
parent 3e575c5c
......@@ -43,6 +43,28 @@ class PathBuilderTest {
assertEquals(3, detached.pointsCount)
}
@Test
fun testDetachTwiceWithoutMutationReturnsEmptyPath() {
val builder = PathBuilder().moveTo(0f, 0f).lineTo(10f, 10f)
val first = builder.detach()
assertEquals(2, first.pointsCount)
val second = builder.detach()
assertEquals(0, second.pointsCount)
}
@Test
fun testDetachAfterMutationIsAllowed() {
val builder = PathBuilder().moveTo(0f, 0f).lineTo(10f, 10f)
val first = builder.detach()
assertEquals(2, first.pointsCount)
val second = builder.moveTo(5f, 5f).lineTo(6f, 6f).detach()
assertEquals(2, second.pointsCount)
assertEquals(Point(5f, 5f), second.getPoint(0))
}
@Test
fun testSetFillType() {
val path = PathBuilder()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment