On Wed, Jan 27, 2010 at 10:20 PM, Lukas Renggli <renggli@gmail.com> wrote:
Thank you Mariano for debugging this.


You are welcome. Step by step Pharo tests are getting greener :)
It looks to me that the variable scanCode is indeed only used on
Windows, so I guess it is save to change that.

I've committed the fix you suggested:


Thanks!!!
Name: OB-Tests-Morphic-lr.25
Author: lr
Time: 27 January 2010, 10:20:05 pm
UUID: 0987660a-6184-490a-abc0-8d23352c334f
Ancestors: OB-Tests-Morphic-lr.24

- added the suggested fix of mariano for the tests (windows only)

Lukas

2010/1/27 Mariano Martinez Peck <marianopeck@gmail.com>:
> 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
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project