def test_scintillawrapper_int_void_textrange(self): notepad.setLangType(LANGTYPE.XML) editor.write('<test attrib="unit" />') time.sleep(0.1) # let the lexer do it's thang. The getStyledText appears to fail occassionally, returns a bunch of zeroes for the styles # I'm assuming it's a timing bug, as it "normally" works. Added the sleep to see if it makes a difference. result = editor.getStyledText(0, 19) self.assertEqual(('<test attrib="unit"', [1, 1, 1, 1, 1, 8, 3, 3, 3, 3, 3, 3, 8, 6, 6, 6, 6, 6, 6]), result)
def callback_scintillawrapper_int_void_textrange(self, args): result = editor.getStyledText(0, 19) self.assertEqual( ('<test attrib="unit"', [1, 1, 1, 1, 1, 8, 3, 3, 3, 3, 3, 3, 8, 6, 6, 6, 6, 6, 6]), result) self.callbackCalled = True
def test_scintillawrapper_void_position_int(self): editor.setText('Hello world') editor.setLexer(LEXER.CONTAINER) editor.startStyling(0, 31) editor.setStyling(5, 29) styledText = editor.getStyledText(0, 5) editor.setLexer(LEXER.NULL) self.assertEqual(styledText, ('Hello', [29, 29, 29, 29, 29]))
def callback_scintillawrapper_void_int_cells(self, args): notepad.setLangType(LANGTYPE.TXT) editor.addStyledText(Cell('Test', [1,2,3,4])) result = editor.getStyledText(0, 4) self.assertEqual(result, ('Test',[1,2,3,4])) self.callbackCalled = True