DeviceWorkstation.st
branchjv
changeset 8077 08cff8ab7e0a
parent 8057 e3d9945d5d9f
parent 8073 fd95fdcb8533
child 8420 76e39223f5ab
--- a/DeviceWorkstation.st	Wed Jul 19 13:01:28 2017 +0100
+++ b/DeviceWorkstation.st	Tue Aug 15 08:25:53 2017 +0100
@@ -5323,7 +5323,49 @@
      The non-nil case is the lowlevel entry, where state must include any shift/ctrl information
      (not very user friendly)"
 
-    self subclassResponsibility
+    "/ WARNING: this is a generic implementation that completely bypasses underlaying
+    "/ system event queue. It may not be complete - it has been written as a quick hack
+    "/ to make UI testing framework kind-of working on systems where there's no proper
+    "/ implementation of this method (e.g., Windows at the time)
+
+    | view shiftWasDown ctrlWasDown altWasDown metaWasDown |
+
+    view := self viewFromId: targetId.
+
+    [
+        shiftWasDown := shiftDown.
+        altWasDown := altDown.
+        metaWasDown := metaDown.
+        ctrlWasDown := ctrlDown.
+        stateMask notNil ifTrue:[ 
+            shiftDown := (stateMask bitAnd: self shiftModifierMask) ~~ 0.
+            altDown := (stateMask bitAnd: self altModifierMask) ~~ 0.
+            metaDown := (stateMask bitAnd: self metaModifierMask) ~~ 0.
+            ctrlDown := (stateMask bitAnd: self ctrlModifierMask) ~~ 0.
+        ].
+        (typeSymbol == #keyPress or:[ typeSymbol == #keyRelease ]) ifTrue:[
+            | key |
+
+            key := keySymCodeOrButtonNr.
+            (#(Left Right Up Down) includes: key) ifTrue:[ 
+                key := (#Cursor , key) asSymbol.
+            ].
+            typeSymbol == #keyPress ifTrue:[
+                self keyPress:key x:1 y:1 view:view.
+            ] ifFalse:[
+                self keyRelease:key x:1 y:1 view:view.
+            ]
+        ] ifFalse:[  
+            self notYetImplemented.
+        ].
+    ] ensure:[ 
+        shiftDown := shiftWasDown.
+        altDown := altWasDown.
+        metaDown := metaWasDown.
+        ctrlDown := ctrlWasDown.
+    ].
+
+    "Modified (comment): / 06-05-2017 / 11:15:25 / jv"
 !
 
 simulateKeyboardInput:aCharacterOrString inViewId:viewId