`ScrollableView`: merge (some) changes from eXept
...to make it work with recent UI builder.
"
COPYRIGHT (c) 2015 Jan Vrany
COPYRIGHT (c) 2017 Jan Vrany
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
"{ Package: 'stx:libwidg/tests' }"
"{ NameSpace: Smalltalk }"
TestCase subclass:#EditFieldTests
instanceVariableNames:'window'
classVariableNames:''
poolDictionaries:''
category:'Views-Basic-Tests'
!
!EditFieldTests class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 2015 Jan Vrany
COPYRIGHT (c) 2017 Jan Vrany
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
! !
!EditFieldTests methodsFor:'running'!
setUp
| firstEditField |
super setUp.
Smalltalk loadPackage:'stx:goodies/sunit/ext/ui'.
Screen current isNil ifTrue:[
Smalltalk openDisplay.
].
self skipIf:Screen current isNil description:'No display connection'.
"Add your own code here..."
window := StandardSystemView new.
window label: self printString.
window extent: 200@100.
firstEditField := EditField origin: (0.0@0.0) in: window.
firstEditField name: #FirstEditField.
firstEditField width: 1.0.
firstEditField model: 'Text to be tested' asValue.
window open.
window waitUntilVisible.
"Modified: / 23-01-2019 / 16:00:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 20-03-2019 / 13:20:13 / svestkap"
!
tearDown
window isOpen ifTrue: [
window close
]
"Created: / 23-01-2019 / 15:08:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 20-03-2019 / 13:17:02 / svestkap"
! !
!EditFieldTests methodsFor:'tests'!
test_issue_261a
"Do a screenshot of an EditField before pressing right arrow key and after. The results should match."
| editField editFieldInteractor image firstDetectedPixelColors secondDetectedPixelColors |
editField := (window subViews select: [ :subView |
subView name = #FirstEditField
]) first.
editFieldInteractor := editField interactor.
editField takeFocus.
editFieldInteractor type: #Home.
Delay waitForSeconds:1.
image := Image fromView:window grab:false.
firstDetectedPixelColors := Set new.
1 to: 30 do: [ :y |
5 to: 50 do: [ :x |
firstDetectedPixelColors add:(image colorAtX:x y:y)
]
].
editFieldInteractor type: #End.
editFieldInteractor type: #CursorRight.
Delay waitForSeconds:1.
image := Image fromView:window grab:false.
secondDetectedPixelColors := Set new.
1 to: 30 do: [ :y |
5 to: 50 do: [ :x |
secondDetectedPixelColors add:(image colorAtX:x y:y)
]
].
self assert:(firstDetectedPixelColors = secondDetectedPixelColors).
"Created: / 21-03-2019 / 11:05:48 / jv"
! !
!EditFieldTests class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !