author | Jan Vrany <jan.vrany@labware.com> |
Wed, 15 Sep 2021 21:39:40 +0100 | |
branch | jv |
changeset 19608 | 98f7cba0ce8c |
parent 18369 | 4ccc3b5d656d |
permissions | -rw-r--r-- |
18272 | 1 |
" |
2 |
COPYRIGHT (c) 2017 Jan Vrany |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libtool/tests' }" |
|
13 |
||
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
TestCase subclass:#CodeView2Tests |
|
17 |
instanceVariableNames:'preferences codeView textView textViewInteractor' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-CodeView-Tests' |
|
21 |
! |
|
22 |
||
23 |
!CodeView2Tests class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2017 Jan Vrany |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
38 |
||
39 |
!CodeView2Tests methodsFor:'running'! |
|
40 |
||
41 |
setUp |
|
42 |
| topView | |
|
43 |
||
44 |
self skipIf: Screen current isNil description: 'No display connection'. |
|
45 |
||
46 |
Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'. |
|
47 |
||
48 |
preferences := UserPreferences new. |
|
49 |
MessageTracer mock: #current in: UserPreferences class do: [ preferences ]. |
|
50 |
self assert: UserPreferences current == preferences. |
|
51 |
||
52 |
topView := StandardSystemView new. |
|
53 |
topView extent: 320 @ 200. |
|
54 |
topView label: self printString. |
|
55 |
codeView := CodeView2 origin: 0.0@0.0 extent: 1.0@1.0 in: topView. |
|
56 |
textView := codeView textView. |
|
57 |
textView setTabPositions: ListView tab4Positions. |
|
58 |
||
59 |
textViewInteractor := textView interactor. |
|
60 |
||
61 |
topView open. |
|
62 |
topView waitUntilVisible. |
|
63 |
||
64 |
"Created: / 23-07-2014 / 07:15:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
65 |
"Modified: / 17-07-2018 / 12:22:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
66 |
! |
|
67 |
||
68 |
tearDown |
|
69 |
textView topView destroy. |
|
70 |
MessageTracer unmock: #current in: UserPreferences class |
|
71 |
||
72 |
"Created: / 23-07-2014 / 07:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
73 |
"Modified: / 12-10-2017 / 22:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 |
! ! |
|
75 |
||
76 |
!CodeView2Tests methodsFor:'tests'! |
|
77 |
||
18368
3877b0e95a78
Fixed typo in test names
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18272
diff
changeset
|
78 |
test_issue230_01a |
18272 | 79 |
" |
80 |
Test paste over selection |
|
81 |
1. Copy some code to clipboard |
|
82 |
2. Select word in an editor |
|
83 |
3. Paste |
|
84 |
||
85 |
Check, that selected code has been replaced by |
|
18368
3877b0e95a78
Fixed typo in test names
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18272
diff
changeset
|
86 |
pasted text." |
18272 | 87 |
|
88 |
textView contents:'Here is some word.'. |
|
89 |
textView |
|
90 |
selectFromLine:1 |
|
91 |
col:9 |
|
92 |
toLine:1 |
|
93 |
col:12. |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
94 |
self assert:textView selection first equals: 'some'. |
18272 | 95 |
textView setClipboardText:'pasted'. |
96 |
textViewInteractor type:#Paste. |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
97 |
self assert:textView selection first equals: 'pasted'. |
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
98 |
self assert:textView contents equals: 'Here is pasted word. |
18272 | 99 |
'. |
100 |
||
101 |
"Created: / 17-07-2018 / 09:28:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
102 |
"Modified: / 17-07-2018 / 09:28:42 / jv" |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
103 |
"Modified: / 29-08-2018 / 21:43:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18272 | 104 |
! |
105 |
||
18368
3877b0e95a78
Fixed typo in test names
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18272
diff
changeset
|
106 |
test_issue230_01b |
18272 | 107 |
" |
108 |
Test paste over selection |
|
109 |
1. Copy some code to clipboard |
|
110 |
2. Select word in an editor using select-world |
|
111 |
3. Paste |
|
112 |
||
113 |
Check, that selected code has been replaced by |
|
18368
3877b0e95a78
Fixed typo in test names
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18272
diff
changeset
|
114 |
pasted text." |
18272 | 115 |
|
116 |
textViewInteractor type:'Here is some word.'. |
|
117 |
textView setCursorCol:10. |
|
118 |
textViewInteractor type:#SelectWord. |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
119 |
self assert:textView selection first equals: 'some'. |
18272 | 120 |
textView setClipboardText:'pasted'. |
121 |
textViewInteractor type:#Paste. |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
122 |
self assert:textView selection first equals: 'pasted'. |
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
123 |
self assert:textView contents equals: 'Here is pasted word. |
18272 | 124 |
'. |
125 |
||
126 |
"Created: / 17-07-2018 / 09:37:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
127 |
"Modified: / 29-08-2018 / 21:43:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18272 | 128 |
! |
129 |
||
18368
3877b0e95a78
Fixed typo in test names
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18272
diff
changeset
|
130 |
test_issue230_01c |
18272 | 131 |
" |
132 |
Test paste over selection |
|
133 |
1. Copy some code to clipboard using select world, then copy. |
|
134 |
2. Select word in an editor using select-world |
|
135 |
3. Paste |
|
136 |
||
137 |
Check, that selected code has been replaced by |
|
18368
3877b0e95a78
Fixed typo in test names
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18272
diff
changeset
|
138 |
pasted text." |
18272 | 139 |
|
140 |
textView contents:'Here is some word.'. |
|
141 |
textView setCursorCol:10. |
|
142 |
textViewInteractor type:#SelectWord. |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
143 |
self assert:textView selection first equals: 'some'. |
18272 | 144 |
textViewInteractor type:#Copy. |
145 |
textView setCursorCol:3. |
|
146 |
textViewInteractor type:#SelectWord. |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
147 |
self assert:textView selection first equals: 'Here'. |
18272 | 148 |
textViewInteractor type:#Paste. |
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
149 |
self assert:textView selection first equals: 'some'. |
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
150 |
self assert:textView contents equals: 'some is some word. |
18272 | 151 |
'. |
152 |
||
153 |
"Created: / 17-07-2018 / 10:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
154 |
"Modified: / 29-08-2018 / 21:43:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18272 | 155 |
! ! |
156 |
||
18369
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
157 |
!CodeView2Tests class methodsFor:'documentation'! |
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
158 |
|
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
159 |
version_HG |
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
160 |
|
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
161 |
^ '$Changeset: <not expanded> $' |
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
162 |
! ! |
4ccc3b5d656d
In tests use `self assert: a equals: b`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18368
diff
changeset
|
163 |