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