All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.jetbrains.datalore.vis.svg.SvgNodeTest.kt Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
/*
 * Copyright (c) 2019. JetBrains s.r.o.
 * Use of this source code is governed by the MIT license that can be found in the LICENSE file.
 */

package jetbrains.datalore.vis.svg

import kotlin.test.*


class SvgNodeTest {
    @Test
    fun nodeAdd() {
        val node1 = newNode()
        val node2 = newNode()

        assertNull(node1.parent().get())

        node1.children().add(node2)

        assertSame(node1, node2.parent().get())
        assertEquals(1, node1.children().size)
        assertSame(node1.children()[0], node2)
    }

    @Test
    fun nodeRemove() {
        val node1 = newNode()
        val node2 = newNode()

        node1.children().add(node2)
        node1.children().remove(node2)

        assertNull(node2.parent().get())
        assertTrue(node1.children().isEmpty())
    }

    private fun newNode(): SvgNode {
        return MySvgNode()
    }

    private class MySvgNode : SvgNode()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy