Пример #1
0
def test_modif_without_focus(editor):
    mode = get_mode(editor)
    mode.auto_reload = False
    win = QtWidgets.QMainWindow()
    win.show()
    QTest.qWaitForWindowActive(win)
    with open(file_path, 'r') as f:
        with open(file_path, 'w') as f2:
            f2.write("test file %s" % datetime.datetime.now())
    QtCore.QTimer.singleShot(1500, accept_mbox)
    # wait for the filewatcher to detect the changed
    QTest.qWait(500)
    QtWidgets.QApplication.instance().setActiveWindow(editor)
    # wait for the message box to appear
    QTest.qWait(500)
Пример #2
0
def test_margin_size(editor):
    for panel in editor.panels:
        panel.enabled = False
        panel.hide()

    # we really need to show the window here to get correct margin size.
    editor.show()
    QTest.qWaitForWindowActive(editor)
    for position in Panel.Position.iterable():
        # there is no panel on this widget, all margin must be 0
        assert editor.panels.margin_size(position) == 0
    panel = panels.LineNumberPanel()
    editor.panels.append(panel, position=panel.Position.LEFT)
    panel.setVisible(True)
    QTest.qWait(300)
    # as the window is not visible, we need to refresh panels manually
    assert editor.panels.margin_size(Panel.Position.LEFT) != 0
    for panel in editor.panels:
        panel.enabled = True