def test_actions_gui(qtbot, gui, actions):
    qtbot.addWidget(gui)
    gui.show()
    qtbot.waitForWindowShown(gui)

    _press = []

    @actions.add(shortcut='g')
    def press():
        _press.append(0)

    actions.press()
    assert _press == [0]

    # Show action shortcuts.
    with captured_output() as (stdout, stderr):
        actions.show_shortcuts()
    assert 'g\n' in stdout.getvalue()

    # Show default action shortcuts.
    with captured_output() as (stdout, stderr):
        gui.default_actions.show_shortcuts()
    assert 'q\n' in stdout.getvalue()

    # Show all action shortcuts.
    with captured_output() as (stdout, stderr):
        gui.default_actions.show_all_shortcuts()
    assert 'g\n' in stdout.getvalue()
Exemple #2
0
def test_actions_gui(qtbot, gui, actions):
    qtbot.addWidget(gui)
    gui.show()
    qtbot.waitForWindowShown(gui)

    _press = []

    @actions.add(shortcut='g')
    def press():
        _press.append(0)

    actions.press()
    assert _press == [0]

    # Show action shortcuts.
    with captured_output() as (stdout, stderr):
        actions.show_shortcuts()
    assert 'g\n' in stdout.getvalue()

    # Show default action shortcuts.
    with captured_output() as (stdout, stderr):
        gui.default_actions.show_shortcuts()
    assert 'q\n' in stdout.getvalue()

    # Show all action shortcuts.
    with captured_output() as (stdout, stderr):
        gui.default_actions.show_all_shortcuts()
    assert 'g\n' in stdout.getvalue()
def test_show_shortcuts(qapp):
    # NOTE: a Qt application needs to be running so that we can use the
    # KeySequence.
    shortcuts = {
        'test_1': 'ctrl+t',
        'test_2': ('ctrl+a', 'shift+b'),
        'test_3': 'ctrl+z',
    }
    with captured_output() as (stdout, stderr):
        _show_shortcuts(shortcuts, 'test')
    assert 'ctrl+a, shift+b' in stdout.getvalue()
    assert 'ctrl+z' in stdout.getvalue()
Exemple #4
0
def test_show_shortcuts(qapp):
    # NOTE: a Qt application needs to be running so that we can use the
    # KeySequence.
    shortcuts = {
        'test_1': 'ctrl+t',
        'test_2': ('ctrl+a', 'shift+b'),
        'test_3': 'ctrl+z',
    }
    with captured_output() as (stdout, stderr):
        _show_shortcuts(shortcuts, 'test')
    assert 'ctrl+a, shift+b' in stdout.getvalue()
    assert 'ctrl+z' in stdout.getvalue()
 def show_my_shortcuts():
     with captured_output() as (stdout, stderr):
         actions.show_shortcuts()
     _captured.append(stdout.getvalue())
Exemple #6
0
 def show_my_shortcuts():
     with captured_output() as (stdout, stderr):
         actions.show_shortcuts()
     _captured.append(stdout.getvalue())