[orx-composition, orx-svg] Move Composition and SVG code from OPENRNDR to ORX

This commit is contained in:
Edwin Jakobs
2024-03-15 13:34:17 +01:00
parent e35037fbec
commit 8eeb74e1a8
19 changed files with 3558 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package org.openrndr.extra.composition
import org.openrndr.shape.Shape
import kotlin.test.*
class TestComposition {
val composition = let { _ ->
val root = GroupNode().also { it.id = "outer" }
root.children += GroupNode().also {
it.id = "inner"
}
root.children += ShapeNode(Shape.EMPTY).also {
it.id = "shape"
}
Composition(root)
}
@Test
fun findGroup() {
assertEquals("outer", composition.findGroup("outer")?.id)
assertEquals("inner", composition.findGroup("inner")?.id)
assertNull(composition.findGroup("shape"))
}
@Test
fun findShape() {
assertEquals("shape", composition.findShape("shape")?.id)
assertNull(composition.findShape("inner"))
assertNull(composition.findShape("outer"))
}
@Test
fun findImage() {
assertNull(composition.findImage("inner"))
assertNull(composition.findImage("outer"))
assertNull(composition.findImage("shape"))
}
}