本文整理汇总了Python中pyqode.qt.QtTest.QTest.qWait方法的典型用法代码示例。如果您正苦于以下问题:Python QTest.qWait方法的具体用法?Python QTest.qWait怎么用?Python QTest.qWait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqode.qt.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.qWait方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_selected_text
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_selected_text(editor):
helper = TextHelper(editor)
helper.goto_line(2, 1, move=True)
QTest.qWait(100)
assert helper.word_under_cursor().selectedText() == 'T'
assert helper.word_under_cursor(
select_whole_word=True).selectedText() == 'This'
示例2: test_json_code_edit
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_json_code_edit():
editor = JSONCodeEdit()
editor.file.open('test/files/example.json')
QTest.qWait(1000)
assert editor.backend.running
editor.close()
assert not editor.backend.running
示例3: test_add_marker
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_add_marker(editor):
panel = get_panel(editor)
marker = panels.Marker(1, icon=':/pyqode-icons/rc/edit-undo.png',
description='Marker description')
panel.add_marker(marker)
QTest.qWait(500)
assert panel.marker_for_line(1)[0] is not None
示例4: editor
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def editor(request):
import gettext
gettext.NullTranslations().install()
global _app, _widget
from pyqode.core import modes
from pyqode.cobol.widgets import CobolCodeEdit
from pyqode.qt.QtTest import QTest
logging.info('################ setup session editor ################')
_widget = CobolCodeEdit()
_widget.resize(800, 600)
_widget.show()
_app.setActiveWindow(_widget)
while not _widget.backend.connected:
QTest.qWait(100)
_widget.modes.get(modes.FileWatcherMode).file_watcher_auto_reload = True
_widget.save_on_focus_out = False
def fin():
global _widget
logging.info('################ teardown session editor ###############'
'#')
_widget.backend.stop()
while _widget.backend.connected:
QTest.qWait(100)
del _widget
request.addfinalizer(fin)
return _widget
示例5: test_key_pressed
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_key_pressed():
# " -> ""
editor = CodeEdit()
editor.modes.append(modes.AutoCompleteMode())
editor.setPlainText('', '', 'utf-8')
QTest.keyPress(editor, '"')
assert editor.toPlainText() == '""'
editor.clear()
# if a " already exists, cursor should just move after " and a new " should
# not be inserted
editor.setPlainText('"', 'text/x-python', 'utf-8')
TextHelper(editor).goto_line(0, 0)
QTest.keyPress(editor, '"')
assert editor.toPlainText() == '"'
editor.clear()
# if a ) already exists, cursor should just move after ) and a new ) should
# not be inserted
editor.setPlainText(')', 'text/x-python', 'utf-8')
TextHelper(editor).goto_line(0, 0)
QTest.keyPress(editor, ')')
QTest.qWait(1000)
assert editor.toPlainText() == ')'
# ] should be inserted ")" -> "])"
TextHelper(editor).goto_line(0, 0)
QTest.keyPress(editor, ']')
QTest.qWait(1000)
assert editor.toPlainText() == '])'
示例6: test_request_search
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_request_search(editor):
QTest.qWait(1000)
assert editor.backend.running
panel = get_panel(editor)
panel.request_search('import')
QTest.qWait(2000)
assert panel.cpt_occurences > 1
示例7: toggle_fold_trigger
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def toggle_fold_trigger(editor, line, panel):
y_pos = TextHelper(editor).line_pos_from_number(line) + 5
QTest.mouseMove(panel, QtCore.QPoint(3, y_pos))
QTest.qWait(1000)
QTest.mousePress(panel, QtCore.Qt.RightButton, QtCore.Qt.NoModifier,
QtCore.QPoint(3, y_pos))
QTest.qWait(1000)
示例8: test_goto_definition
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_goto_definition(editor):
editor.show()
QTest.qWait(1000)
panel = get_panel(editor)
line = TextHelper(editor).current_line_nbr()
panel._on_definition_activated(len(panel._definitions) - 2)
assert TextHelper(editor).current_line_nbr() != line
示例9: editor
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def editor(request):
global _app, _widget
from pyqode.core import modes, cache
from pyqode.python.widgets.code_edit import PyCodeEdit
from pyqode.python.panels import SymbolBrowserPanel
from pyqode.qt.QtTest import QTest
cache.Cache().clear()
_widget = PyCodeEdit()
_widget.panels.append(SymbolBrowserPanel(),
SymbolBrowserPanel.Position.TOP)
_widget.resize(800, 600)
while not _widget.backend.connected:
QTest.qWait(100)
_widget.modes.get(modes.FileWatcherMode).file_watcher_auto_reload = True
_widget.save_on_focus_out = False
def fin():
global _widget
_widget.close()
del _widget
request.addfinalizer(fin)
return _widget
示例10: test_line_nbr_from_position
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_line_nbr_from_position(editor):
editor.repaint()
sys.stderr.write(str(editor.visible_blocks))
assert TextHelper(editor).line_nbr_from_position(
TextHelper(editor).line_pos_from_number(0)) is not None
assert TextHelper(editor).line_nbr_from_position(-1) == 0
QTest.qWait(100)
示例11: test_json_code_edit
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_json_code_edit():
editor = RstCodeEdit()
editor.file.open('test/files/demo_ko.rst')
QTest.qWait(1000)
assert editor.backend.running
editor.close()
assert not editor.backend.running
示例12: editor
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def editor(request):
global _app, _widget
from pyqode.core import modes
from pyqode.rst.widgets import RstCodeEdit
from pyqode.qt.QtTest import QTest
logging.info('################ setup session editor ################')
_widget = RstCodeEdit()
_widget.resize(800, 600)
_app.setActiveWindow(_widget)
while not _widget.backend.connected:
QTest.qWait(100)
_widget.modes.get(modes.FileWatcherMode).file_watcher_auto_reload = True
_widget.save_on_focus_out = False
def fin():
global _widget
_widget.close()
while _widget.backend.connected:
QTest.qWait(100)
del _widget
request.addfinalizer(fin)
return _widget
示例13: test_style
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_style(editor):
panel = get_panel(editor)
panel.request_search('import')
QTest.qWait(1000)
panel.background = QtGui.QColor('green')
panel.foreground = QtGui.QColor('red')
QTest.qWait(1000)
示例14: test_select_lines
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_select_lines(editor):
TextHelper(editor).select_lines(0, 4)
QTest.qWait(100)
QTest.qWait(1000)
assert TextHelper(editor).selection_range() == (0, 4)
TextHelper(editor).select_lines(-1, 10)
assert TextHelper(editor).selection_range() == (0, 10)
editor.decorations.clear()
示例15: test_close
# 需要导入模块: from pyqode.qt.QtTest import QTest [as 别名]
# 或者: from pyqode.qt.QtTest.QTest import qWait [as 别名]
def test_close(editor):
panel = get_panel(editor)
panel.on_actionSearch_triggered()
assert panel.isVisible()
panel.on_toolButtonClose_clicked()
assert not panel.isVisible()
QTest.qWait(100)
panel.on_actionSearch_triggered()