Ticket #131: all_delete_testsEditTextViewTests.2.st

File all_delete_testsEditTextViewTests.2.st, 4.6 KB (added by patrik.svestka@…, 6 years ago)

Adding tests for the delete key functionality - 4 failing tests

Line 
1"{ Encoding: utf8 }" !
2!EditTextViewTests methodsFor:'tests'!
3
4test_02a
5 "Testing deletion of space between words"
6
7 textView contents:'This text is to continue'.
8 textView setCursorCol:16.
9
10 textViewInteractor type: #BasicDelete.
11 self assert:textView contents asString = ('This text is tocontinue', Character cr).
12
13 "Modified (comment): / 03-10-2018 / 13:27:14 / svestkap"
14! !
15
16!EditTextViewTests methodsFor:'tests'!
17
18test_02b
19 "Testing a deletion of one of multiple spaces"
20
21 textView contents:'This text is to continue'.
22 textView setCursorCol:16.
23
24 textViewInteractor type: #BasicDelete.
25 self assert:textView contents asString = ('This text is to continue', Character cr).
26
27 "Modified (comment): / 03-10-2018 / 13:27:41 / svestkap"
28! !
29
30!EditTextViewTests methodsFor:'tests'!
31
32test_02c
33 "Testing if space at the end is deleted"
34
35 textView contents:'This text is to continue '.
36 textView setCursorCol:25.
37
38 textViewInteractor type: #BasicDelete.
39 self assert:textView contents asString = ('This text is to continue', Character cr).
40
41 "Modified (comment): / 03-10-2018 / 13:27:57 / svestkap"
42! !
43
44!EditTextViewTests methodsFor:'tests'!
45
46test_02d
47 "Testing if space is deleted from multiple spaces at the end of testing string"
48
49 textView contents:'This text is to continue '.
50 textView setCursorCol:25.
51
52 textViewInteractor type: #BasicDelete.
53 self assert:textView contents asString = ('This text is to continue ', Character cr).
54
55 "Modified (comment): / 03-10-2018 / 13:28:21 / svestkap"
56! !
57
58!EditTextViewTests methodsFor:'tests'!
59
60test_02e
61 "Testing multiple space deletion when there are multiple spaces between
62 last word and last character"
63
64 |text originalStringSize expectedStringSize|
65
66 text := 'This text is to continue .'.
67
68 textView contents: text.
69 originalStringSize := text size.
70 textView setCursorCol:25.
71
72 textViewInteractor type: #BasicDelete.
73 expectedStringSize := textView contents asString size.
74
75 self assert: expectedStringSize equals: originalStringSize - 1.
76
77 "Modified (comment): / 03-10-2018 / 13:29:26 / svestkap"
78! !
79
80!EditTextViewTests methodsFor:'tests'!
81
82test_02f_01
83 "This tests if there are spaces left at the end after moving the line up"
84
85 textView contents:'This text is to ', String lf, 'continue'.
86 textView setCursorCol:16.
87
88 textViewInteractor type: #BasicDelete.
89 self assert:textView contents asString = ('This text is to continue', Character cr).
90
91 "Created: / 04-10-2018 / 10:17:22 / svestkap"
92! !
93
94!EditTextViewTests methodsFor:'tests'!
95
96test_02f_02
97 "This tests if there are spaces left at the end after moving the line up"
98
99 textView contents:'This text is to ', String crlf, 'continue'.
100 textView setCursorCol:16.
101
102 textViewInteractor type: #BasicDelete.
103 self assert:textView contents asString = ('This text is to continue', Character cr).
104
105 "Created: / 04-10-2018 / 10:17:32 / svestkap"
106! !
107
108!EditTextViewTests methodsFor:'tests'!
109
110test_02f_03
111 "This tests if there are spaces left at the end after moving the line up"
112
113 textView contents:'This text is to ', Character cr, 'continue'.
114 textView setCursorCol:16.
115
116 textViewInteractor type: #BasicDelete.
117 self assert:textView contents asString = ('This text is to continue', Character cr).
118
119 "Created: / 04-10-2018 / 10:17:43 / svestkap"
120! !
121
122!EditTextViewTests methodsFor:'tests'!
123
124test_02g
125 "Testing if the space at the end first line remains"
126
127 textView contents:'This text is to ', String lf, 'continue'.
128 textView setCursorCol:16.
129
130 textViewInteractor type: #BasicDelete.
131 self assert:textView contents asString ~= ('This text is tocontinue', Character cr).
132
133 "Created: / 11-07-2017 / 10:28:21 / svestkap"
134 "Modified (comment): / 03-10-2018 / 13:30:36 / svestkap"
135! !
136
137!EditTextViewTests methodsFor:'tests'!
138
139test_02h
140 "Testing if the $. moves a position when delete is pressed"
141
142 |text originalStringSize expectedStringSize|
143
144 text := 'This text is to continue .'.
145
146 textView contents: text.
147 originalStringSize := text indexOf: $. startingAt: 1.
148 textView setCursorCol:25.
149
150 textViewInteractor type: #BasicDelete.
151 expectedStringSize := (textView contents asString) indexOf: $. startingAt: 1.
152
153
154 "/self assert: expectedStringSize == (originalStringSize - 1).
155
156 self assert: expectedStringSize equals: originalStringSize - 1.
157
158 "Created: / 03-10-2018 / 13:19:10 / svestkap"
159! !
160