def test_deletion_all(self): selectable = self.selectable def applySelection(args): selectable.penRow += args[0] selectable.penCol += args[1] selectable.markerRow += args[2] selectable.markerCol += args[3] selectable.selectionMode += args[4] self.assertEqual(selectable.selection(), (0, 0, 0, 0)) selectable.parser.data = u"oneTwo\n\nfive" selectable.parseDocument() self.assertEqual(selectable.selection(), (0, 0, 0, 0)) selectable.selectionMode = app.selectable.kSelectionAll self.assertEqual(selectable.extendSelection(), (2, 4, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (2, 1, 0, 0, 0)) applySelection(selectable.extendSelection()) self.assertEqual(selectable.selection(), (2, 4, 0, 0)) selectable.doDeleteSelection() self.assertEqual(selectable.parser.data, u"") selectable.insertLinesAt(0, 0, (u"wx", u"", u"yz"), app.selectable.kSelectionAll) self.assertEqual(selectable.parser.data, u"wx\n\nyz")
def test_selection_all(self): selectable = self.selectable selectable.lines = ['oneTwo', '', 'five'] selectable.selectionMode = app.selectable.kSelectionAll self.assertEqual(selectable.extendSelection(), (2, 4, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (2, 1, 0, 0, 0))
def test_selection_character(self): selectable = self.selectable selectable.lines = ['oneTwo', '', 'five'] selectable.selectionMode = app.selectable.kSelectionCharacter self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0))
def test_deletion_block(self): selectable = self.selectable selectable.lines = ['oneTwo', '', 'five'] selectable.selectionMode = app.selectable.kSelectionBlock self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0))
def test_selection_character(self): selectable = self.selectable selectable.parser.data = u"oneTwo\n\nfive" selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionCharacter self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0))
def test_selection_all(self): selectable = self.selectable selectable.parser.data = u"oneTwo\n\nfive" selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionAll self.assertEqual(selectable.extendSelection(), (2, 4, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (2, 1, 0, 0, 0))
def test_selection_character(self): selectable = self.selectable selectable.lines = [u"oneTwo", u"", u"five"] selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionCharacter self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0))
def test_selection_all(self): selectable = self.selectable selectable.lines = [u"oneTwo", u"", u"five"] selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionAll self.assertEqual(selectable.extendSelection(), (2, 4, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (2, 1, 0, 0, 0))
def test_deletion_block(self): selectable = self.selectable selectable.lines = [u"oneTwo", u"", u"five"] selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionBlock self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0))
def test_selection_word(self): selectable = self.selectable selectable.lines = ['one two', 'Several test words.', 'five'] selectable.selectionMode = app.selectable.kSelectionWord selectable.penRow = 1 selectable.penCol = 2 self.assertEqual(selectable.extendSelection(), (0, 5, 0, 0, 0)) selectable.penRow = 1 selectable.penCol = 9 selectable.markerCol = 2 self.assertEqual(selectable.extendSelection(), (0, 3, 0, -2, 0))
def test_selection_word(self): selectable = self.selectable selectable.parser.data = u"one two\nSeveral test words\nfive" selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionWord selectable.penRow = 1 selectable.penCol = 2 self.assertEqual(selectable.extendSelection(), (0, 5, 0, 0, 0)) selectable.penRow = 1 selectable.penCol = 9 selectable.markerCol = 2 self.assertEqual(selectable.extendSelection(), (0, 3, 0, -2, 0))
def test_deletion_word(self): selectable = self.selectable selectable.lines = [u"one two", u"Several test words.", u"five"] selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionWord selectable.penRow = 1 selectable.penCol = 2 self.assertEqual(selectable.extendSelection(), (0, 5, 0, 0, 0)) selectable.penRow = 1 selectable.penCol = 9 selectable.markerCol = 2 self.assertEqual(selectable.extendSelection(), (0, 3, 0, -2, 0))
def test_selection_line(self): selectable = self.selectable selectable.lines = ['one two', '', 'five'] selectable.penRow = 1 selectable.selectionMode = app.selectable.kSelectionLine app.log.debug('selectable.extendSelection', selectable.extendSelection()) self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.penRow = 3 selectable.penCol = 3 selectable.markerRow = 1 selectable.markerCol = 4 self.assertEqual(selectable.extendSelection(), (0, -3, 0, -4, 0))
def test_selection_line(self): selectable = self.selectable selectable.parser.data = u"one two\n\nfive" selectable.parseDocument() selectable.penRow = 1 selectable.selectionMode = app.selectable.kSelectionLine app.log.debug(u"selectable.extendSelection", selectable.extendSelection()) self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.penRow = 3 selectable.penCol = 3 selectable.markerRow = 1 selectable.markerCol = 4 self.assertEqual(selectable.extendSelection(), (0, -3, 0, -4, 0))
def test_deletion_block(self): selectable = self.selectable selectable.parser.data = u"oneTwo\n\nfive" selectable.parseDocument() selectable.selectionMode = app.selectable.kSelectionBlock self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) selectable.markerRow = 0 selectable.markerCol = 1 selectable.penRow = 2 selectable.penCol = 3 self.assertEqual(selectable.extendSelection(), (0, 0, 0, 0, 0)) self.assertEqual(selectable.parser.data, u"oneTwo\n\nfive") selectable.doDeleteSelection() self.assertEqual(selectable.parser.data, u"oTwo\n\nfe") selectable.insertLinesAt(0, 1, (u"wx", u"", u"yz"), app.selectable.kSelectionBlock) self.assertEqual(selectable.parser.data, u"owxTwo\n\nfyze")