Esempio n. 1
0
def test_set_fill_handles_lists_of_color_objects(using_opengl_renderer):
    m = OpenGLVMobject()
    assert m.fill_color.hex == "#fff"
    m.set_fill([Color(PURE_BLUE), Color(PURE_GREEN), Color(PURE_RED)])
    assert m.get_fill_colors()[0].hex == "#00f"
    assert m.get_fill_colors()[1].hex == "#0f0"
    assert m.get_fill_colors()[2].hex == "#f00"
Esempio n. 2
0
def test_set_fill_handles_lists_of_strs(using_opengl_renderer):
    m = OpenGLVMobject()
    assert m.fill_color.hex == "#fff"
    m.set_fill([BLACK, BLUE, GREEN])
    assert m.get_fill_colors()[0] == Color(BLACK)
    assert m.get_fill_colors()[1] == Color(BLUE)
    assert m.get_fill_colors()[2] == Color(GREEN)
Esempio n. 3
0
def test_set_fill_color(using_opengl_renderer):
    m = OpenGLVMobject()
    assert m.fill_color.hex == "#fff"
    np.alltrue(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))

    m.set_fill(BLACK)
    assert m.fill_color.hex == "#000"
    np.alltrue(m.fill_rgba == np.array((1.0, 1.0, 1.0, 1.0)))

    m.set_fill(PURE_GREEN, opacity=0.5)
    assert m.fill_color.hex == "#0f0"
    np.alltrue(m.fill_rgba == np.array((0.0, 1.0, 0.0, 0.5)))