@@ -3,7 +3,7 @@ import { MAX_POINTER_DELTA } from '../../shared/protocol';
33import { createPointerMovementProfile } from './pointer-profile' ;
44
55describe ( 'createPointerMovementProfile' , ( ) => {
6- it ( 'creates sensible deltas for a 1280x720 display at 1.5 scale' , ( ) => {
6+ it ( 'creates display-relative deltas for a 1280x720 display at 1.5 scale' , ( ) => {
77 const profile = createPointerMovementProfile ( {
88 cursor : { x : 100 , y : 100 } ,
99 display : {
@@ -18,17 +18,17 @@ describe('createPointerMovementProfile', () => {
1818 bounds : { x : 0 , y : 0 , width : 1280 , height : 720 } ,
1919 maxDelta : MAX_POINTER_DELTA ,
2020 recommendedDeltas : {
21- small : 32 ,
22- medium : 85 ,
23- large : 187
21+ small : 21 ,
22+ medium : 57 ,
23+ large : 125
2424 } ,
2525 capabilities : {
2626 noAckMouseMove : true
2727 }
2828 } ) ;
2929 } ) ;
3030
31- it ( 'returns native target deltas on a 1x display' , ( ) => {
31+ it ( 'preserves current feel on a 1920x1080 display at 1x scale ' , ( ) => {
3232 expect (
3333 createPointerMovementProfile ( {
3434 cursor : { x : 100 , y : 100 } ,
@@ -38,25 +38,57 @@ describe('createPointerMovementProfile', () => {
3838 }
3939 } ) . recommendedDeltas
4040 ) . toEqual ( {
41- small : 48 ,
42- medium : 128 ,
43- large : 280
41+ small : 49 ,
42+ medium : 130 ,
43+ large : 281
4444 } ) ;
4545 } ) ;
4646
47- it ( 'returns small logical deltas on a 3x display' , ( ) => {
47+ it ( 'returns larger clamped deltas on a 4K display at 1x scale ' , ( ) => {
4848 expect (
4949 createPointerMovementProfile ( {
5050 cursor : { x : 100 , y : 100 } ,
5151 display : {
52- bounds : { x : 0 , y : 0 , width : 1920 , height : 960 } ,
53- scaleFactor : 3
52+ bounds : { x : 0 , y : 0 , width : 3840 , height : 2160 } ,
53+ scaleFactor : 1
54+ }
55+ } ) . recommendedDeltas
56+ ) . toEqual ( {
57+ small : 97 ,
58+ medium : 259 ,
59+ large : MAX_POINTER_DELTA
60+ } ) ;
61+ } ) ;
62+
63+ it ( 'uses the short edge for ultrawide displays' , ( ) => {
64+ expect (
65+ createPointerMovementProfile ( {
66+ cursor : { x : 100 , y : 100 } ,
67+ display : {
68+ bounds : { x : 0 , y : 0 , width : 3440 , height : 1440 } ,
69+ scaleFactor : 1
70+ }
71+ } ) . recommendedDeltas
72+ ) . toEqual ( {
73+ small : 65 ,
74+ medium : 173 ,
75+ large : 374
76+ } ) ;
77+ } ) ;
78+
79+ it ( 'still divides by scale factor on high-DPI displays' , ( ) => {
80+ expect (
81+ createPointerMovementProfile ( {
82+ cursor : { x : 100 , y : 100 } ,
83+ display : {
84+ bounds : { x : 0 , y : 0 , width : 3840 , height : 2160 } ,
85+ scaleFactor : 2
5486 }
5587 } ) . recommendedDeltas
5688 ) . toEqual ( {
57- small : 16 ,
58- medium : 43 ,
59- large : 93
89+ small : 49 ,
90+ medium : 130 ,
91+ large : 281
6092 } ) ;
6193 } ) ;
6294
0 commit comments