1 | | "{ Package: 'stx:libwidg/tests' }" |
2 | | |
3 | | "{ NameSpace: Smalltalk }" |
4 | | |
5 | | TestCase subclass:#EditTextViewTests |
6 | | instanceVariableNames:'textView textViewInteractor' |
7 | | classVariableNames:'' |
8 | | poolDictionaries:'' |
9 | | category:'Views-Text-Tests' |
10 | | ! |
11 | | |
12 | | |
13 | | !EditTextViewTests methodsFor:'running'! |
14 | | |
15 | | setUp |
16 | | | topView | |
17 | | |
18 | | Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'. |
19 | | |
20 | | topView := StandardSystemView new. |
21 | | topView extent: 320 @ 200. |
22 | | topView label: self printString. |
23 | | textView := EditTextView origin: 0.0@0.0 extent: 1.0@1.0 in: topView. |
24 | | textViewInteractor := textView interactor. |
25 | | |
26 | | |
27 | | topView open. |
28 | | topView waitUntilVisible. |
29 | | |
30 | | "Created: / 23-07-2014 / 07:15:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
31 | | "Modified: / 24-02-2015 / 08:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
32 | | ! |
33 | | |
34 | | tearDown |
35 | | textView topView destroy. |
36 | | |
37 | | "Created: / 23-07-2014 / 07:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
38 | | "Modified: / 24-02-2015 / 08:17:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
39 | | ! ! |
40 | | |
41 | | !EditTextViewTests methodsFor:'tests'! |
42 | | |
43 | | test_01 |
44 | | textView contents: 'Hello, here is Smalltalk X'. |
45 | | textView setCursorCol: 14. |
46 | | |
47 | | textViewInteractor type: #SelectWord. |
48 | | self assert: textView selectionAsString = 'is'. |
49 | | |
50 | | textViewInteractor type: #CtrlShiftCursorRight. |
51 | | textViewInteractor type: #CtrlShiftCursorRight. |
52 | | |
53 | | self assert: textView selectionAsString = 'is Smalltalk '. |
54 | | |
55 | | "Created: / 24-02-2015 / 08:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
56 | | ! |
57 | | |
58 | | test_issue124_case1_01 |
59 | | " |
60 | | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
61 | | " |
62 | | |
63 | | textView contents:'1234'. |
64 | | textView setCursorCol:3. |
65 | | textView selectToEndOfLine. |
66 | | self assert:textView selectionAsString = '34'. |
67 | | textView setClipboardText:'Smalltalk'. |
68 | | textViewInteractor type:#Paste. |
69 | | self assert:textView selectionAsString = 'Smalltalk'. |
70 | | self assert:textView contents asString = ('12Smalltalk' , Character cr). |
71 | | textViewInteractor type:#Undo. |
72 | | self assert:textView contents asString = ('1234' , Character cr). |
73 | | |
74 | | "Created: / 17-03-2017 / 09:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
75 | | "Modified (comment): / 04-05-2017 / 22:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
76 | | ! |
77 | | |
78 | | test_issue124_case1_02 |
79 | | " |
80 | | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
81 | | " |
82 | | |
83 | | textView contents:'1234'. |
84 | | textView setCursorCol:3. |
85 | | textView selectToEndOfLine. |
86 | | self assert:textView selectionAsString = '34'. |
87 | | textView setClipboardText:'1-LINEA |
88 | | 2-LINEB |
89 | | 3-LINEC |
90 | | '. |
91 | | textViewInteractor type:#Paste. |
92 | | self assert:textView selectionAsString = '1-LINEA |
93 | | 2-LINEB |
94 | | 3-LINEC |
95 | | '. |
96 | | self assert:textView contents asString = ('121-LINEA |
97 | | 2-LINEB |
98 | | 3-LINEC |
99 | | '). |
100 | | textViewInteractor type:#Undo. |
101 | | self assert:textView contents asString = ('1234' , Character cr). |
102 | | |
103 | | "Created: / 17-03-2017 / 09:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
104 | | "Modified: / 17-03-2017 / 14:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
105 | | "Modified (comment): / 04-05-2017 / 22:31:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
106 | | ! |
107 | | |
108 | | test_issue124_case1_04 |
109 | | " |
110 | | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
111 | | " |
112 | | textViewInteractor type:'1234'. |
113 | | self assert:textView contents asString = ('1234' , Character cr). |
114 | | textViewInteractor type:#Undo. |
115 | | self assert:textView contents asString = ('' , Character cr). |
116 | | |
117 | | "Created: / 17-03-2017 / 21:42:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
118 | | "Modified (comment): / 04-05-2017 / 22:31:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
119 | | ! |
120 | | |
121 | | test_issue124_case1_05 |
122 | | " |
123 | | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
124 | | " |
125 | | |
126 | | textViewInteractor type:'1234'. |
127 | | self assert:textView contents asString = ('1234' , Character cr). |
128 | | textView setClipboardText:'Blah blag'. |
129 | | textViewInteractor type:#Paste. |
130 | | self assert:textView contents asString = ('1234Blah blag' , Character cr). |
131 | | textViewInteractor type:#Undo. |
132 | | self assert:textView contents asString = ('1234' , Character cr). |
133 | | textViewInteractor type:#Undo. |
134 | | self assert:textView contents asString = ('' , Character cr). |
135 | | |
136 | | "Created: / 17-03-2017 / 22:43:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
137 | | "Modified (comment): / 04-05-2017 / 22:32:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
138 | | ! ! |
139 | | |
140 | | !EditTextViewTests class methodsFor:'documentation'! |
141 | | |
142 | | version_HG |
143 | | |
144 | | ^ '$Changeset: <not expanded> $' |
145 | | ! ! |
146 | | |
| 1 | 'From Smalltalk/X jv-branch, Version:6.2.6.0 on 21-07-2017 at 12:31:21 PM' ! |
| 2 | |
| 3 | "{ Package: 'stx:libwidg/tests' }" |
| 4 | |
| 5 | "{ NameSpace: Smalltalk }" |
| 6 | |
| 7 | TestCase subclass:#EditTextViewTests |
| 8 | instanceVariableNames:'textView textViewInteractor' |
| 9 | classVariableNames:'' |
| 10 | poolDictionaries:'' |
| 11 | category:'Views-Text-Tests' |
| 12 | ! |
| 13 | |
| 14 | |
| 15 | !EditTextViewTests methodsFor:'running'! |
| 16 | |
| 17 | setUp |
| 18 | | topView | |
| 19 | |
| 20 | Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'. |
| 21 | |
| 22 | topView := StandardSystemView new. |
| 23 | topView extent: 320 @ 200. |
| 24 | topView label: self printString. |
| 25 | textView := EditTextView origin: 0.0@0.0 extent: 1.0@1.0 in: topView. |
| 26 | textViewInteractor := textView interactor. |
| 27 | textView lineEndCR: false. |
| 28 | |
| 29 | topView open. |
| 30 | topView waitUntilVisible. |
| 31 | |
| 32 | "Created: / 23-07-2014 / 07:15:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 33 | "Modified: / 24-02-2015 / 08:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 34 | "Modified: / 21-07-2017 / 11:58:32 / svestkap" |
| 35 | ! |
| 36 | |
| 37 | tearDown |
| 38 | textView topView destroy. |
| 39 | |
| 40 | "Created: / 23-07-2014 / 07:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 41 | "Modified: / 24-02-2015 / 08:17:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 42 | ! ! |
| 43 | |
| 44 | !EditTextViewTests methodsFor:'tests'! |
| 45 | |
| 46 | test_01 |
| 47 | textView contents: 'Hello, here is Smalltalk X'. |
| 48 | textView setCursorCol: 14. |
| 49 | |
| 50 | textViewInteractor type: #SelectWord. |
| 51 | self assert: textView selectionAsString = 'is'. |
| 52 | |
| 53 | textViewInteractor type: #CtrlShiftCursorRight. |
| 54 | textViewInteractor type: #CtrlShiftCursorRight. |
| 55 | |
| 56 | self assert: textView selectionAsString = 'is Smalltalk '. |
| 57 | |
| 58 | "Created: / 24-02-2015 / 08:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 59 | ! |
| 60 | |
| 61 | test_issue124_case1_01 |
| 62 | " |
| 63 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
| 64 | " |
| 65 | |
| 66 | textView contents:'1234'. |
| 67 | textView setCursorCol:3. |
| 68 | textView selectToEndOfLine. |
| 69 | self assert:textView selectionAsString = '34'. |
| 70 | textView setClipboardText:'Smalltalk'. |
| 71 | textViewInteractor type:#Paste. |
| 72 | self assert:textView selectionAsString = 'Smalltalk'. |
| 73 | self assert:textView contents asString = '12Smalltalk'. |
| 74 | textViewInteractor type:#Undo. |
| 75 | self assert:textView contents asString = '1234'. |
| 76 | |
| 77 | "Created: / 17-03-2017 / 09:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 78 | "Modified (comment): / 04-05-2017 / 22:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 79 | "Modified: / 21-07-2017 / 12:07:59 / svestkap" |
| 80 | ! |
| 81 | |
| 82 | test_issue124_case1_02 |
| 83 | " |
| 84 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
| 85 | " |
| 86 | textView lineEndCR: true. |
| 87 | textView contents:'1234'. |
| 88 | textView setCursorCol:3. |
| 89 | textView selectToEndOfLine. |
| 90 | self assert:textView selectionAsString = '34'. |
| 91 | textView setClipboardText:'1-LINEA |
| 92 | 2-LINEB |
| 93 | 3-LINEC |
| 94 | '. |
| 95 | textViewInteractor type:#Paste. |
| 96 | self assert:textView selectionAsString = '1-LINEA |
| 97 | 2-LINEB |
| 98 | 3-LINEC |
| 99 | '. |
| 100 | self assert:textView contents asString = ('121-LINEA |
| 101 | 2-LINEB |
| 102 | 3-LINEC |
| 103 | '). |
| 104 | textView lineEndCR: false. |
| 105 | textViewInteractor type:#Undo. |
| 106 | self assert:textView contents asString = '1234'. |
| 107 | |
| 108 | "Created: / 17-03-2017 / 09:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 109 | "Modified: / 17-03-2017 / 14:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 110 | "Modified (comment): / 04-05-2017 / 22:31:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 111 | "Modified: / 21-07-2017 / 12:09:03 / svestkap" |
| 112 | ! |
| 113 | |
| 114 | test_issue124_case1_04 |
| 115 | " |
| 116 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
| 117 | " |
| 118 | textViewInteractor type:'1234'. |
| 119 | self assert:textView contents asString = '1234'. |
| 120 | textViewInteractor type:#Undo. |
| 121 | self assert:textView contents asString = ''. |
| 122 | |
| 123 | "Created: / 17-03-2017 / 21:42:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 124 | "Modified (comment): / 04-05-2017 / 22:31:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 125 | "Modified: / 21-07-2017 / 12:09:28 / svestkap" |
| 126 | ! |
| 127 | |
| 128 | test_issue124_case1_05 |
| 129 | " |
| 130 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/124#comment:19 |
| 131 | " |
| 132 | |
| 133 | textViewInteractor type:'1234'. |
| 134 | self assert:textView contents asString = '1234'. |
| 135 | textView setClipboardText:'Blah blag'. |
| 136 | textViewInteractor type:#Paste. |
| 137 | self assert:textView contents asString = '1234Blah blag'. |
| 138 | textViewInteractor type:#Undo. |
| 139 | self assert:textView contents asString = '1234'. |
| 140 | textViewInteractor type:#Undo. |
| 141 | self assert:textView contents asString = ''. |
| 142 | |
| 143 | "Created: / 17-03-2017 / 22:43:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 144 | "Modified (comment): / 04-05-2017 / 22:32:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 145 | "Modified: / 21-07-2017 / 12:09:53 / svestkap" |
| 146 | ! ! |
| 147 | |
| 148 | !EditTextViewTests class methodsFor:'documentation'! |
| 149 | |
| 150 | version_HG |
| 151 | |
| 152 | ^ '$Changeset: <not expanded> $' |
| 153 | ! ! |
| 154 | |