예제 #1
0
파일: test_css.py 프로젝트: tuxcell/gaphor
def test_broken_line_style():
    # diagram css is missing the closing bracket
    css = "diagram { line-style: sloppy * { }"

    compiled_style_sheet = CompiledStyleSheet(css)

    props = compiled_style_sheet.match(Node("mytype"))
    assert props.get("line-style") is None
예제 #2
0
파일: test_css.py 프로젝트: tuxcell/gaphor
def test_line_style(css_value, result):
    css = f"mytype {{ line-style: {css_value} }}"

    compiled_style_sheet = CompiledStyleSheet(css)

    props = compiled_style_sheet.match(Node("mytype"))

    assert props.get("line-style") == result
예제 #3
0
파일: test_css.py 프로젝트: tuxcell/gaphor
def test_color_typing_in_progress():
    css = "mytype { color: # }"

    compiled_style_sheet = CompiledStyleSheet(css)

    props = compiled_style_sheet.match(Node("mytype"))

    assert props.get("color") is None
예제 #4
0
파일: test_css.py 프로젝트: tuxcell/gaphor
def test_color():
    css = "mytype { color: #00ff00 }"

    compiled_style_sheet = CompiledStyleSheet(css)

    props = compiled_style_sheet.match(Node("mytype"))

    assert props.get("color") == (0, 1, 0, 1)
예제 #5
0
파일: test_css.py 프로젝트: tuxcell/gaphor
def test_empty_compiled_style_sheet():
    css = ""

    compiled_style_sheet = CompiledStyleSheet(css)

    props = compiled_style_sheet.match(Node("mytype"))

    assert props == {}
예제 #6
0
파일: test_css.py 프로젝트: tuxcell/gaphor
def test_compiled_style_sheet():
    css = """
    * {
        font-size: 42;
        font-family: overridden
    }
    mytype {
        font-family: sans
    }
    """

    compiled_style_sheet = CompiledStyleSheet(css)

    props = compiled_style_sheet.match(Node("mytype"))

    assert props.get("font-family") == "sans"
    assert props.get("font-size") == 42