Issue #124, case 0: Fixed long standing bug with inconsistent cursor position after select-word
If there's a selection, cursor position (`cursorLine` / `cursorCol` instvars)
are required to be same as either selection start or selection end.
#selectWordAtLine:col: did not update cursor position accordingly,
leading to assertion failure. This bug has been there for a loong
time. My bad, I was too lazy to fix it, until today...
https://swing.fit.cvut.cz/projects/stx-jv/ticket/124
"{ Package: 'stx:libwidg/tests' }"
"{ NameSpace: Smalltalk }"
TestCase subclass:#EditTextViewTests
instanceVariableNames:'textView textViewInteractor'
classVariableNames:''
poolDictionaries:''
category:'Views-Text-Tests'
!
!EditTextViewTests methodsFor:'running'!
setUp
| topView |
Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'.
topView := StandardSystemView new.
topView extent: 320 @ 200.
topView label: self printString.
textView := EditTextView origin: 0.0@0.0 extent: 1.0@1.0 in: topView.
textViewInteractor := textView interactor.
topView open.
topView waitUntilVisible.
"Created: / 23-07-2014 / 07:15:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 24-02-2015 / 08:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
tearDown
textView topView destroy.
"Created: / 23-07-2014 / 07:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 24-02-2015 / 08:17:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!EditTextViewTests methodsFor:'tests'!
test_01
textView contents: 'Hello, here is Smalltalk X'.
textView setCursorCol: 14.
textViewInteractor type: #SelectWord.
self assert: textView selectionAsString = 'is'.
textViewInteractor type: #CtrlShiftCursorRight.
textViewInteractor type: #CtrlShiftCursorRight.
self assert: textView selectionAsString = 'is Smalltalk '.
"Created: / 24-02-2015 / 08:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !