forked from limburgher/trelby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_join_elems.py
53 lines (46 loc) · 1.59 KB
/
test_join_elems.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import screenplay as scr
import u
# tests element joining
# we used to have a bug where if the latter element contained a forced
# linebreak the result was invalid. this one tests the case where the
# forced linebreak is on the first line of the element, the second one
# where it is on the third line.
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