Menu

[dc0a3d]: / tests / blocks.py  Maximize  Restore  History

Download this file

84 lines (73 with data), 2.8 kB

 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import joefx
class BlockMoveTests(joefx.JoeTestBase):
def test_blkmove_1(self):
self.startJoe()
self.write("this is some text")
self.cmd("bol,markb,nextword,rtarw,markk,rtarw,rtarw,rtarw,blkmove")
self.assertTextAt("is this some text", x=0)
self.assertCursor(x=3, y=1)
self.assertSelectedTextEquals("this ")
self.exitJoe()
def test_blkmove_inside_block(self):
self.startJoe()
self.write("this is some text")
self.cmd("bol,markb,rtarw,rtarw,rtarw,rtarw,rtarw,markk,ltarw,ltarw,ltarw,blkmove")
self.assertTextAt("No block", y=-1, x=0)
self.assertTextAt("this is some text", x=0)
self.assertCursor(x=2, y=1)
self.exitJoe()
def test_blkmove_no_block(self):
self.startJoe()
self.cmd("blkmove")
self.assertTextAt("No block", y=-1, x=0)
# Make sure no change
self.cmd("abort")
self.assertExited()
class BlockCopyTests(joefx.JoeTestBase):
def test_blkcpy_1(self):
self.startJoe()
self.write("hello world")
self.cmd("bol,markb,nextword,markk,blkcpy,blkcpy")
self.assertTextAt("hellohellohello world", x=0)
self.assertCursor(x=5, y=1)
self.assertSelectedTextEquals("hello")
self.exitJoe()
def test_blkcpy_inside_block(self):
self.startJoe()
self.write("hello world")
self.cmd("bol,markb,nextword,markk,bol,rtarw,rtarw,blkcpy")
self.assertTextAt("hehellollo world", x=0)
self.assertCursor(x=2, y=1)
self.assertSelectedTextEquals("hello")
self.exitJoe()
def test_blkcpy_no_block(self):
self.startJoe()
self.cmd("blkcpy")
self.assertTextAt("No block", y=-1, x=0)
# Make sure no changes that hang up exit.
self.cmd("abort")
self.assertExited()
class BlockDeleteTests(joefx.JoeTestBase):
def test_blkdel_1(self):
self.startJoe()
self.write("hello world")
self.cmd("bol,markb,nextword,markk,blkdel")
self.assertTextAt(" world", x=0)
self.assertCursor(x=0, y=1)
self.exitJoe()
def test_blkdel_no_block(self):
self.startJoe()
self.write("hello world")
self.cmd("blkdel")
self.assertTextAt("No block", x=0, y=-1)
self.assertTextAt("hello world", x=0)
self.exitJoe()
class BlockSaveTests(joefx.JoeTestBase):
def test_blocksave_1(self):
self.startJoe()
self.write("hello world")
self.cmd('bol,markb,nextword,markk,blksave,"outfile",rtn')
self.assertTextAt("Block written to", x=0, y=-1)
self.assertSelectedTextEquals("hello")
self.exitJoe()
self.assertFileContents("outfile", "hello")
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.