def test_deletion_all(self):
        selectable = self.selectable

        def apply_selection(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.parse_document()
        self.assertEqual(selectable.selection(), (0, 0, 0, 0))
        selectable.selectionMode = app.selectable.kSelectionAll
        self.assertEqual(selectable.extend_selection(), (2, 4, 0, 0, 0))
        selectable.penCol = 3
        self.assertEqual(selectable.extend_selection(), (2, 1, 0, 0, 0))

        apply_selection(selectable.extend_selection())
        self.assertEqual(selectable.selection(), (2, 4, 0, 0))
        selectable.do_delete_selection()
        self.assertEqual(selectable.parser.data, u"")

        selectable.insert_lines_at(0, 0, (u"wx", u"", u"yz"),
                                   app.selectable.kSelectionAll)
        self.assertEqual(selectable.parser.data, u"wx\n\nyz")
 def test_selection_character(self):
     selectable = self.selectable
     selectable.parser.data = u"oneTwo\n\nfive"
     selectable.parse_document()
     selectable.selectionMode = app.selectable.kSelectionCharacter
     self.assertEqual(selectable.extend_selection(), (0, 0, 0, 0, 0))
     selectable.penCol = 3
     self.assertEqual(selectable.extend_selection(), (0, 0, 0, 0, 0))
 def test_selection_all(self):
     selectable = self.selectable
     selectable.parser.data = u"oneTwo\n\nfive"
     selectable.parse_document()
     selectable.selectionMode = app.selectable.kSelectionAll
     self.assertEqual(selectable.extend_selection(), (2, 4, 0, 0, 0))
     selectable.penCol = 3
     self.assertEqual(selectable.extend_selection(), (2, 1, 0, 0, 0))
 def test_selection_word(self):
     selectable = self.selectable
     selectable.parser.data = u"one two\nSeveral test words\nfive"
     selectable.parse_document()
     selectable.selectionMode = app.selectable.kSelectionWord
     selectable.penRow = 1
     selectable.penCol = 2
     self.assertEqual(selectable.extend_selection(), (0, 5, 0, 0, 0))
     selectable.penRow = 1
     selectable.penCol = 9
     selectable.markerCol = 2
     self.assertEqual(selectable.extend_selection(), (0, 3, 0, -2, 0))
 def test_selection_line(self):
     selectable = self.selectable
     selectable.parser.data = u"one two\n\nfive"
     selectable.parse_document()
     selectable.penRow = 1
     selectable.selectionMode = app.selectable.kSelectionLine
     app.log.debug(u"selectable.extend_selection",
                   selectable.extend_selection())
     self.assertEqual(selectable.extend_selection(), (0, 0, 0, 0, 0))
     selectable.penRow = 3
     selectable.penCol = 3
     selectable.markerRow = 1
     selectable.markerCol = 4
     self.assertEqual(selectable.extend_selection(), (0, -3, 0, -4, 0))
 def test_deletion_block(self):
     selectable = self.selectable
     selectable.parser.data = u"oneTwo\n\nfive"
     selectable.parse_document()
     selectable.selectionMode = app.selectable.kSelectionBlock
     self.assertEqual(selectable.extend_selection(), (0, 0, 0, 0, 0))
     selectable.markerRow = 0
     selectable.markerCol = 1
     selectable.penRow = 2
     selectable.penCol = 3
     self.assertEqual(selectable.extend_selection(), (0, 0, 0, 0, 0))
     self.assertEqual(selectable.parser.data, u"oneTwo\n\nfive")
     selectable.do_delete_selection()
     self.assertEqual(selectable.parser.data, u"oTwo\n\nfe")
     selectable.insert_lines_at(0, 1, (u"wx", u"", u"yz"),
                                app.selectable.kSelectionBlock)
     self.assertEqual(selectable.parser.data, u"owxTwo\n\nfyze")