Пример #1
0
 def test_scintillawrapper_int_int_int(self):
     editor.write('line 1\r\nline 2\r\nline 3\r\nline 4\r\n')
     handle = editor.markerAdd(2, 1)
     self.assertNotEqual(handle, -1)  # markerAdd() returns -1 if the line number is invalid or out of memory
     editor.insertText(0, 'inserted line 1\r\n')
     newLineNumber = editor.markerLineFromHandle(handle)
     self.assertEqual(newLineNumber, 3)
Пример #2
0
    def test_scintillawrapper_void_int_int(self):
        editor.write('One\r\nTwo\r\nThree\r\nFour')
        editor.markerAddSet(2, 0x11) # marker 4 (0x10) and 0 (0x01) on line 2
        markersBeforeMove = editor.markerGet(2)
        editor.insertText(0, 'Inserted\r\n')
        markersAfterMove = editor.markerGet(2)
        markersAfterMoveLine3 = editor.markerGet(3)

        self.assertEqual(markersBeforeMove, 0x11)
        self.assertEqual(markersAfterMove, 0)
        self.assertEqual(markersAfterMoveLine3, 0x11)
Пример #3
0
    def test_scintillawrapper_int_int_void(self):
        editor.write('One\r\nTwo\r\nThree\r\nFour')

        handle = editor.markerAdd(3, 4)  # Add marker 4 at line 3

        beforeMoveMarker = editor.markerGet(3)
        editor.insertText(0, 'Add a line\r\n')
        afterMove3 = editor.markerGet(3)
        afterMove4 = editor.markerGet(4)
        lineNumber = editor.markerLineFromHandle(handle)

        self.assertEqual(beforeMoveMarker & 0x10, 0x10)  # marker 4 is 0x10, and there could be other markers on the line
        self.assertEqual(afterMove3 & 0x10, 0)           # after the insert, line 3 should not contain the marker
        self.assertEqual(afterMove4 & 0x10, 0x10)        # it should be on line 4
        self.assertEqual(lineNumber, 4)                  # The lineNumber obtained from the handle, should also be 4
Пример #4
0
 def onAutocomplete(self, args):
     '''Check if auto complete data can be added and displayed:
     "." after objects: show auto completion list with properties and methods
     "[" after dict: show auto completion list with keys
     "(" after functions: insert template and display a call tip with the doc string.'''
     if args['ch'] == 46 and args['code'] == 2001:  # character "."
         iPos = editor.getCurrentPos()
         autoCompleteList = self.interp.autoCompleteObject(
             self.getUncompleteLine(iPos))
         if autoCompleteList is None: return
         if autoCompleteList:
             editor.autoCSetSeparator(ord('\t'))
             editor.autoCSetIgnoreCase(False)
             editor.autoCSetCaseInsensitiveBehaviour(False)
             editor.autoCSetOrder(2)
             editor.autoCSetDropRestOfWord(True)
             editor.autoCShow(0, autoCompleteList)
     elif args['ch'] == 40 and args['code'] == 2001:  # character "("
         iPos = editor.getCurrentPos()
         r = self.interp.autoCompleteFunction(self.getUncompleteLine(iPos))
         if r is None: return
         n, funcParam, callTip = r
         if callTip:
             editor.callTipShow(max(0, iPos - n), callTip)
             editor.callTipSetHlt(0, max(0, callTip.find('\n')))
             self.activeCalltip = 'doc'
         if funcParam and iPos == editor.getCurrentPos():
             editor.insertText(iPos, funcParam + ')')
             editor.setSelectionStart(iPos)
             editor.setSelectionStart(iPos + len(funcParam) + 1)
             editor.setCurrentPos(iPos)
     elif args['ch'] == 91 and args['code'] == 2001:  # character "["
         iPos = editor.getCurrentPos()
         autoCompleteList = self.interp.autoCompleteDict(
             self.getUncompleteLine(iPos))
         if autoCompleteList:
             editor.autoCSetSeparator(ord('\t'))
             editor.autoCSetIgnoreCase(False)
             editor.autoCSetCaseInsensitiveBehaviour(False)
             editor.autoCSetOrder(0)
             editor.autoCSetDropRestOfWord(True)
             editor.autoCShow(0, autoCompleteList)
Пример #5
0
 def callback_scintillawrapper_void_position_string(self, args):
     editor.write('ABCDEF')
     editor.insertText(3, 'GHI')
     content = editor.getText()
     self.assertEquals('ABCGHIDEF', content)
     self.callbackCalled = True
Пример #6
0
 def test_scintillawrapper_void_position_string(self):
     editor.write('ABCDEF')
     editor.insertText(3, 'GHI')
     content = editor.getText()
     self.assertEquals('ABCGHIDEF', content)