Hi Lukas: There are 4 tests that were failing in Windows and I debugged
them. The tests are the 4 tests of the class OBKeyBindingsTest
The problem in windows is this. In your tests, you do:
modifier: mod keycode: code
^ KeyboardEvent new
setType: 'keystroke'
buttons: mod
position: 123 @ 456
keyValue: code
charCode: code
hand: nil
stamp: nil
As you can see, you don't set a codeScan (it is nil).
In Paragraph >> dispatchOnKeyEvent: keyEvent with: typeAheadStream
You do "OSPlatform current virtualKey: keyEvent scanCode."
In mac, everything is ok as it uses the method
OSPlatform >> virtualKey: virtualKeyCode
"Subclass responsibility to override if necessary"
^nil
But in Windows, it uses:
virtualKey: virtualKeyCode
"Win32Platform virtualKey: $C charCode"
(virtualKeyCode <= 90 "$Z charCode"
and: [virtualKeyCode >= 65 "$A "])
ifFalse: [^nil].
"#($a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w
$x $y $z)"
^(#($a nil $c $d nil $f $g nil nil nil nil $l $m $n nil $p nil nil $s
nil nil $v nil $x nil $z)
at: virtualKeyCode-64) ifNotNil: [:char | char charCode]
There, is a DNU as nil (virtualKeyCode) dnu: <=
So, the solution I think is to set a scanCode in the keyEvents you generate
in the tests. I don't know which number is correct for each type of event,
but I tried just with 0 and tests are green.
modifier: mod keycode: code
^ KeyboardEvent new
setType: 'keystroke'
buttons: mod
position: 123 @ 456
keyValue: code
charCode: code
hand: nil
stamp: nil;
scanCode: 0
What do you think? is there a better fix ?
Cheers
Mariano
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project