mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
add integration tests for pixel reports
This commit is contained in:
@@ -346,6 +346,51 @@ describe('InputHandler Integration Tests', function(): void {
|
||||
`);
|
||||
assert.deepEqual(await getLinesAsArray(3), ['#', ' #', 'abcd####']);
|
||||
});
|
||||
|
||||
describe.only('Window Options - CSI Ps ; Ps ; Ps t', () => {
|
||||
it('should be disabled by default', async function() {
|
||||
assert.equal(await page.evaluate(`(() => window.term.getOption('allowedWindowOps'))()`), '');
|
||||
await page.evaluate(`(() => {
|
||||
window._stack = [];
|
||||
const _h = window.term.onData(data => window._stack.push(data));
|
||||
window.term.write('\x1b[14t');
|
||||
window.term.write('\x1b[16t');
|
||||
window.term.write('\x1b[18t');
|
||||
window.term.write('\x1b[20t');
|
||||
window.term.write('\x1b[21t');
|
||||
return new Promise((r) => window.term.write('', () => { _h.dispose(); r(); }));
|
||||
})()`);
|
||||
assert.deepEqual(await page.evaluate(`(() => _stack)()`), []);
|
||||
});
|
||||
it('14 - GetWinSizePixels', async function() {
|
||||
assert.equal(await page.evaluate(`(() => {
|
||||
window.term.setOption('allowedWindowOps', 'GetWinSizePixels');
|
||||
return window.term.getOption('allowedWindowOps');
|
||||
})()`), '14');
|
||||
await page.evaluate(`(() => {
|
||||
window._stack = [];
|
||||
const _h = window.term.onData(data => window._stack.push(data));
|
||||
window.term.write('\x1b[14t');
|
||||
return new Promise((r) => window.term.write('', () => { _h.dispose(); r(); }));
|
||||
})()`);
|
||||
const d = await getDimensions();
|
||||
assert.deepEqual(await page.evaluate(`(() => _stack)()`), [`\x1b[4;${d.height};${d.width}t`]);
|
||||
});
|
||||
it('16 - GetCellSizePixels', async function() {
|
||||
assert.equal(await page.evaluate(`(() => {
|
||||
window.term.setOption('allowedWindowOps', 'GetCellSizePixels');
|
||||
return window.term.getOption('allowedWindowOps');
|
||||
})()`), '16');
|
||||
await page.evaluate(`(() => {
|
||||
window._stack = [];
|
||||
const _h = window.term.onData(data => window._stack.push(data));
|
||||
window.term.write('\x1b[16t');
|
||||
return new Promise((r) => window.term.write('', () => { _h.dispose(); r(); }));
|
||||
})()`);
|
||||
const d = await getDimensions();
|
||||
assert.deepEqual(await page.evaluate(`(() => _stack)()`), [`\x1b[6;${d.cellHeight};${d.cellWidth}t`]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('ESC', () => {
|
||||
@@ -404,3 +449,17 @@ async function getCursor(): Promise<{col: number, row: number}> {
|
||||
})();
|
||||
`);
|
||||
}
|
||||
|
||||
async function getDimensions(): Promise<any> {
|
||||
const dim = await page.evaluate(`
|
||||
(function() {
|
||||
return term._core._renderService.dimensions;
|
||||
})();
|
||||
`);
|
||||
return {
|
||||
cellWidth: dim.actualCellWidth.toFixed(0),
|
||||
cellHeight: dim.actualCellHeight.toFixed(0),
|
||||
width: dim.canvasWidth.toFixed(0),
|
||||
height: dim.canvasHeight.toFixed(0)
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user