Opened 6 years ago
Closed 6 years ago
#134 closed todo (fixed)
Implement WinWorkstation>>sendKeyOrButtonEvent:x:y:keyOrButton:state:toViewId:
Reported by: | Jan Vrany | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | default | Keywords: | |
Cc: | Patrik Svestka | Also affects CVS HEAD (eXept version): | no |
Description
This method is required to make UI testing framework to work on Windows.
Ideally it should be implemented by means of SendInput() API.
Attachments (2)
Change History (9)
comment:1 Changed 6 years ago by
Cc: | Patrik Svestka added |
---|
Changed 6 years ago by
Attachment: | changes_2017-05-05__09_05_49.chg added |
---|
comment:2 Changed 6 years ago by
Attached changeset contains an initial attempt for generic, pure-smalltalk solution that injects smalltalk events into window group's event queue. Does not work yet, though, not sure why. Further investigation needed.
Changed 6 years ago by
comment:3 follow-up: 4 Changed 6 years ago by
Status: | new → testing |
---|
Patch [[arrachment:libview_fix_1_of_1_rev_57888ed51447_Issue__134__Added_generic_implementation_of___sendKeyOrButtonEvent_____to__DeviceWorkstation_.patch|57888ed51447]] contains a generic implementation that directly inject events to window group's event queue. Bit hacky to make modifier keys working...
All tests in EditTextViewTests
passes on Windows with this implementation.
A proper implementation using SendInput()
is still desirable, but this may allow us to work on text editor issues menawhile, until Windows-specific implementation is fixed.
Give it try and let me know if it works for you.
comment:4 follow-up: 5 Changed 6 years ago by
Replying to jan vrany:
Patch 57888ed51447 contains a generic implementation that directly inject events to window group's event queue. Bit hacky to make modifier keys working...
All tests in
EditTextViewTests
passes on Windows with this implementation.
A proper implementation using
SendInput()
is still desirable, but this may allow us to work on text editor issues menawhile, until Windows-specific implementation is fixed.
Give it try and let me know if it works for you.
This does not work for me:
1) I have tried already done test (probably yours):
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'.
This fails at: [AssertionFailedError]: Assertion failed in EditTextView >> addToSelectionAfter: [36][36] in process EditTextViewTests>>#test_01 [8529]
The issue appears to be with the #CtrlShiftCursorRight
and #CtrlShiftCursorRight
as from the window it appears the word 'is' is selected.
2) I have tried to create my own test which also fails as it does not press delete key:
test_03 textView contents:'This text is to ' , String lf , 'continue'. textView hideCursor. textView setCursorCol: 16. textView showCursor. textViewInteractor type: #Delete. self assert: textView selectionAsString = 'This text is to continue'.
comment:5 follow-up: 6 Changed 6 years ago by
Replying to patrik.svestka@…:
This does not work for me:
1) I have tried already done test (probably yours):
This fails at:
[AssertionFailedError]: Assertion failed in EditTextView >> addToSelectionAfter: [36][36] in process EditTextViewTests>>#test_01 [8529]
Well, are you sure you have ef289d40b266/stx.libwidg or newer? This commit contains
fix for this test - see issue #124
2) I have tried to create my own test which also fails as it does not press delete key:
This cannot work as of now. Pressing Del at the end of line does not merge lines. Keep in mind that St/X editor uses the "sheet of paper" metaphor. Try to textViewInteractor type: #Delete.
when in the middle of a line and check the character right to cursor has been deleted. This should work.
comment:6 Changed 6 years ago by
Replying to jan vrany:
Replying to patrik.svestka@…:
This does not work for me:
1) I have tried already done test (probably yours):
This fails at:
[AssertionFailedError]: Assertion failed in EditTextView >> addToSelectionAfter: [36][36] in process EditTextViewTests>>#test_01 [8529]
Well, are you sure you have ef289d40b266/stx.libwidg or newer? This commit contains
fix for this test - see issue #124
I had only part of it. After compiling StX I'll check it again.
2) I have tried to create my own test which also fails as it does not press delete key:
This cannot work as of now. Pressing Del at the end of line does not merge lines. Keep in mind that St/X editor uses the "sheet of paper" metaphor. Try to
textViewInteractor type: #Delete.
when in the middle of a line and check the character right to cursor has been deleted. This should work.
Yes I remember you telling me that in the original StX this does not work. I have created first attempt to patch this functionality for which I'm writing a test. My idea is that this should work as it works in the StX Workspace
.
comment:7 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | testing → closed |
After using your SimpleViewInteractor_patch.st
which fixes code from "Major cleanup and refactoring of keyboard mapping" (which should be now part of the build).
The original patch libview_fix_1_of_1_rev_57888ed51447_Issue__134__Added_generic_implementation_of___sendKeyOrButtonEvent_____to__DeviceWorkstation_.patch
to this ticket works correctly. The smalltalk injection to the window queue - in the future if there is a C code it can be added to this ticket so we have complete history.
For now, I'm now closing this ticket as fixed.
I just noted that eXept finally had the need to implement this :-) - see Claus's attempt:
I tried to graft them but it does not even compile. Besides, it uses an obsolete API (keybd_event() and mouse_event(). However, it could be a good starting point. Alternatively, we may wait until eXept fixes this and then cherry-pick the code.