def test_start_slant_legal_joint():
    # Create a joint that is only legal because of the start slant.
    p = Pen()
    p.outline_mode(1.0, 0.1)
    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(0.8, start_slant=-45)
    p.turn_left(90)
    p.outline_mode(2.0, 0.1)
    p.line_forward(5)
def test_start_slant_legal_joint():
    # Create a joint that is only legal because of the start slant.
    p = Pen()
    p.outline_mode(1.0, 0.1)
    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(0.8, start_slant=-45)
    p.turn_left(90)
    p.outline_mode(2.0, 0.1)
    p.line_forward(5)
def test_outline():
    p = Pen()
    p.move_to((0, 0))
    p.turn_to(0)
    p.outline_mode(1.0, 0.2)
    p.line_forward(3)

    assert_path_data(
        p, 1,
        (
            'M-0.1,-0.6 L-0.1,0.6 L3.1,0.6 L3.1,-0.6 L-0.1,-0.6 z '
            'M0.1,-0.4 L2.9,-0.4 L2.9,0.4 L0.1,0.4 L0.1,-0.4 z'
        )
    )
def test_outline():
    p = Pen()
    p.move_to((0, 0))
    p.turn_to(0)
    p.outline_mode(1.0, 0.2)
    p.line_forward(3)

    assert_path_data(
        p, 1,
        (
            'M-0.1,-0.6 L-0.1,0.6 L3.1,0.6 L3.1,-0.6 L-0.1,-0.6 z '
            'M0.1,-0.4 L2.9,-0.4 L2.9,0.4 L0.1,0.4 L0.1,-0.4 z'
        )
    )
def test_change_outline_width():
    # Changing the outline width starts a new path.
    p = Pen()
    p.move_to((0, 0))
    p.turn_to(0)
    p.outline_mode(1.0, 0.2)
    p.line_forward(3)
    p.outline_mode(1.0, 0.4)
    p.line_forward(3)

    assert_path_data(
        p, 1,
        [
            (
                'M-0.1,-0.6 L-0.1,0.6 L3.1,0.6 L3.1,-0.6 L-0.1,-0.6 z '
                'M0.1,-0.4 L2.9,-0.4 L2.9,0.4 L0.1,0.4 L0.1,-0.4 z'
            ),
            (
                'M2.8,-0.7 L2.8,0.7 L6.2,0.7 L6.2,-0.7 L2.8,-0.7 z '
                'M3.2,-0.3 L5.8,-0.3 L5.8,0.3 L3.2,0.3 L3.2,-0.3 z'
            ),
        ]
    )
def test_change_outline_width():
    # Changing the outline width starts a new path.
    p = Pen()
    p.move_to((0, 0))
    p.turn_to(0)
    p.outline_mode(1.0, 0.2)
    p.line_forward(3)
    p.outline_mode(1.0, 0.4)
    p.line_forward(3)

    assert_path_data(
        p, 1,
        [
            (
                'M-0.1,-0.6 L-0.1,0.6 L3.1,0.6 L3.1,-0.6 L-0.1,-0.6 z '
                'M0.1,-0.4 L2.9,-0.4 L2.9,0.4 L0.1,0.4 L0.1,-0.4 z'
            ),
            (
                'M2.8,-0.7 L2.8,0.7 L6.2,0.7 L6.2,-0.7 L2.8,-0.7 z '
                'M3.2,-0.3 L5.8,-0.3 L5.8,0.3 L3.2,0.3 L3.2,-0.3 z'
            ),
        ]
    )