From 4dec88212e4e598ade894ac28ee5f514ff2daa8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 1 Aug 2019 01:16:29 +0200 Subject: [PATCH] fix mouse tests --- test/api/MouseTracking.api.ts | 566 +++++++++++++--------------------- 1 file changed, 218 insertions(+), 348 deletions(-) diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 266edff7..c5ec505d 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -86,15 +86,25 @@ async function mouseUp(button: 'left' | 'right' | 'middle' | undefined): Promise } async function wheelUp(): Promise { const self = (page.mouse as any); - return await page.evaluate(` - window.term.element.dispatchEvent(new WheelEvent('wheel', {clientX: ${self._x}, clientY: ${self._y}, deltaX: 0, deltaY: -10, modifiers: ${self._keyboard._modifiers}})); - `); + return await self._client.send('Input.dispatchMouseEvent', { + type: 'mouseWheel', + x: self._x, + y: self._y, + deltaX: 0, + deltaY: -10, + modifiers: self._keyboard._modifiers + }); } async function wheelDown(): Promise { const self = (page.mouse as any); - return await page.evaluate(` - window.term.element.dispatchEvent(new WheelEvent('wheel', {clientX: ${self._x}, clientY: ${self._y}, deltaX: 0, deltaY: 10, modifiers: ${self._keyboard._modifiers}})); - `); + return await self._client.send('Input.dispatchMouseEvent', { + type: 'mouseWheel', + x: self._x, + y: self._y, + deltaX: 0, + deltaY: 10, + modifiers: self._keyboard._modifiers + }); } // button definitions @@ -134,7 +144,7 @@ function evalButtonCode(code: number): any { button |= 8; } if (code & 64) { - button |= 4 + button |= 4; } let actionS = 'press'; let buttonS = reverseButtons[button]; @@ -190,7 +200,7 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; case 'URXVT': sReport = report.slice(2, -1); [buttonCode, col, row] = sReport.split(';').map(el => parseInt(el)); - return {state: evalButtonCode(buttonCode - 32), row: --row, col: --col}; // FIXME: remove -1 here when fixed! + return {state: evalButtonCode(buttonCode - 32), row, col}; default: return { state: evalButtonCode(report.charCodeAt(3) - 32), @@ -348,23 +358,22 @@ describe('Mouse Tracking Tests', function(): void { {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); } - /* + // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - reporting totally wrong coords and modifiers - selection manager again? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - */ }); it('UTF8 encoding', async () => { const encoding = 'UTF8'; @@ -467,23 +476,22 @@ describe('Mouse Tracking Tests', function(): void { {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); } - /* + // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - reporting totally wrong coords and modifiers - selection manager again? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - */ }); it('SGR encoding', async () => { const encoding = 'SGR'; @@ -586,23 +594,22 @@ describe('Mouse Tracking Tests', function(): void { {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); } - /* + // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - reporting totally wrong coords and modifiers - selection manager again? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - */ }); it('URXVT encoding', async () => { // bug: always reports +1 for row/col (temp. fixed in parseReport to pass tests) @@ -706,23 +713,22 @@ describe('Mouse Tracking Tests', function(): void { {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); } - /* + // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - reporting totally wrong coords and modifiers - selection manager again? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - */ }); }); describe('DECSET 1000 (VT200 mouse)', () => { @@ -740,17 +746,16 @@ describe('Mouse Tracking Tests', function(): void { await page.evaluate(`window.term.write('\x1b[?1000h');`); // test at 0,0 - // bug: release is fired immediately - expected: only press event await mouseDown('left'); assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mouseup should report, encoding cannot report released button - // bug: release already fired thus no event here - expected: release event await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); + assert.deepEqual(await getReports(encoding), [ + {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + ]); // mousemove should not report await mouseMove(50, 10); @@ -775,7 +780,6 @@ describe('Mouse Tracking Tests', function(): void { // button press/move/release tests // left button - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('left'); @@ -783,7 +787,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('left'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -795,7 +799,6 @@ describe('Mouse Tracking Tests', function(): void { // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); // right button // bug: default action not cancelled (popup shown) - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('right'); @@ -803,7 +806,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('right'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // wheel @@ -816,28 +819,21 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action, reports wrong coords for release - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported, release with wrong coords await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -847,13 +843,9 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT @@ -869,37 +861,35 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - selection manager? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); it('UTF8 encoding', async () => { const encoding = 'UTF8'; @@ -908,17 +898,16 @@ describe('Mouse Tracking Tests', function(): void { await page.evaluate(`window.term.write('\x1b[?1000h\x1b[?1005h');`); // test at 0,0 - // bug: release is fired immediately - expected: only press event await mouseDown('left'); assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mouseup should report, encoding cannot report released button - // bug: release already fired thus no event here - expected: release event await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); + assert.deepEqual(await getReports(encoding), [ + {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + ]); // mousemove should not report await mouseMove(50, 10); @@ -941,7 +930,6 @@ describe('Mouse Tracking Tests', function(): void { // button press/move/release tests // left button - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('left'); @@ -949,7 +937,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('left'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -961,7 +949,6 @@ describe('Mouse Tracking Tests', function(): void { // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); // right button // bug: default action not cancelled (popup shown) - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('right'); @@ -969,7 +956,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('right'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // wheel @@ -982,28 +969,21 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action, reports wrong coords for release - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported, release with wrong coords await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -1013,18 +993,13 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT // note: press/release caught by selection manager - // bug: modifier not reported for passed events await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Shift'); // defaults to ShiftLeft @@ -1035,37 +1010,35 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - selection manager? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); it('SGR encoding', async () => { const encoding = 'SGR'; @@ -1074,17 +1047,16 @@ describe('Mouse Tracking Tests', function(): void { await page.evaluate(`window.term.write('\x1b[?1000h\x1b[?1006h');`); // test at 0,0 - // bug: release is fired immediately - expected: only press event await mouseDown('left'); assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mouseup should report - // bug: release already fired thus no event here - expected: release event await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); + assert.deepEqual(await getReports(encoding), [ + {col: 1, row: 1, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + ]); // mousemove should not report await mouseMove(50, 10); @@ -1107,7 +1079,6 @@ describe('Mouse Tracking Tests', function(): void { // button press/move/release tests // left button - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('left'); @@ -1115,7 +1086,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('left'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1127,8 +1098,6 @@ describe('Mouse Tracking Tests', function(): void { // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); // right button // bug: default action not cancelled (popup shown) - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 - // bug: release reports wrong button await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('right'); @@ -1136,7 +1105,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('right'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: 'right', modifier: {control: false, shift: false, meta: false}}} ]); // wheel @@ -1149,28 +1118,21 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action, reports wrong coords for release - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported, release with wrong coords await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -1180,18 +1142,13 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT // note: press/release caught by selection manager - // bug: modifier not reported for passed events await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Shift'); // defaults to ShiftLeft @@ -1202,37 +1159,35 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - selection manager? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); it('URXVT encoding', async () => { const encoding = 'URXVT'; @@ -1241,17 +1196,16 @@ describe('Mouse Tracking Tests', function(): void { await page.evaluate(`window.term.write('\x1b[?1000h\x1b[?1015h');`); // test at 0,0 - // bug: release is fired immediately - expected: only press event await mouseDown('left'); assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} ]); // mouseup should report, encoding cannot report released button - // bug: release already fired thus no event here - expected: release event await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); + assert.deepEqual(await getReports(encoding), [ + {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + ]); // mousemove should not report await mouseMove(50, 10); @@ -1274,7 +1228,6 @@ describe('Mouse Tracking Tests', function(): void { // button press/move/release tests // left button - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('left'); @@ -1282,7 +1235,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('left'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // middle button // bug: default action not cancelled (adds data to getReports from clipboard under X11) @@ -1294,7 +1247,6 @@ describe('Mouse Tracking Tests', function(): void { // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); // right button // bug: default action not cancelled (popup shown) - // bug: release is fired immediately thus with wrong coords - expected: col in release event should be 45 await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('right'); @@ -1302,7 +1254,7 @@ describe('Mouse Tracking Tests', function(): void { await mouseUp('right'); assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} ]); // wheel @@ -1315,28 +1267,21 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action, reports wrong coords for release - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported, release with wrong coords await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -1346,18 +1291,13 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT // note: press/release caught by selection manager - // bug: modifier not reported for passed events await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Shift'); // defaults to ShiftLeft @@ -1368,37 +1308,35 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working - selection manager? await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); }); describe('DECSET 1002 (xterm with drag)', () => { @@ -1492,30 +1430,22 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -1525,20 +1455,14 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT // note: press/release/drag caught by selection manager - // bug: modifier not reported for passed events await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Shift'); // defaults to ShiftLeft @@ -1549,40 +1473,37 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { - // bug: completely messed up - wrong modifier, only partially reported assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); it('UTF8 encoding', async () => { const encoding = 'UTF8'; @@ -1666,30 +1587,22 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -1699,20 +1612,14 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT // note: press/release/drag caught by selection manager - // bug: modifier not reported for passed events await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Shift'); // defaults to ShiftLeft @@ -1723,40 +1630,38 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { // bug: completely messed up - wrong modifier, only partially reported assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); it('SGR encoding', async () => { const encoding = 'SGR'; @@ -1818,7 +1723,6 @@ describe('Mouse Tracking Tests', function(): void { // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); // right button // bug: default action not cancelled (popup shown) - // bug: release reports wrong button await mouseMove(43, 24); await getReports(encoding); // clear reports await mouseDown('right'); @@ -1827,7 +1731,7 @@ describe('Mouse Tracking Tests', function(): void { assert.deepEqual(await getReports(encoding), [ {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, {col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'release', button: 'right', modifier: {control: false, shift: false, meta: false}}} ]); // wheel @@ -1840,30 +1744,22 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -1873,20 +1769,14 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT // note: press/release/drag caught by selection manager - // bug: modifier not reported for passed events await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Shift'); // defaults to ShiftLeft @@ -1897,40 +1787,37 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { - // bug: completely messed up - wrong modifier, only partially reported assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers // bug: this is totally broken with wrong coords and messed up modifiers await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); it('URXVT encoding', async () => { const encoding = 'URXVT'; @@ -2013,30 +1900,22 @@ describe('Mouse Tracking Tests', function(): void { // modifiers // CTRL - // bug: totally broken - reports no modifier, reports wrong button and action - // after fix: removed faulty reports below and uncomment lines await mouseMove(43, 24); await getReports(encoding); // clear reports - // await page.keyboard.down('Control'); + await page.keyboard.down('Control'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); - // await page.keyboard.up('Control'); + await page.keyboard.up('Control'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} ]); // ALT - // bug: no modifier reported await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Alt'); @@ -2046,20 +1925,14 @@ describe('Mouse Tracking Tests', function(): void { await wheelDown(); await page.keyboard.up('Alt'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} - // expected - // {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - // {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} ]); // SHIFT // note: press/release/drag caught by selection manager - // bug: modifier not reported for passed events await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Shift'); // defaults to ShiftLeft @@ -2070,40 +1943,37 @@ describe('Mouse Tracking Tests', function(): void { await page.keyboard.up('Shift'); if (noShift) { assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } else { - // bug: completely messed up - wrong modifier, only partially reported assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: false}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} ]); } - /* // all modifiers - // bug: this is totally broken with wrong coords and messed up modifiers + // bug: Shift not working await mouseMove(43, 24); await getReports(encoding); // clear reports await page.keyboard.down('Control'); await page.keyboard.down('Alt'); - await page.keyboard.down('Shift'); + // await page.keyboard.down('Shift'); await mouseDown('left'); await mouseMove(44, 24); await mouseUp('left'); await wheelDown(); await page.keyboard.up('Control'); await page.keyboard.up('Alt'); - await page.keyboard.up('Shift'); + // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: true, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: true, meta: true}}} + {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, + {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); - */ }); }); describe('DECSET 1003 (xterm any event)', () => {