Example #1
0
def test_after_scroll_right(init_vstart, init_hstart, term_size, max_matrix_dim, expected):
    viewport = Viewport(init_vstart, init_hstart)
    viewport.set_term_size(*term_size)
    viewport.max_width = max_matrix_dim[1]
    viewport.max_height = max_matrix_dim[0]
    viewport.scroll_right()
    # corrected behaviour: last element should touch right screen edge, if possible!
    assert expected == (viewport.v_start, viewport.v_stop, viewport.h_start, viewport.h_stop)
Example #2
0
def test_after_scroll_right_when_not_all_space_available_to_the_right():
    viewport = Viewport()
    viewport.set_term_size(53, 176)
    viewport.max_width = 200
    viewport.max_height = 200
    viewport.scroll_right()
    assert 200 - 176 == viewport.h_start  # corrected behaviour: last element should touch right screen edge, if possible!
    assert 200 == viewport.h_stop  # (not scroll endelessly to the right)
    assert 0 == viewport.v_start
    assert 53 == viewport.v_stop
Example #3
0
def test_after_scroll_right_with_nowhere_to_go():
    viewport = Viewport(hstart=400 - 176)
    viewport.set_term_size(53, 176)
    viewport.max_width = 400
    viewport.max_height = 200
    viewport.scroll_right()
    assert 400 - 176 == viewport.h_start  # OK, shouldn't move!
    assert 400 == viewport.h_stop  # (not scroll endelessly to the right)
    assert 0 == viewport.v_start
    assert 53 == viewport.v_stop
Example #4
0
def test_after_scroll_right():
    viewport = Viewport()
    viewport.set_term_size(53, 176)
    viewport.max_width = 400
    viewport.max_height = 200
    viewport.scroll_right()
    assert 176 / 2 == viewport.h_start  # corrected behaviour: last element should touch right screen edge, if possible!
    assert 176 / 2 + 176 == viewport.h_stop  # (not scroll endelessly to the right)
    assert 0 == viewport.v_start
    assert 53 == viewport.v_stop
Example #5
0
def test_after_scroll_right_when_not_all_space_available_to_the_right():
    viewport = Viewport()
    viewport.set_term_size(53, 176)
    viewport.max_width = 200
    viewport.max_height = 200
    viewport.scroll_right()
    assert 200 - 176 == viewport.h_start  # corrected behaviour: last element should touch right screen edge, if possible!
    assert 200 == viewport.h_stop  # (not scroll endelessly to the right)
    assert 0 == viewport.v_start
    assert 53 == viewport.v_stop
Example #6
0
def test_after_scroll_right_with_nowhere_to_go():
    viewport = Viewport(hstart=400 - 176)
    viewport.set_term_size(53, 176)
    viewport.max_width = 400
    viewport.max_height = 200
    viewport.scroll_right()
    assert 400 - 176 == viewport.h_start  # OK, shouldn't move!
    assert 400 == viewport.h_stop  # (not scroll endelessly to the right)
    assert 0 == viewport.v_start
    assert 53 == viewport.v_stop
Example #7
0
def test_after_scroll_right():
    viewport = Viewport()
    viewport.set_term_size(53, 176)
    viewport.max_width = 400
    viewport.max_height = 200
    viewport.scroll_right()
    assert 176 / 2 == viewport.h_start  # corrected behaviour: last element should touch right screen edge, if possible!
    assert 176 / 2 + 176 == viewport.h_stop  # (not scroll endelessly to the right)
    assert 0 == viewport.v_start
    assert 53 == viewport.v_stop
Example #8
0
def test_after_scroll_right(init_vstart, init_hstart, term_size,
                            max_matrix_dim, expected):
    viewport = Viewport(init_vstart, init_hstart)
    viewport.set_term_size(*term_size)
    viewport.max_width = max_matrix_dim[1]
    viewport.max_height = max_matrix_dim[0]
    viewport.scroll_right()
    # corrected behaviour: last element should touch right screen edge, if possible!
    assert expected == (viewport.v_start, viewport.v_stop, viewport.h_start,
                        viewport.h_stop)