Add test for min contrast on white bg
This commit is contained in:
@@ -631,6 +631,70 @@ describe('WebGL Renderer Integration Tests', function(): void {
|
|||||||
await pollFor(page, () => getCellColor(7, 2), [0x34, 0xe2, 0xe2, 255]);
|
await pollFor(page, () => getCellColor(7, 2), [0x34, 0xe2, 0xe2, 255]);
|
||||||
await pollFor(page, () => getCellColor(8, 2), [0xee, 0xee, 0xec, 255]);
|
await pollFor(page, () => getCellColor(8, 2), [0xee, 0xee, 0xec, 255]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.only('should adjust 0-15 colors on white background', async () => {
|
||||||
|
const theme: ITheme = {
|
||||||
|
background: '#ffffff',
|
||||||
|
black: '#2e3436',
|
||||||
|
red: '#cc0000',
|
||||||
|
green: '#4e9a06',
|
||||||
|
yellow: '#c4a000',
|
||||||
|
blue: '#3465a4',
|
||||||
|
magenta: '#75507b',
|
||||||
|
cyan: '#06989a',
|
||||||
|
white: '#d3d7cf',
|
||||||
|
brightBlack: '#555753',
|
||||||
|
brightRed: '#ef2929',
|
||||||
|
brightGreen: '#8ae234',
|
||||||
|
brightYellow: '#fce94f',
|
||||||
|
brightBlue: '#729fcf',
|
||||||
|
brightMagenta: '#ad7fa8',
|
||||||
|
brightCyan: '#34e2e2',
|
||||||
|
brightWhite: '#eeeeec'
|
||||||
|
};
|
||||||
|
await page.evaluate(`window.term.setOption('theme', ${JSON.stringify(theme)});`);
|
||||||
|
await writeSync(
|
||||||
|
`\\x1b[30m█\\x1b[31m█\\x1b[32m█\\x1b[33m█\\x1b[34m█\\x1b[35m█\\x1b[36m█\\x1b[37m█\\r\\n` +
|
||||||
|
`\\x1b[90m█\\x1b[91m█\\x1b[92m█\\x1b[93m█\\x1b[94m█\\x1b[95m█\\x1b[96m█\\x1b[97m█`
|
||||||
|
);
|
||||||
|
// Validate before minimumContrastRatio is applied
|
||||||
|
await pollFor(page, () => getCellColor(1, 1), [0x2e, 0x34, 0x36, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(2, 1), [0xcc, 0x00, 0x00, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(3, 1), [0x4e, 0x9a, 0x06, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(4, 1), [0xc4, 0xa0, 0x00, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(5, 1), [0x34, 0x65, 0xa4, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(6, 1), [0x75, 0x50, 0x7b, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(7, 1), [0x06, 0x98, 0x9a, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(8, 1), [0xd3, 0xd7, 0xcf, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(1, 2), [0x55, 0x57, 0x53, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(2, 2), [0xef, 0x29, 0x29, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(3, 2), [0x8a, 0xe2, 0x34, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(4, 2), [0xfc, 0xe9, 0x4f, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(5, 2), [0x72, 0x9f, 0xcf, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(6, 2), [0xad, 0x7f, 0xa8, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(7, 2), [0x34, 0xe2, 0xe2, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(8, 2), [0xee, 0xee, 0xec, 255]);
|
||||||
|
// Setting and check for minimum contrast values, note that these are note
|
||||||
|
// exact to the contrast ratio, if the increase luminance algorithm
|
||||||
|
// changes then these will probably fail
|
||||||
|
await page.evaluate(`window.term.setOption('minimumContrastRatio', 10);`);
|
||||||
|
await pollFor(page, () => getCellColor(1, 1), [46, 52, 54, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(2, 1), [132, 0, 0, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(3, 1), [78, 154, 6, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(4, 1), [114, 93, 0, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(5, 1), [19, 40, 68, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(6, 1), [60, 40, 64, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(7, 1), [0, 71, 72, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(8, 1), [64, 64, 63, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(1, 2), [61, 63, 59, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(2, 2), [125, 19, 19, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(3, 2), [89, 146, 32, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(4, 2), [105, 98, 32, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(5, 2), [36, 52, 70, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(6, 2), [64, 45, 63, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(7, 2), [13, 67, 67, 255]);
|
||||||
|
await pollFor(page, () => getCellColor(8, 2), [64, 64, 64, 255]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user