def test_offset_calculator(): """ Test the pic parser with the example supplied in issue #14 ( https://github.com/OpenCobolIDE/OpenCobolIDE/issues/14) and ensure the offset of the last element is 75. """ fi = get_field_infos(source) assert fi[-1].offset == 75
def _computeOffsets(self): original_tc = self.editor.textCursor() tc = self.editor.textCursor() assert isinstance(tc, QTextCursor) start = tc.selectionStart() end = tc.selectionEnd() tc.setPosition(start) start_line = tc.blockNumber() + 1 tc.setPosition(end) end_line = tc.blockNumber() + 1 self.editor.selectFullLines(start_line, end_line, True) source = self.editor.selectedText() self.picInfosAvailable.emit(get_field_infos(source)) self.editor.setTextCursor(original_tc)