<s> from pyqode . qt import QtCore , QtGui <EOL> from pyqode . qt . QtTest import QTest <EOL> from pyqode . core . api import TextHelper <EOL> from pyqode . core import modes <EOL> from test . helpers import editor_open <EOL> def get_mode ( editor ) : <EOL> return editor . modes . get ( modes . ExtendedSelectionMode ) <EOL> def test_enabled ( editor ) : <EOL> mode = get_mode ( editor ) <EOL> assert mode . enabled <EOL> mode . enabled = False <EOL> mode . enabled = True <EOL> @ editor_open ( __file__ ) <EOL> def test_extended_selection ( editor ) : <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> mode = get_mode ( editor ) <EOL> TextHelper ( editor ) . goto_line ( <NUM_LIT:0> , <NUM_LIT:10> ) <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> try : <EOL> event = QtGui . QMouseEvent ( QtCore . QEvent . MouseButtonDblClick , <EOL> QtCore . QPointF ( <NUM_LIT:0> , <NUM_LIT:0> ) , QtCore . Qt . LeftButton , <EOL> QtCore . Qt . LeftButton , <EOL> QtCore . Qt . ControlModifier ) <EOL> except TypeError : <EOL> event = QtGui . QMouseEvent ( QtCore . QEvent . MouseButtonDblClick , <EOL> QtCore . QPoint ( <NUM_LIT:0> , <NUM_LIT:0> ) , QtCore . Qt . LeftButton , <EOL> QtCore . Qt . LeftButton , <EOL> QtCore . Qt . ControlModifier ) <EOL> mode . _on_double_click ( event ) <EOL> assert editor . textCursor ( ) . selectedText ( ) == '<STR_LIT>' <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> @ editor_open ( __file__ ) <EOL> def test_matched_selection ( editor ) : <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> mode = get_mode ( editor ) <EOL> TextHelper ( editor ) . goto_line ( <NUM_LIT:8> , <NUM_LIT> ) <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> try : <EOL> event = QtGui . QMouseEvent ( QtCore . QEvent . MouseButtonDblClick , <EOL> QtCore . QPointF ( <NUM_LIT:0> , <NUM_LIT:0> ) , QtCore . Qt . LeftButton , <EOL> QtCore . Qt . LeftButton , <EOL> QtCore . Qt . AltModifier ) <EOL> except TypeError : <EOL> event = QtGui . QMouseEvent ( QtCore . QEvent . MouseButtonDblClick , <EOL> QtCore . QPoint ( <NUM_LIT:0> , <NUM_LIT:0> ) , QtCore . Qt . LeftButton , <EOL> QtCore . Qt . LeftButton , <EOL> QtCore . Qt . AltModifier ) <EOL> mode . _on_double_click ( event ) <EOL> assert editor . textCursor ( ) . selectedText ( ) == '<STR_LIT>' <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> @ editor_open ( __file__ ) <EOL> def test_word_selection ( editor ) : <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> mode = get_mode ( editor ) <EOL> TextHelper ( editor ) . goto_line ( <NUM_LIT:8> , <NUM_LIT> ) <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> try : <EOL> event = QtGui . QMouseEvent ( QtCore . QEvent . MouseButtonDblClick , <EOL> QtCore . QPointF ( <NUM_LIT:0> , <NUM_LIT:0> ) , QtCore . Qt . LeftButton , <EOL> QtCore . Qt . LeftButton , QtCore . Qt . NoModifier ) <EOL> except TypeError : <EOL> event = QtGui . QMouseEvent ( QtCore . QEvent . MouseButtonDblClick , <EOL> QtCore . QPoint ( <NUM_LIT:0> , <NUM_LIT:0> ) , QtCore . Qt . LeftButton , <EOL> QtCore . Qt . LeftButton , QtCore . Qt . NoModifier ) <EOL> mode . _on_double_click ( event ) <EOL> assert editor . textCursor ( ) . selectedText ( ) == '<STR_LIT>' <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> @ editor_open ( __file__ ) <EOL> def test_line_selection ( editor ) : <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> mode = get_mode ( editor ) <EOL> TextHelper ( editor ) . goto_line ( <NUM_LIT:0> , <NUM_LIT:2> ) <EOL> QTest . qWait ( <NUM_LIT:1000> ) <EOL> mode . perform_line_selection ( ) <EOL> assert editor . textCursor ( ) . selectedText ( ) == '<STR_LIT>' <EOL> QTest . qWait ( <NUM_LIT:1000> ) </s>
