tests/EditTextViewTests.st
branchdelegated_gc_text-view-selection-refactoring
changeset 5298 558eadf6190a
child 6153 ef289d40b266
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/EditTextViewTests.st	Tue Feb 24 09:23:39 2015 +0100
@@ -0,0 +1,56 @@
+"{ 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/sunitext/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>"
+! !
+