예제 #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'),
    ]
예제 #2
0
def test_update_layout_no_change(layout):
    el = [
        'text',
        {
            'markup': 'hello world',
        }
    ]
    el2 = deepcopy(el)
    assert patch_layout(el, el2) == []
예제 #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),
    ]
예제 #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'),
    ]
예제 #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),
    ]
예제 #6
0
def test_update_layout_no_change(layout):
    el = ['text', {
        'markup': 'hello world',
    }]
    el2 = deepcopy(el)
    assert patch_layout(el, el2) == []