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")
Beispiel #2
0
 def test_deletion_none(self):
     selectable = self.selectable
     selectable.lines = ['one two', 'Several test words.', 'five']
     selectable.selectionMode = app.selectable.kSelectionNone
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines,
                      ['one two', 'Several test words.', 'five'])
 def test_deletion_none(self):
     selectable = self.selectable
     selectable.parser.data = u"one two\nSeveral test words.\nfive"
     selectable.parseDocument()
     selectable.selectionMode = app.selectable.kSelectionNone
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.parser.data,
                      u"one two\nSeveral test words.\nfive")
Beispiel #4
0
 def test_deletion_none(self):
     selectable = self.selectable
     selectable.lines = [u"one two", u"Several test words.", u"five"]
     selectable.parseDocument()
     selectable.selectionMode = app.selectable.kSelectionNone
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines,
                      [u"one two", u"Several test words.", u"five"])
 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")
Beispiel #6
0
 def test_deletion_character(self):
     selectable = self.selectable
     selectable.lines = ['one two', 'Several test words.', 'five']
     selectable.selectionMode = app.selectable.kSelectionCharacter
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines,
                      ['ne two', 'Several test words.', 'five'])
     selectable.markerCol = 3
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines,
                      ['ntwo', 'Several test words.', 'five'])
     selectable.penRow = 1
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines, ['ntweveral test words.', 'five'])
Beispiel #7
0
 def test_deletion_character(self):
     selectable = self.selectable
     selectable.parser.data = u"one two\nSeveral test words.\nfive"
     selectable.parseDocument()
     selectable.selectionMode = app.selectable.kSelectionCharacter
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.parser.data,
                      u"ne two\nSeveral test words.\nfive")
     selectable.markerCol = 3
     selectable.doDeleteSelection()
     self.assertEqual(selectable.parser.data,
                      u"ntwo\nSeveral test words.\nfive")
     selectable.penRow = 1
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.parser.data, u"ntweveral test words.\nfive")
Beispiel #8
0
 def test_deletion_character(self):
     selectable = self.selectable
     selectable.lines = [u"one two", u"Several test words.", u"five"]
     selectable.parseDocument()
     selectable.selectionMode = app.selectable.kSelectionCharacter
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines,
                      [u"ne two", u"Several test words.", u"five"])
     selectable.markerCol = 3
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines,
                      [u"ntwo", u"Several test words.", u"five"])
     selectable.penRow = 1
     selectable.penCol = 1
     selectable.doDeleteSelection()
     self.assertEqual(selectable.lines, [u"ntweveral test words.", u"five"])