本文整理汇总了Python中pyqode.qt.QtTest.QTest类的典型用法代码示例。如果您正苦于以下问题:Python QTest类的具体用法?Python QTest怎么用?Python QTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_json_code_edit
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
示例2: test_line_nbr_from_position
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)
示例3: test_json_code_edit
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
示例4: editor
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_add_marker
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
示例6: test_request_search
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: test_goto_definition
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
示例8: editor
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
示例9: test_selected_text
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'
示例10: reject_mbox
def reject_mbox():
print('reject')
widgets = QtWidgets.QApplication.instance().topLevelWidgets()
for w in widgets:
print(w)
if isinstance(w, QtWidgets.QDialog):
QTest.keyPress(w, QtCore.Qt.Key_Escape)
示例11: test_style
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)
示例12: test_mouse_press
def test_mouse_press(editor):
panel = get_panel(editor)
y_pos = TextHelper(editor).line_pos_from_number(0)
QTest.mousePress(panel, QtCore.Qt.RightButton, QtCore.Qt.NoModifier,
QtCore.QPoint(1000, 1000))
QTest.mousePress(panel, QtCore.Qt.RightButton, QtCore.Qt.NoModifier,
QtCore.QPoint(3, y_pos))
示例13: editor
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
示例14: test_select_lines
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
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()