Beispiel #1
0
def checkbox_radio_to_draw():
    new_checkbox_element = Element("foo", ElementType.checkbox, True)
    new_radio_element = Element("bar", ElementType.radio, 0)

    new_checkbox_to_draw = Utils().checkbox_radio_to_draw(new_checkbox_element)
    new_radio_to_draw = Utils().checkbox_radio_to_draw(new_radio_element)

    assert new_checkbox_to_draw.value == u"\u2713"
    assert new_checkbox_to_draw.type == ElementType.text
    assert new_checkbox_to_draw.name == "foo"
    assert new_checkbox_to_draw.font == TextConstants().global_font
    assert new_checkbox_to_draw.font_size == TextConstants().global_font_size
    assert new_checkbox_to_draw.font_color == TextConstants().global_font_color
    assert new_checkbox_to_draw.text_x_offset == TextConstants(
    ).global_text_x_offset
    assert new_checkbox_to_draw.text_y_offset == TextConstants(
    ).global_text_y_offset
    assert (new_checkbox_to_draw.text_wrap_length ==
            TextConstants().global_text_wrap_length)

    assert new_radio_to_draw.value == u"\u25CF"
    assert new_radio_to_draw.type == ElementType.text
    assert new_radio_to_draw.name == "bar"
    assert new_radio_to_draw.font == TextConstants().global_font
    assert new_radio_to_draw.font_size == TextConstants().global_font_size
    assert new_radio_to_draw.font_color == TextConstants().global_font_color
    assert new_radio_to_draw.text_x_offset == TextConstants(
    ).global_text_x_offset
    assert new_radio_to_draw.text_y_offset == TextConstants(
    ).global_text_y_offset
    assert new_radio_to_draw.text_wrap_length == TextConstants(
    ).global_text_wrap_length
Beispiel #2
0
def checkbox_radio_to_draw():
    new_checkbox_element = Element("foo", ElementType.checkbox, True)
    new_radio_element = Element("bar", ElementType.radio, 0)

    new_checkbox_to_draw = Utils().checkbox_radio_to_draw(
        new_checkbox_element, 9)
    new_radio_to_draw = Utils().checkbox_radio_to_draw(new_radio_element, 9)

    assert new_checkbox_to_draw.value == "\u2713"
    assert new_checkbox_to_draw.type == ElementType.text
    assert new_checkbox_to_draw.name == "foo"
    assert new_checkbox_to_draw.font == "Helvetica"
    assert new_checkbox_to_draw.font_size == 9
    assert new_checkbox_to_draw.font_color == (0, 0, 0)
    assert new_checkbox_to_draw.text_x_offset == 0
    assert new_checkbox_to_draw.text_y_offset == 0
    assert new_checkbox_to_draw.text_wrap_length == 100

    assert new_radio_to_draw.value == "\u25CF"
    assert new_radio_to_draw.type == ElementType.text
    assert new_radio_to_draw.name == "bar"
    assert new_radio_to_draw.font == "Helvetica"
    assert new_radio_to_draw.font_size == 9
    assert new_radio_to_draw.font_color == (0, 0, 0)
    assert new_radio_to_draw.text_x_offset == 0
    assert new_radio_to_draw.text_y_offset == 0
    assert new_radio_to_draw.text_wrap_length == 100
Beispiel #3
0
def text_element():
    new_element = ElementMiddleware("new", ElementType.text)
    new_element.value = "drawn_text"
    new_element.font = TextConstants().global_font
    new_element.font_size = TextConstants().global_font_size
    new_element.font_color = TextConstants().global_font_color
    new_element.text_x_offset = TextConstants().global_text_x_offset
    new_element.text_y_offset = TextConstants().global_text_y_offset
    new_element.text_wrap_length = TextConstants().global_text_wrap_length
    new_element.validate_constants()
    new_element.validate_value()
    new_element.validate_text_attributes()

    return new_element
def radiobutton_element():
    return Element("foo", ElementType.radio)
def checkbox_element():
    return Element("foo", ElementType.checkbox)
def text_element():
    return Element("foo", ElementType.text)