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

commonTest.jetbrains.datalore.vis.svg.SvgAttributeTest.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.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull

class SvgAttributeTest {
    private var element: SvgEllipseElement? = null

    @BeforeTest
    fun setUp() {
        element = SvgEllipseElement(10.0, 20.0, 30.0, 40.0)
    }

    private fun elem() = element as SvgEllipseElement

    @Test
    fun testSetAttr() {
        elem().cx().set(100.0)
        elem().getAttribute("fill").set("yellow")
        elem().setAttribute("stroke", "black")

        assertEquals(100.0, elem().cx().get())
        assertEquals("yellow", elem().getAttribute("fill").get())
        assertEquals("black", elem().getAttribute("stroke").get())
    }

    @Test
    fun testNotSetAttr() {
        assertNull(elem().getAttribute("fill").get())
    }

    @Test
    fun testResetAttr() {
        elem().setAttribute("fill", "yellow")
        elem().getAttribute("fill").set("red")

        assertEquals("red", elem().getAttribute("fill").get())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy