Beispiel #1
0
def test_watch_selected_with_mirroring(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1], Mock())

    eq_(True, watch.panes[0].selected)
    eq_((watch.panes[0], cmd1), watch.selected)

    rolex.cmd_mirror_command(watch, Mock())

    watch.panes[0].selected = False
    watch.panes[1].selected = True
    eq_((watch.panes[1], cmd1), watch.selected)
Beispiel #2
0
def test_watch_selected_and_mirrors(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    cmd2 = Command('test2', 2, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1, cmd2], Mock())

    eq_(True, watch.panes[0].selected)
    eq_([(watch.panes[0], cmd1)], list(watch.selected_and_mirrors))

    rolex.cmd_mirror_command(watch, Mock())

    eq_(True, watch.panes[0].selected)
    eq_([(watch.panes[0], cmd1),
         (watch.panes[2], cmd1)], list(watch.selected_and_mirrors))
Beispiel #3
0
def test_watch_remove_pane_mirrored(curses_mock):
    cmd1 = Command('test1', 1, Mock())
    watch = Watch(Mock(height=20, width=80), Mock(), [cmd1], Mock())
    rolex.cmd_mirror_command(watch, Mock())

    eq_(2, len(watch.panes))
    eq_(2, len(watch.pane_map))
    eq_(1, len(watch.commands))
    eq_(True, 0 in watch.pane_map)
    eq_(True, 1 in watch.pane_map)
    eq_(False, watch.panes[1].selected)
    eq_(cmd1, watch.pane_map[1])

    watch.remove_pane(watch.panes[0])

    eq_(1, len(watch.panes))
    eq_(1, len(watch.pane_map))
    eq_(1, len(watch.commands))
    eq_(True, 0 in watch.pane_map)
    eq_(False, 1 in watch.pane_map)
    eq_(cmd1, watch.pane_map[0])
    eq_(True, watch.panes[0].selected)