From 5ea016d537130bcadfdf39c1a39a4dd6f8a9bcbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 24 Oct 2019 21:57:22 +0200 Subject: [PATCH] remove URXVT and UTF8 encoding from codebase --- src/common/services/CoreMouseService.test.ts | 18 +- src/common/services/CoreMouseService.ts | 19 - test/api/MouseTracking.api.ts | 1184 ------------------ 3 files changed, 1 insertion(+), 1220 deletions(-) diff --git a/src/common/services/CoreMouseService.test.ts b/src/common/services/CoreMouseService.test.ts index 2063a496..71d06da5 100644 --- a/src/common/services/CoreMouseService.test.ts +++ b/src/common/services/CoreMouseService.test.ts @@ -34,7 +34,7 @@ describe('CoreMouseService', () => { }); it('default encodings - DEFAULT, UTF8, SGR, URXVT', () => { const cms = new CoreMouseService(bufferService, coreService); - assert.deepEqual(Object.keys((cms as any)._encodings), ['DEFAULT', 'UTF8', 'SGR', 'URXVT']); + assert.deepEqual(Object.keys((cms as any)._encodings), ['DEFAULT', 'SGR']); }); it('protocol/encoding setter, reset', () => { const cms = new CoreMouseService(bufferService, coreService); @@ -151,14 +151,6 @@ describe('CoreMouseService', () => { } } }); - it('UTF8 encoding', () => { - cms.activeProtocol = 'ANY'; - cms.activeEncoding = 'UTF8'; - for (let i = 0; i < bufferService.cols; ++i) { - assert.equal(cms.triggerMouseEvent({ col: i, row: 0, button: CoreMouseButton.LEFT, action: CoreMouseAction.DOWN }), true); - assert.deepEqual(toBytes(reports.pop()), [0x1b, 0x5b, 0x4d, 0x20, i + 33, 0x21]); - } - }); it('SGR encoding', () => { cms.activeProtocol = 'ANY'; cms.activeEncoding = 'SGR'; @@ -167,14 +159,6 @@ describe('CoreMouseService', () => { assert.deepEqual(reports.pop(), `\x1b[<0;${i + 1};1M`); } }); - it('URXVT', () => { - cms.activeProtocol = 'ANY'; - cms.activeEncoding = 'URXVT'; - for (let i = 0; i < bufferService.cols; ++i) { - assert.equal(cms.triggerMouseEvent({ col: i, row: 0, button: CoreMouseButton.LEFT, action: CoreMouseAction.DOWN }), true); - assert.deepEqual(reports.pop(), `\x1b[32;${i + 1};1M`); - } - }); }); it('eventCodes with modifiers (DEFAULT encoding)', () => { // TODO: implement AUX button tests diff --git a/src/common/services/CoreMouseService.ts b/src/common/services/CoreMouseService.ts index 0c846519..19852d16 100644 --- a/src/common/services/CoreMouseService.ts +++ b/src/common/services/CoreMouseService.ts @@ -132,17 +132,6 @@ const DEFAULT_ENCODINGS: {[key: string]: CoreMouseEncoding} = { // FIXED: params = params.map(v => (v > 255) ? 0 : value); return `\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`; }, - /** - * UTF8 - CSI M Pb Px Py - * Same as DEFAULT, but with optional 2-byte UTF8 - * encoding for values > 223 (can encode up to 2015). - */ - UTF8: (e: ICoreMouseEvent) => { - let params = [eventCode(e, false) + 32, e.col + 32, e.row + 32]; - // limit to 2-byte UTF8 - params = params.map(v => (v > 2047) ? 0 : v); - return `\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`; - }, /** * SGR - CSI < Pb ; Px ; Py M|m * No encoding limitation. @@ -151,14 +140,6 @@ const DEFAULT_ENCODINGS: {[key: string]: CoreMouseEncoding} = { SGR: (e: ICoreMouseEvent) => { const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M'; return `\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`; - }, - /** - * URXVT - CSI Pb ; Px ; Py M - * Same button encoding as default, decimal encoding for coords. - * Ambiguity with other sequences, should not be used. - */ - URXVT: (e: ICoreMouseEvent) => { - return `\x1b[${eventCode(e, false) + 32};${e.col};${e.row}M`; } }; diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 1372b567..37d46f74 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -167,7 +167,6 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; let col: number; // unpack msg const report = String.fromCharCode.apply(null, msg); - // console.log([report]); // skip non mouse reports if (!report || report[0] !== '\x1b') { return report; @@ -179,14 +178,6 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; col: report.charCodeAt(4) - 32, row: report.charCodeAt(5) - 32 }; - case 'UTF8': - // TODO: once the binary patch is in place, - // use UTF8 byte check here - return { - state: evalButtonCode(report.charCodeAt(3) - 32), - col: report.charCodeAt(4) - 32, - row: report.charCodeAt(5) - 32 - }; case 'SGR': sReport = report.slice(3, -1); [buttonCode, col, row] = sReport.split(';').map(el => parseInt(el)); @@ -195,10 +186,6 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; state.action = 'release'; } return {state, row, col}; - case 'URXVT': - sReport = report.slice(2, -1); - [buttonCode, col, row] = sReport.split(';').map(el => parseInt(el)); - return {state: evalButtonCode(buttonCode - 32), row, col}; default: return { state: evalButtonCode(report.charCodeAt(3) - 32), @@ -373,124 +360,6 @@ describe('Mouse Tracking Tests', function(): void { // 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.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?9h\x1b[?1005h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // mouseup should not report - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), []); - await wheelDown(); - assert.deepEqual(await getReports(encoding), []); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - 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}}}]); - - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - 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}}}]); - - // SHIFT - // note: caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), []); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - } - - // all 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 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'); - 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'; await resetMouseModes(); @@ -564,125 +433,6 @@ describe('Mouse Tracking Tests', function(): void { assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - 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}}}]); - - // SHIFT - // note: caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), []); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - } - - // all 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 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'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - }); - it.skip('URXVT encoding', async () => { - // bug: always reports +1 for row/col (temp. fixed in parseReport to pass tests) - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?9h\x1b[?1015h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // mouseup should not report - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), []); - await wheelDown(); - assert.deepEqual(await getReports(encoding), []); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - 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}}}]); - - // ALT await mouseMove(43, 24); await getReports(encoding); // clear reports @@ -889,155 +639,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1000h\x1b[?1005h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - 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); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - 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: 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) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - 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: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - 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: '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 - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - 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: 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 - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - 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: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {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: 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 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'); - assert.deepEqual(await getReports(encoding), [ - {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'; await resetMouseModes(); @@ -1187,155 +788,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('URXVT encoding', async () => { - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1000h\x1b[?1015h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - 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); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - 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: 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) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - 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: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - 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: '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 - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - 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: 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 - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - 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: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {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: 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 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'); - assert.deepEqual(await getReports(encoding), [ - {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)', () => { /** @@ -1502,164 +954,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1002h\x1b[?1005h');`); - - // test at 0,0 - // bug: release is fired immediately - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {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), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - 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: 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}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - 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: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - 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: true, shift: false, meta: false}}} - ]); - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - 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: 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 - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - 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: 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: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', 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: 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 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'); - assert.deepEqual(await getReports(encoding), [ - {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'; await resetMouseModes(); @@ -1816,162 +1110,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('URXVT encoding', async () => { - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1002h\x1b[?1015h');`); - - // test at 0,0 - // bug: release is fired immediately - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - 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); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - 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: 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}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - 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: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - 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: true, shift: false, meta: false}}} - ]); - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - 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: 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 - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - 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: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', 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: 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 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'); - assert.deepEqual(await getReports(encoding), [ - {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)', () => { /** @@ -2139,167 +1277,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1003h\x1b[?1005h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - // bug: we are capped at col 95 currently - // fix: allow values up to 223, any bigger should drop to 0 - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {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}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {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: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await page.keyboard.down('Control'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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 - await page.keyboard.down('Alt'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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 - await page.keyboard.down('Shift'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, 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: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', 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: Shift not working - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseMove(43, 24); - 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'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: true, shift: false, 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'; await resetMouseModes(); @@ -2461,167 +1438,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('URXVT encoding', async () => { - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1003h\x1b[?1015h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - // bug: we are capped at col 95 currently - // fix: allow values up to 223, any bigger should drop to 0 - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {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}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // 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) - await mouseMove(43, 24); - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {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: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await page.keyboard.down('Control'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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 - await page.keyboard.down('Alt'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', 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 - await page.keyboard.down('Shift'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, 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: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', 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: Shift not working - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseMove(43, 24); - 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'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: true, shift: false, 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}}} - ]); - }); }); /** * move tests with multiple buttons pressed: