Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/test/browser/ui/scrollbar/scrollableElement.test.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import assert from 'assert';
7
import { MouseWheelClassifier } from '../../../../browser/ui/scrollbar/scrollableElement.js';
8
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../common/utils.js';
9
10
export type IMouseWheelEvent = [number, number, number];
11
12
suite('MouseWheelClassifier', () => {
13
14
ensureNoDisposablesAreLeakedInTestSuite();
15
16
test('OSX - Apple Magic Mouse', () => {
17
const testData: IMouseWheelEvent[] = [
18
[1503409622410, -0.025, 0],
19
[1503409622435, -0.175, 0],
20
[1503409622446, -0.225, 0],
21
[1503409622489, -0.65, 0],
22
[1503409622514, -1.225, 0],
23
[1503409622537, -1.025, 0],
24
[1503409622543, -0.55, 0],
25
[1503409622587, -0.75, 0],
26
[1503409622623, -1.45, 0],
27
[1503409622641, -1.325, 0],
28
[1503409622663, -0.6, 0],
29
[1503409622681, -1.125, 0],
30
[1503409622703, -0.5166666666666667, 0],
31
[1503409622721, -0.475, 0],
32
[1503409622822, -0.425, 0],
33
[1503409622871, -1.9916666666666667, 0],
34
[1503409622933, -0.7, 0],
35
[1503409622991, -0.725, 0],
36
[1503409623032, -0.45, 0],
37
[1503409623083, -0.25, 0],
38
[1503409623122, -0.4, 0],
39
[1503409623176, -0.2, 0],
40
[1503409623197, -0.225, 0],
41
[1503409623219, -0.05, 0],
42
[1503409623249, -0.1, 0],
43
[1503409623278, -0.1, 0],
44
[1503409623292, -0.025, 0],
45
[1503409623315, -0.025, 0],
46
[1503409623324, -0.05, 0],
47
[1503409623356, -0.025, 0],
48
[1503409623415, -0.025, 0],
49
[1503409623443, -0.05, 0],
50
[1503409623452, -0.025, 0],
51
];
52
53
const classifier = new MouseWheelClassifier();
54
for (let i = 0, len = testData.length; i < len; i++) {
55
const [timestamp, deltaY, deltaX] = testData[i];
56
classifier.accept(timestamp, deltaX, deltaY);
57
58
const actual = classifier.isPhysicalMouseWheel();
59
assert.strictEqual(actual, false, `i = ${i}`);
60
}
61
});
62
63
test('OSX - Apple Touch Pad', () => {
64
const testData: IMouseWheelEvent[] = [
65
[1503409780792, 0.025, 0],
66
[1503409780808, 0.175, -0.025],
67
[1503409780811, 0.35, -0.05],
68
[1503409780816, 0.55, -0.075],
69
[1503409780836, 0.825, -0.1],
70
[1503409780840, 0.725, -0.075],
71
[1503409780842, 1.5, -0.125],
72
[1503409780848, 1.1, -0.1],
73
[1503409780877, 2.05, -0.1],
74
[1503409780882, 3.9, 0],
75
[1503409780908, 3.825, 0],
76
[1503409780915, 3.65, 0],
77
[1503409780940, 3.45, 0],
78
[1503409780949, 3.25, 0],
79
[1503409780979, 3.075, 0],
80
[1503409780982, 2.9, 0],
81
[1503409781016, 2.75, 0],
82
[1503409781018, 2.625, 0],
83
[1503409781051, 2.5, 0],
84
[1503409781071, 2.4, 0],
85
[1503409781089, 2.3, 0],
86
[1503409781111, 2.175, 0],
87
[1503409781140, 3.975, 0],
88
[1503409781165, 1.8, 0],
89
[1503409781183, 3.3, 0],
90
[1503409781202, 1.475, 0],
91
[1503409781223, 1.375, 0],
92
[1503409781244, 1.275, 0],
93
[1503409781269, 2.25, 0],
94
[1503409781285, 1.025, 0],
95
[1503409781300, 0.925, 0],
96
[1503409781303, 0.875, 0],
97
[1503409781321, 0.8, 0],
98
[1503409781333, 0.725, 0],
99
[1503409781355, 0.65, 0],
100
[1503409781370, 0.6, 0],
101
[1503409781384, 0.55, 0],
102
[1503409781410, 0.5, 0],
103
[1503409781422, 0.475, 0],
104
[1503409781435, 0.425, 0],
105
[1503409781454, 0.4, 0],
106
[1503409781470, 0.35, 0],
107
[1503409781486, 0.325, 0],
108
[1503409781501, 0.3, 0],
109
[1503409781519, 0.275, 0],
110
[1503409781534, 0.25, 0],
111
[1503409781553, 0.225, 0],
112
[1503409781569, 0.2, 0],
113
[1503409781589, 0.2, 0],
114
[1503409781601, 0.175, 0],
115
[1503409781621, 0.15, 0],
116
[1503409781631, 0.15, 0],
117
[1503409781652, 0.125, 0],
118
[1503409781667, 0.125, 0],
119
[1503409781685, 0.125, 0],
120
[1503409781703, 0.1, 0],
121
[1503409781715, 0.1, 0],
122
[1503409781734, 0.1, 0],
123
[1503409781753, 0.075, 0],
124
[1503409781768, 0.075, 0],
125
[1503409781783, 0.075, 0],
126
[1503409781801, 0.075, 0],
127
[1503409781815, 0.05, 0],
128
[1503409781836, 0.05, 0],
129
[1503409781850, 0.05, 0],
130
[1503409781865, 0.05, 0],
131
[1503409781880, 0.05, 0],
132
[1503409781899, 0.025, 0],
133
[1503409781916, 0.025, 0],
134
[1503409781933, 0.025, 0],
135
[1503409781952, 0.025, 0],
136
[1503409781965, 0.025, 0],
137
[1503409781996, 0.025, 0],
138
[1503409782015, 0.025, 0],
139
[1503409782045, 0.025, 0],
140
];
141
142
const classifier = new MouseWheelClassifier();
143
for (let i = 0, len = testData.length; i < len; i++) {
144
const [timestamp, deltaY, deltaX] = testData[i];
145
classifier.accept(timestamp, deltaX, deltaY);
146
147
const actual = classifier.isPhysicalMouseWheel();
148
assert.strictEqual(actual, false, `i = ${i}`);
149
}
150
});
151
152
test('OSX - Razer Physical Mouse Wheel', () => {
153
const testData: IMouseWheelEvent[] = [
154
[1503409880776, -1, 0],
155
[1503409880791, -1, 0],
156
[1503409880810, -4, 0],
157
[1503409880820, -5, 0],
158
[1503409880848, -6, 0],
159
[1503409880876, -7, 0],
160
[1503409881319, -1, 0],
161
[1503409881387, -1, 0],
162
[1503409881407, -2, 0],
163
[1503409881443, -4, 0],
164
[1503409881444, -5, 0],
165
[1503409881470, -6, 0],
166
[1503409881496, -7, 0],
167
[1503409881812, -1, 0],
168
[1503409881829, -1, 0],
169
[1503409881850, -4, 0],
170
[1503409881871, -5, 0],
171
[1503409881896, -13, 0],
172
[1503409881914, -16, 0],
173
[1503409882551, -1, 0],
174
[1503409882589, -1, 0],
175
[1503409882625, -2, 0],
176
[1503409883035, -1, 0],
177
[1503409883098, -1, 0],
178
[1503409883143, -2, 0],
179
[1503409883217, -2, 0],
180
[1503409883270, -3, 0],
181
[1503409883388, -3, 0],
182
[1503409883531, -3, 0],
183
[1503409884095, -1, 0],
184
[1503409884122, -1, 0],
185
[1503409884160, -3, 0],
186
[1503409884208, -4, 0],
187
[1503409884292, -4, 0],
188
[1503409884447, -1, 0],
189
[1503409884788, -1, 0],
190
[1503409884835, -1, 0],
191
[1503409884898, -2, 0],
192
[1503409884965, -3, 0],
193
[1503409885085, -2, 0],
194
[1503409885552, -1, 0],
195
[1503409885619, -1, 0],
196
[1503409885670, -1, 0],
197
[1503409885733, -2, 0],
198
[1503409885784, -4, 0],
199
[1503409885916, -3, 0],
200
];
201
202
const classifier = new MouseWheelClassifier();
203
for (let i = 0, len = testData.length; i < len; i++) {
204
const [timestamp, deltaY, deltaX] = testData[i];
205
classifier.accept(timestamp, deltaX, deltaY);
206
207
const actual = classifier.isPhysicalMouseWheel();
208
assert.strictEqual(actual, true, `i = ${i}`);
209
210
}
211
});
212
213
test('Windows - Microsoft Arc Touch', () => {
214
const testData: IMouseWheelEvent[] = [
215
[1503418316909, -2, 0],
216
[1503418316985, -2, 0],
217
[1503418316988, -4, 0],
218
[1503418317034, -2, 0],
219
[1503418317071, -2, 0],
220
[1503418317094, -2, 0],
221
[1503418317133, -2, 0],
222
[1503418317170, -2, 0],
223
[1503418317192, -2, 0],
224
[1503418317265, -2, 0],
225
[1503418317289, -2, 0],
226
[1503418317365, -2, 0],
227
[1503418317414, -2, 0],
228
[1503418317458, -2, 0],
229
[1503418317513, -2, 0],
230
[1503418317583, -2, 0],
231
[1503418317637, -2, 0],
232
[1503418317720, -2, 0],
233
[1503418317786, -2, 0],
234
[1503418317832, -2, 0],
235
[1503418317933, -2, 0],
236
[1503418318037, -2, 0],
237
[1503418318134, -2, 0],
238
[1503418318267, -2, 0],
239
[1503418318411, -2, 0],
240
];
241
242
const classifier = new MouseWheelClassifier();
243
for (let i = 0, len = testData.length; i < len; i++) {
244
const [timestamp, deltaY, deltaX] = testData[i];
245
classifier.accept(timestamp, deltaX, deltaY);
246
247
const actual = classifier.isPhysicalMouseWheel();
248
assert.strictEqual(actual, true, `i = ${i}`);
249
250
}
251
});
252
253
test('Windows - SurfaceBook TouchPad', () => {
254
const testData: IMouseWheelEvent[] = [
255
[1503418499174, -3.35, 0],
256
[1503418499177, -0.9333333333333333, 0],
257
[1503418499222, -2.091666666666667, 0],
258
[1503418499238, -1.5666666666666667, 0],
259
[1503418499242, -1.8, 0],
260
[1503418499271, -2.5166666666666666, 0],
261
[1503418499283, -0.7666666666666667, 0],
262
[1503418499308, -2.033333333333333, 0],
263
[1503418499320, -2.85, 0],
264
[1503418499372, -1.5333333333333334, 0],
265
[1503418499373, -2.8, 0],
266
[1503418499411, -1.6166666666666667, 0],
267
[1503418499413, -1.9166666666666667, 0],
268
[1503418499443, -0.9333333333333333, 0],
269
[1503418499446, -0.9833333333333333, 0],
270
[1503418499458, -0.7666666666666667, 0],
271
[1503418499482, -0.9666666666666667, 0],
272
[1503418499485, -0.36666666666666664, 0],
273
[1503418499508, -0.5833333333333334, 0],
274
[1503418499532, -0.48333333333333334, 0],
275
[1503418499541, -0.6333333333333333, 0],
276
[1503418499571, -0.18333333333333332, 0],
277
[1503418499573, -0.4, 0],
278
[1503418499595, -0.15, 0],
279
[1503418499608, -0.23333333333333334, 0],
280
[1503418499625, -0.18333333333333332, 0],
281
[1503418499657, -0.13333333333333333, 0],
282
[1503418499674, -0.15, 0],
283
[1503418499676, -0.03333333333333333, 0],
284
[1503418499691, -0.016666666666666666, 0],
285
];
286
287
const classifier = new MouseWheelClassifier();
288
for (let i = 0, len = testData.length; i < len; i++) {
289
const [timestamp, deltaY, deltaX] = testData[i];
290
classifier.accept(timestamp, deltaX, deltaY);
291
292
const actual = classifier.isPhysicalMouseWheel();
293
assert.strictEqual(actual, false, `i = ${i}`);
294
}
295
});
296
297
test('Windows - Razer physical wheel', () => {
298
const testData: IMouseWheelEvent[] = [
299
[1503418638271, -2, 0],
300
[1503418638317, -2, 0],
301
[1503418638336, -2, 0],
302
[1503418638350, -2, 0],
303
[1503418638360, -2, 0],
304
[1503418638366, -2, 0],
305
[1503418638407, -2, 0],
306
[1503418638694, -2, 0],
307
[1503418638742, -2, 0],
308
[1503418638744, -2, 0],
309
[1503418638746, -2, 0],
310
[1503418638780, -2, 0],
311
[1503418638782, -2, 0],
312
[1503418638810, -2, 0],
313
[1503418639127, -2, 0],
314
[1503418639168, -2, 0],
315
[1503418639194, -2, 0],
316
[1503418639197, -4, 0],
317
[1503418639244, -2, 0],
318
[1503418639248, -2, 0],
319
[1503418639586, -2, 0],
320
[1503418639653, -2, 0],
321
[1503418639667, -4, 0],
322
[1503418639677, -2, 0],
323
[1503418639681, -2, 0],
324
[1503418639728, -2, 0],
325
[1503418639997, -2, 0],
326
[1503418640034, -2, 0],
327
[1503418640039, -2, 0],
328
[1503418640065, -2, 0],
329
[1503418640080, -2, 0],
330
[1503418640097, -2, 0],
331
[1503418640141, -2, 0],
332
[1503418640413, -2, 0],
333
[1503418640456, -2, 0],
334
[1503418640490, -2, 0],
335
[1503418640492, -4, 0],
336
[1503418640494, -2, 0],
337
[1503418640546, -2, 0],
338
[1503418640781, -2, 0],
339
[1503418640823, -2, 0],
340
[1503418640824, -2, 0],
341
[1503418640829, -2, 0],
342
[1503418640864, -2, 0],
343
[1503418640874, -2, 0],
344
[1503418640876, -2, 0],
345
[1503418641168, -2, 0],
346
[1503418641203, -2, 0],
347
[1503418641224, -2, 0],
348
[1503418641240, -2, 0],
349
[1503418641254, -4, 0],
350
[1503418641270, -2, 0],
351
[1503418641546, -2, 0],
352
[1503418641612, -2, 0],
353
[1503418641625, -6, 0],
354
[1503418641634, -2, 0],
355
[1503418641680, -2, 0],
356
[1503418641961, -2, 0],
357
[1503418642004, -2, 0],
358
[1503418642016, -4, 0],
359
[1503418642044, -2, 0],
360
[1503418642065, -2, 0],
361
[1503418642083, -2, 0],
362
[1503418642349, -2, 0],
363
[1503418642378, -2, 0],
364
[1503418642390, -2, 0],
365
[1503418642408, -2, 0],
366
[1503418642413, -2, 0],
367
[1503418642448, -2, 0],
368
[1503418642468, -2, 0],
369
[1503418642746, -2, 0],
370
[1503418642800, -2, 0],
371
[1503418642814, -4, 0],
372
[1503418642816, -2, 0],
373
[1503418642857, -2, 0],
374
];
375
376
const classifier = new MouseWheelClassifier();
377
for (let i = 0, len = testData.length; i < len; i++) {
378
const [timestamp, deltaY, deltaX] = testData[i];
379
classifier.accept(timestamp, deltaX, deltaY);
380
381
const actual = classifier.isPhysicalMouseWheel();
382
assert.strictEqual(actual, true, `i = ${i}`);
383
384
}
385
});
386
387
test('Windows - Logitech physical wheel', () => {
388
const testData: IMouseWheelEvent[] = [
389
[1503418872930, -2, 0],
390
[1503418872952, -2, 0],
391
[1503418872969, -2, 0],
392
[1503418873022, -2, 0],
393
[1503418873042, -2, 0],
394
[1503418873076, -2, 0],
395
[1503418873368, -2, 0],
396
[1503418873393, -2, 0],
397
[1503418873404, -2, 0],
398
[1503418873425, -2, 0],
399
[1503418873479, -2, 0],
400
[1503418873520, -2, 0],
401
[1503418873758, -2, 0],
402
[1503418873759, -2, 0],
403
[1503418873762, -2, 0],
404
[1503418873807, -2, 0],
405
[1503418873830, -4, 0],
406
[1503418873850, -2, 0],
407
[1503418874076, -2, 0],
408
[1503418874116, -2, 0],
409
[1503418874136, -4, 0],
410
[1503418874148, -2, 0],
411
[1503418874150, -2, 0],
412
[1503418874409, -2, 0],
413
[1503418874452, -2, 0],
414
[1503418874472, -2, 0],
415
[1503418874474, -4, 0],
416
[1503418874543, -2, 0],
417
[1503418874566, -2, 0],
418
[1503418874778, -2, 0],
419
[1503418874780, -2, 0],
420
[1503418874801, -2, 0],
421
[1503418874822, -2, 0],
422
[1503418874832, -2, 0],
423
[1503418874845, -2, 0],
424
[1503418875122, -2, 0],
425
[1503418875158, -2, 0],
426
[1503418875180, -2, 0],
427
[1503418875195, -4, 0],
428
[1503418875239, -2, 0],
429
[1503418875260, -2, 0],
430
[1503418875490, -2, 0],
431
[1503418875525, -2, 0],
432
[1503418875547, -4, 0],
433
[1503418875556, -4, 0],
434
[1503418875630, -2, 0],
435
[1503418875852, -2, 0],
436
[1503418875895, -2, 0],
437
[1503418875935, -2, 0],
438
[1503418875941, -4, 0],
439
[1503418876198, -2, 0],
440
[1503418876242, -2, 0],
441
[1503418876270, -4, 0],
442
[1503418876279, -2, 0],
443
[1503418876333, -2, 0],
444
[1503418876342, -2, 0],
445
[1503418876585, -2, 0],
446
[1503418876609, -2, 0],
447
[1503418876623, -2, 0],
448
[1503418876644, -2, 0],
449
[1503418876646, -2, 0],
450
[1503418876678, -2, 0],
451
[1503418877330, -2, 0],
452
[1503418877354, -2, 0],
453
[1503418877368, -2, 0],
454
[1503418877397, -2, 0],
455
[1503418877411, -2, 0],
456
[1503418877748, -2, 0],
457
[1503418877756, -2, 0],
458
[1503418877778, -2, 0],
459
[1503418877793, -2, 0],
460
[1503418877807, -2, 0],
461
[1503418878091, -2, 0],
462
[1503418878133, -2, 0],
463
[1503418878137, -4, 0],
464
[1503418878181, -2, 0],
465
];
466
467
const classifier = new MouseWheelClassifier();
468
for (let i = 0, len = testData.length; i < len; i++) {
469
const [timestamp, deltaY, deltaX] = testData[i];
470
classifier.accept(timestamp, deltaX, deltaY);
471
472
const actual = classifier.isPhysicalMouseWheel();
473
assert.strictEqual(actual, true, `i = ${i}`);
474
475
}
476
});
477
478
test('Windows - Microsoft basic v2 physical wheel', () => {
479
const testData: IMouseWheelEvent[] = [
480
[1503418994564, -2, 0],
481
[1503418994643, -2, 0],
482
[1503418994676, -2, 0],
483
[1503418994691, -2, 0],
484
[1503418994727, -2, 0],
485
[1503418994799, -2, 0],
486
[1503418994850, -2, 0],
487
[1503418995259, -2, 0],
488
[1503418995321, -2, 0],
489
[1503418995328, -2, 0],
490
[1503418995343, -2, 0],
491
[1503418995402, -2, 0],
492
[1503418995454, -2, 0],
493
[1503418996052, -2, 0],
494
[1503418996095, -2, 0],
495
[1503418996107, -2, 0],
496
[1503418996120, -2, 0],
497
[1503418996146, -2, 0],
498
[1503418996471, -2, 0],
499
[1503418996530, -2, 0],
500
[1503418996549, -2, 0],
501
[1503418996561, -2, 0],
502
[1503418996571, -2, 0],
503
[1503418996636, -2, 0],
504
[1503418996936, -2, 0],
505
[1503418997002, -2, 0],
506
[1503418997006, -2, 0],
507
[1503418997043, -2, 0],
508
[1503418997045, -2, 0],
509
[1503418997092, -2, 0],
510
[1503418997357, -2, 0],
511
[1503418997394, -2, 0],
512
[1503418997410, -2, 0],
513
[1503418997426, -2, 0],
514
[1503418997442, -2, 0],
515
[1503418997486, -2, 0],
516
[1503418997757, -2, 0],
517
[1503418997807, -2, 0],
518
[1503418997813, -2, 0],
519
[1503418997850, -2, 0],
520
];
521
522
const classifier = new MouseWheelClassifier();
523
for (let i = 0, len = testData.length; i < len; i++) {
524
const [timestamp, deltaY, deltaX] = testData[i];
525
classifier.accept(timestamp, deltaX, deltaY);
526
527
const actual = classifier.isPhysicalMouseWheel();
528
assert.strictEqual(actual, true, `i = ${i}`);
529
}
530
});
531
532
test('Linux Wayland - Logitech G Pro Wireless', () => {
533
const testData: IMouseWheelEvent[] = [
534
[1707837460397, -1.5, 0],
535
[1707837460449, -1.5, 0],
536
[1707837460498, -1.5, 0],
537
[1707837460553, -1.5, 0],
538
[1707837460574, -1.5, 0],
539
[1707837460602, -1.5, 0],
540
[1707837460623, -1.5, 0],
541
[1707837460643, -1.5, 0],
542
[1707837460664, -1.5, 0],
543
[1707837460685, -1.5, 0],
544
[1707837460713, -1.5, 0],
545
[1707837460762, -1.5, 0],
546
[1707837460978, 1.5, 0],
547
[1707837460998, 1.5, 0],
548
[1707837461012, 1.5, 0],
549
[1707837461025, 1.5, 0],
550
[1707837461032, 1.5, 0],
551
[1707837461046, 1.5, 0],
552
[1707837461067, 1.5, 0],
553
[1707837461081, 1.5, 0],
554
[1707837461095, 1.5, 0],
555
[1707837461123, 1.5, 0],
556
[1707837461157, 1.5, 0],
557
[1707837461219, 1.5, 0],
558
[1707837461288, -1.5, 0],
559
[1707837461324, -1.5, 0],
560
[1707837461338, -1.5, 0],
561
[1707837461352, -1.5, 0],
562
[1707837461366, -1.5, 0],
563
[1707837461373, -1.5, 0],
564
[1707837461387, -1.5, 0],
565
[1707837461394, -1.5, 0],
566
[1707837461400, -1.5, 0],
567
[1707837461407, -1.5, 0],
568
[1707837461414, -1.5, 0],
569
[1707837461442, -1.5, 0],
570
[1707837461525, 1.5, 0],
571
[1707837461532, 1.5, 0],
572
[1707837461539, 1.5, 0],
573
[1707837461546, 1.5, 0],
574
[1707837461553, 1.5, 0],
575
[1707837461560, 1.5, 0],
576
[1707837461567, 1.5, 0],
577
[1707837461574, 1.5, 0],
578
[1707837461581, 1.5, 0],
579
[1707837461664, -1.5, 0],
580
[1707837461678, -1.5, 0],
581
[1707837461685, -1.5, 0],
582
[1707837461692, -1.5, 0],
583
[1707837461699, -1.5, 0],
584
[1707837461706, -1.5, 0],
585
[1707837461713, -1.5, 0],
586
[1707837461720, -1.5, 0],
587
[1707837461727, -1.5, 0],
588
[1707837461803, 1.5, 0],
589
[1707837461810, 1.5, 0],
590
[1707837461817, 1.5, 0],
591
[1707837461824, 1.5, 0],
592
[1707837461831, 1.5, 0],
593
[1707837461838, 1.5, 0],
594
[1707837461845, 1.5, 0],
595
[1707837461852, 3, 0],
596
[1707837461873, 1.5, 0],
597
[1707837461942, -1.5, 0],
598
[1707837461949, -1.5, 0],
599
[1707837461956, -1.5, 0],
600
[1707837461963, -1.5, 0],
601
[1707837461970, -1.5, 0],
602
[1707837461977, -3, 0],
603
[1707837461984, -1.5, 0],
604
[1707837461991, -1.5, 0],
605
[1707837462081, 1.5, 0],
606
[1707837462088, 1.5, 0],
607
[1707837462241, -1.5, 0],
608
[1707837462253, -1.5, 0],
609
[1707837462256, -1.5, 0],
610
[1707837462262, -1.5, 0],
611
[1707837462268, -1.5, 0],
612
[1707837462276, -1.5, 0],
613
[1707837462282, -4.5, 0],
614
[1707837462292, -3, 0],
615
[1707837462300, -1.5, 0],
616
[1707837462485, -1.5, 0],
617
[1707837462492, -1.5, 0],
618
[1707837462498, -1.5, 0],
619
[1707837462505, -1.5, 0],
620
[1707837462511, -1.5, 0],
621
[1707837462518, -3, 0],
622
[1707837462525, -3, 0],
623
[1707837462532, -1.5, 0],
624
[1707837462741, -1.5, 0],
625
[1707837462755, -1.5, 0],
626
[1707837462761, -1.5, 0],
627
[1707837462768, -1.5, 0],
628
[1707837462775, -1.5, 0],
629
[1707837462909, 1.5, 0],
630
[1707837462921, 1.5, 0],
631
[1707837462928, 1.5, 0],
632
[1707837462935, 3, 0],
633
[1707837462942, 3, 0],
634
[1707837462949, 1.5, 0],
635
[1707837462956, 1.5, 0],
636
[1707837462963, 1.5, 0],
637
[1707837462970, 1.5, 0],
638
[1707837463180, 1.5, 0],
639
[1707837463188, 1.5, 0],
640
[1707837463194, 1.5, 0],
641
[1707837463199, 1.5, 0],
642
[1707837463206, 1.5, 0],
643
[1707837463213, 1.5, 0],
644
[1707837463220, 1.5, 0],
645
[1707837463227, 1.5, 0],
646
[1707837463234, 1.5, 0],
647
[1707837463241, 1.5, 0],
648
[1707837463426, 1.5, 0],
649
[1707837463434, 1.5, 0],
650
[1707837463440, 1.5, 0],
651
[1707837463446, 1.5, 0],
652
[1707837463451, 1.5, 0],
653
[1707837463456, 1.5, 0],
654
[1707837463463, 1.5, 0],
655
[1707837463470, 1.5, 0],
656
[1707837463477, 1.5, 0],
657
[1707837463766, 1.5, 0],
658
[1707837463774, 1.5, 0],
659
[1707837463781, 1.5, 0],
660
[1707837463786, 1.5, 0],
661
[1707837463792, 1.5, 0],
662
[1707837463797, 1.5, 0],
663
[1707837463804, 1.5, 0],
664
[1707837463817, 1.5, 0],
665
[1707837463940, -1.5, 0],
666
[1707837463956, -1.5, 0],
667
[1707837463963, -1.5, 0],
668
[1707837463977, -1.5, 0],
669
[1707837463984, -1.5, 0],
670
[1707837463991, -3, 0],
671
[1707837463998, -1.5, 0],
672
[1707837464005, -1.5, 0],
673
[1707837464185, -1.5, 0],
674
[1707837464192, -1.5, 0],
675
[1707837464199, -1.5, 0],
676
[1707837464206, -1.5, 0],
677
[1707837464213, -1.5, 0],
678
[1707837464220, -3, 0],
679
[1707837464227, -1.5, 0],
680
[1707837464392, -1.5, 0],
681
[1707837464399, -1.5, 0],
682
[1707837464405, -1.5, 0],
683
[1707837464409, -1.5, 0],
684
[1707837464414, -1.5, 0],
685
[1707837464421, -1.5, 0],
686
[1707837464430, -1.5, 0],
687
[1707837464577, 1.5, 0],
688
[1707837464588, 1.5, 0],
689
[1707837464595, 1.5, 0],
690
[1707837464602, 1.5, 0],
691
[1707837464609, 1.5, 0],
692
[1707837464616, 1.5, 0],
693
[1707837464623, 3, 0],
694
[1707837464630, 1.5, 0],
695
[1707837464637, 1.5, 0],
696
[1707837464838, 1.5, 0],
697
[1707837464845, 1.5, 0],
698
[1707837464852, 1.5, 0],
699
[1707837464859, 1.5, 0],
700
[1707837464866, 3, 0],
701
[1707837464872, 1.5, 0],
702
[1707837464879, 1.5, 0],
703
[1707837464886, 1.5, 0],
704
[1707837464893, 1.5, 0],
705
[1707837465084, 1.5, 0],
706
[1707837465091, 1.5, 0],
707
[1707837465097, 1.5, 0],
708
[1707837465102, 1.5, 0],
709
[1707837465109, 1.5, 0],
710
[1707837465116, 1.5, 0],
711
[1707837465122, 1.5, 0],
712
[1707837465129, 1.5, 0],
713
[1707837465136, 1.5, 0],
714
[1707837465157, 1.5, 0],
715
];
716
717
const classifier = new MouseWheelClassifier();
718
for (let i = 0, len = testData.length; i < len; i++) {
719
const [timestamp, deltaY, deltaX] = testData[i];
720
classifier.accept(timestamp, deltaX, deltaY);
721
722
const actual = classifier.isPhysicalMouseWheel();
723
724
// Linux Wayland implementation depends on looking at the
725
// previous event.
726
if (i > 0) {
727
assert.strictEqual(actual, true, `i = ${i}`);
728
}
729
}
730
});
731
732
});
733
734