| 146 | ! |
| 147 | |
| 148 | test_issue130_01a |
| 149 | " |
| 150 | Test indenting code by Tab. Scenario: |
| 151 | 1. Position code to beggining of a line 2. |
| 152 | 2. Select a line by pression Shift-Down so that 'cursor' is before first character on line 3. |
| 153 | 3. Press Tab |
| 154 | |
| 155 | Check that only line 2 has been indented. |
| 156 | Check, that selection begin/end col has not been updated |
| 157 | |
| 158 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/130 |
| 159 | " |
| 160 | textView contents:'1111 |
| 161 | 2222 |
| 162 | 3333 |
| 163 | 4444'. |
| 164 | textView cursorLine:2 col: 1. |
| 165 | |
| 166 | textViewInteractor type:#ShiftDown. |
| 167 | self assert: textView selectionStartCol == 1. |
| 168 | self assert: textView selectionEndCol == 0. |
| 169 | textViewInteractor type:#Tab. |
| 170 | self assert: textView contents = '1111 |
| 171 | 2222 |
| 172 | 3333 |
| 173 | 4444 |
| 174 | '. |
| 175 | self assert: textView selectionStartCol == 1. |
| 176 | self assert: textView selectionEndCol == 0. |
| 177 | |
| 178 | "Created: / 11-10-2017 / 22:29:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 179 | ! |
| 180 | |
| 181 | test_issue130_01b |
| 182 | " |
| 183 | Test indenting code by Tab. Scenario: |
| 184 | 1. Position code to beggining of a line 2. |
| 185 | 2. Select 2 libes by pression Shift-Down twice so that 'cursor' is before first character on line 4. |
| 186 | 3. Press Tab |
| 187 | |
| 188 | Check that only line 2 and 3 have been indented. |
| 189 | Check, that selection has not been changed |
| 190 | |
| 191 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/130 |
| 192 | " |
| 193 | textView contents:'1111 |
| 194 | 2222 |
| 195 | 3333 |
| 196 | 4444'. |
| 197 | textView cursorLine:2 col: 1. |
| 198 | |
| 199 | textViewInteractor type:#ShiftDown. |
| 200 | textViewInteractor type:#ShiftDown. |
| 201 | self assert: textView selectionStartCol == 1. |
| 202 | self assert: textView selectionEndCol == 0. |
| 203 | textViewInteractor type:#Tab. |
| 204 | self assert: textView contents = '1111 |
| 205 | 2222 |
| 206 | 3333 |
| 207 | 4444 |
| 208 | '. |
| 209 | self assert: textView selectionStartCol == 1. |
| 210 | self assert: textView selectionEndCol == 0. |
| 211 | |
| 212 | "Created: / 11-10-2017 / 22:30:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 213 | ! |
| 214 | |
| 215 | test_issue130_01c |
| 216 | " |
| 217 | Test indenting code by Tab. Like 01b but uses tab width of 8 spaces. |
| 218 | 1. Position code to beggining of a line 2. |
| 219 | 2. Select 2 libes by pression Shift-Down twice so that 'cursor' is before first character on line 4. |
| 220 | 3. Press Tab |
| 221 | |
| 222 | Check that only line 2 and 3 have been indented. |
| 223 | Check, that selection has not been changed |
| 224 | |
| 225 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/130 |
| 226 | " |
| 227 | textView setTabPositions: ListView tab8Positions. |
| 228 | textView contents:'1111 |
| 229 | 2222 |
| 230 | 3333 |
| 231 | 4444'. |
| 232 | textView cursorLine:2 col: 1. |
| 233 | |
| 234 | textViewInteractor type:#ShiftDown. |
| 235 | textViewInteractor type:#ShiftDown. |
| 236 | self assert: textView selectionStartCol == 1. |
| 237 | self assert: textView selectionEndCol == 0. |
| 238 | textViewInteractor type:#Tab. |
| 239 | self assert: textView contents = '1111 |
| 240 | 2222 |
| 241 | 3333 |
| 242 | 4444 |
| 243 | '. |
| 244 | self assert: textView selectionStartCol == 1. |
| 245 | self assert: textView selectionEndCol == 0. |
| 246 | |
| 247 | "Created: / 12-10-2017 / 23:18:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 248 | ! |
| 249 | |
| 250 | test_issue130_01d |
| 251 | " |
| 252 | Test indenting code by Tab. Like 01b but select from ;bottom' to 'top': |
| 253 | 1. Position code to beggining of a line 4. |
| 254 | 2. Select 2 libes by pression Shift-Uo twice so that 'cursor' is before first character on line 2. |
| 255 | 3. Press Tab |
| 256 | |
| 257 | Check that only line 3 and 4 have been indented. |
| 258 | Check, that selection has not been changed |
| 259 | |
| 260 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/130 |
| 261 | " |
| 262 | textView contents:'1111 |
| 263 | 2222 |
| 264 | 3333 |
| 265 | 4444'. |
| 266 | textView cursorLine:5 col: 1. |
| 267 | |
| 268 | textViewInteractor type:#ShiftUp. |
| 269 | textViewInteractor type:#ShiftUp. |
| 270 | self assert: textView selectionStartCol == 1. |
| 271 | self assert: textView selectionEndCol == 0. |
| 272 | textViewInteractor type:#Tab. |
| 273 | self assert: textView contents = '1111 |
| 274 | 2222 |
| 275 | 3333 |
| 276 | 4444 |
| 277 | '. |
| 278 | self assert: textView selectionStartCol == 1. |
| 279 | self assert: textView selectionEndCol == 0. |
| 280 | |
| 281 | "Created: / 12-10-2017 / 23:26:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 282 | "Modified: / 12-10-2017 / 23:28:10 / jv" |
| 283 | ! |
| 284 | |
| 285 | test_issue130_02a |
| 286 | " |
| 287 | Test indenting code by Tab. Scenario: |
| 288 | 1. Position code to the middle of line 2 |
| 289 | 2. Select a line by pression Shift-Down so the end of the selection is in |
| 290 | the middle of line 3 |
| 291 | 3. Press Tab |
| 292 | |
| 293 | Check that lines 2 and 3 have been indented. |
| 294 | Check that selection has been 'indented' too. |
| 295 | |
| 296 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/130 |
| 297 | " |
| 298 | textView contents:'1111 |
| 299 | 2222 |
| 300 | 3333 |
| 301 | 4444'. |
| 302 | textView cursorLine:2 col: 3. |
| 303 | |
| 304 | textViewInteractor type:#ShiftDown. |
| 305 | self assert: textView selectionStartCol == 3. |
| 306 | self assert: textView selectionEndCol == 2. |
| 307 | textViewInteractor type:#Tab. |
| 308 | self assert: textView contents = '1111 |
| 309 | 2222 |
| 310 | 3333 |
| 311 | 4444 |
| 312 | '. |
| 313 | self assert: textView selectionStartCol == 7. |
| 314 | self assert: textView selectionEndCol == 6. |
| 315 | |
| 316 | "Created: / 11-10-2017 / 22:33:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 317 | ! |
| 318 | |
| 319 | test_issue130_02b |
| 320 | " |
| 321 | Test indenting code by Tab. Scenario: |
| 322 | 1. Position code to the middle of line 2 |
| 323 | 2. Select 2 lines by pression Shift-Down twice so the end of the selection is in |
| 324 | the middle of line 4 |
| 325 | 3. Press Tab |
| 326 | |
| 327 | Check that lines 2 to 4 have been indented. |
| 328 | Check that selection has been 'indented' too. |
| 329 | |
| 330 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/130 |
| 331 | " |
| 332 | textView contents:'1111 |
| 333 | 2222 |
| 334 | 3333 |
| 335 | 4444'. |
| 336 | textView cursorLine:2 col: 3. |
| 337 | |
| 338 | textViewInteractor type:#ShiftDown. |
| 339 | textViewInteractor type:#ShiftDown. |
| 340 | self assert: textView selectionStartCol == 3. |
| 341 | self assert: textView selectionEndCol == 2. |
| 342 | textViewInteractor type:#Tab. |
| 343 | self assert: textView contents = '1111 |
| 344 | 2222 |
| 345 | 3333 |
| 346 | 4444 |
| 347 | '. |
| 348 | self assert: textView selectionStartCol == 7. |
| 349 | self assert: textView selectionEndCol == 6. |
| 350 | |
| 351 | "Created: / 11-10-2017 / 22:34:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 352 | ! |
| 353 | |
| 354 | test_issue130_02c |
| 355 | " |
| 356 | Test indenting code by Tab. Scenario: |
| 357 | 1. Position code just before first non-bwhitespace character on |
| 358 | (already indented) line 2. |
| 359 | 2. Select 2 lines by pressing Shift-Down so the end of the selection is |
| 360 | just before first non-bwhitespace character on (already indented) line 3. |
| 361 | 3. Press Tab |
| 362 | |
| 363 | Check that lines 2 and 3 have been indented. |
| 364 | Check that selection has been 'indented' too. |
| 365 | |
| 366 | See https://swing.fit.cvut.cz/projects/stx-jv/ticket/130 |
| 367 | " |
| 368 | textView contents:'1111 |
| 369 | 2222 |
| 370 | 3333 |
| 371 | 4444'. |
| 372 | textView cursorLine:2 col: 5. |
| 373 | |
| 374 | textViewInteractor type:#ShiftDown. |
| 375 | self assert: textView selectionStartCol == 5. |
| 376 | self assert: textView selectionEndCol == 4. |
| 377 | textViewInteractor type:#Tab. |
| 378 | self assert: textView contents = '1111 |
| 379 | 2222 |
| 380 | 3333 |
| 381 | 4444 |
| 382 | '. |
| 383 | self assert: textView selectionStartCol == 9. |
| 384 | self assert: textView selectionEndCol == 8. |
| 385 | |
| 386 | "Created: / 11-10-2017 / 22:35:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |