def run(self, sp): if self.name == "NEW": return u.new() elif self.name == "LOAD": return u.load() if self.args: sp.cmd(self.name, chr(self.args[0])) else: sp.cmd(self.name) return sp
def run(self, sp): if self.name == "NEW": return u.new() elif self.name == "LOAD": return u.load() if self.args: sp.cmd(self.name, chr(self.args[0])) else: sp.cmd(self.name) return sp
def testPasteAfterForcedLineBreak(): sp = u.new() sp.cmd("addChar", char="E") assert sp.lines[0].lt != scr.CHARACTER sp.cmd("insertForcedLineBreak") sp.paste([scr.Line(text="Tsashkataar", lt=scr.CHARACTER)]) assert len(sp.lines) == 2 assert (sp.line == 1) and (sp.column == 11) assert sp.lines[0].text == "E" assert sp.lines[0].lt == scr.SCENE assert sp.lines[0].lb == scr.LB_FORCED assert sp.lines[1].text == "Tsashkataar" assert sp.lines[1].lt == scr.SCENE assert sp.lines[1].lb == scr.LB_LAST sp._validate()
def testPasteAfterForcedLineBreak(): sp = u.new() sp.cmd("addChar", char = "E") assert sp.lines[0].lt != scr.CHARACTER sp.cmd("insertForcedLineBreak") sp.paste([scr.Line(text = "Tsashkataar", lt = scr.CHARACTER)]) assert len(sp.lines) == 2 assert (sp.line == 1) and (sp.column == 11) assert sp.lines[0].text == "E" assert sp.lines[0].lt == scr.SCENE assert sp.lines[0].lb == scr.LB_FORCED assert sp.lines[1].text == "Tsashkataar" assert sp.lines[1].lt == scr.SCENE assert sp.lines[1].lb == scr.LB_LAST sp._validate()
def testForcedLb(): sp = u.new() sp.cmd("addChar", char="a") sp.cmd("splitElement") sp.cmd("toDialogue") sp.cmd("addChar", char="b") sp.cmd("insertForcedLineBreak") sp.cmd("addChar", char="c") sp.cmd("moveLeft") sp.cmd("moveUp") sp.cmd("deleteBackward") assert len(sp.lines) == 2 assert (sp.line == 0) and (sp.column == 1) assert sp.lines[0].text == "AB" assert sp.lines[0].lt == scr.SCENE assert sp.lines[0].lb == scr.LB_FORCED assert sp.lines[1].text == "c" assert sp.lines[1].lt == scr.SCENE assert sp.lines[1].lb == scr.LB_LAST
def testForcedLb2(): sp = u.new() sp.cmd("addChar", char="a") sp.cmd("splitElement") sp.cmd("toTransition") sp.cmdChars("line 1///////////// ") sp.cmdChars("line 2///////////// ") sp.cmdChars("line 3") sp.cmd("insertForcedLineBreak") sp.cmdChars("line 4") sp.gotoPos(1, 0) sp.cmd("deleteBackward") assert len(sp.lines) == 2 assert (sp.line == 0) and (sp.column == 1) assert sp.lines[0].text == "ALine 1///////////// line 2///////////// line 3" assert sp.lines[0].lt == scr.SCENE assert sp.lines[0].lb == scr.LB_FORCED assert sp.lines[1].text == "line 4" assert sp.lines[1].lt == scr.SCENE assert sp.lines[1].lb == scr.LB_LAST
def testCursorPos(): sp = u.new() sp._validate() sp.line = -1 v(sp) sp.line = 5 v(sp) sp.line = 0 sp.column = -1 v(sp) sp.column = 5 v(sp) sp.column = 0 sp._validate()
def testTooLongLine(): sp = u.new() sp._validate() sp.lines[0].text = "a" * 100 v(sp)
def testInvalidChars(): sp = u.new() sp._validate() sp.lines[0].text = chr(9) v(sp)
def testEmpty(): sp = u.new() sp._validate() sp.lines = [] v(sp)