Esempio n. 1
0
def test_update_layout(layout):
    el = ['text', {'markup': 'hello world', 'wrap': 'space'}]
    el2 = ['text', {'markup': 'world updated', 'align': 'left', 'wrap': 'any'}]
    assert patch_layout(el, el2) == [
        # ('set_align_mode', 'left'), // ignore default
        ('set_text', 'world updated'),
        ('set_wrap_mode', 'any'),
    ]
Esempio n. 2
0
def test_update_layout_no_change(layout):
    el = [
        'text',
        {
            'markup': 'hello world',
        }
    ]
    el2 = deepcopy(el)
    assert patch_layout(el, el2) == []
Esempio n. 3
0
def test_patch_div():
    # call div._invalidate()
    el1 = ['div', {
        'div_char': u' ',
        'top': 0,
        'bottom': 0,
    }]
    el2 = ['div', {
        'div_char': u'-',
        'top': 1,
        'bottom': 1,
    }]
    assert patch_layout(el1, el2) == [
        ('.div_char', u'-'),
        ('.top', 1),
        ('.bottom', 1),
    ]
Esempio n. 4
0
def test_update_layout(layout):
    el = [
        'text',
        {
            'markup': 'hello world',
            'wrap': 'space'
        }
    ]
    el2 = [
        'text',
        {
            'markup': 'world updated',
            'align': 'left',
            'wrap': 'any'
        }
    ]
    assert patch_layout(el, el2) == [
        # ('set_align_mode', 'left'), // ignore default
        ('set_text', 'world updated'),
        ('set_wrap_mode', 'any'),
    ]
Esempio n. 5
0
def test_patch_div():
    # call div._invalidate()
    el1 = [
        'div',
        {
            'div_char': u' ',
            'top': 0,
            'bottom': 0,
        }
    ]
    el2 = [
        'div',
        {
            'div_char': u'-',
            'top': 1,
            'bottom': 1,
        }
    ]
    assert patch_layout(el1, el2) == [
        ('.div_char', u'-'),
        ('.top', 1),
        ('.bottom', 1),
    ]
Esempio n. 6
0
def test_update_layout_no_change(layout):
    el = ['text', {
        'markup': 'hello world',
    }]
    el2 = deepcopy(el)
    assert patch_layout(el, el2) == []