Invert initial assertion

This commit is contained in:
Daniel Imms
2025-12-20 07:33:18 -08:00
parent ad07f2cf76
commit 6733e13a44
+23 -4
View File
@@ -7,6 +7,7 @@ import { IImage32, decodePng } from '@lunapaint/png-codec';
import { LocatorScreenshotOptions, test } from '@playwright/test';
import { ITheme, type ITerminalOptions } from '@xterm/xterm';
import { ITestContext, MaybeAsync, openTerminal, pollFor, pollForApproximate, timeout } from './TestUtils';
import { notDeepStrictEqual } from 'node:assert';
export interface ISharedRendererTestContext {
value: ITestContext;
@@ -1272,10 +1273,12 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
test.beforeEach(async () => {
const theme: ITheme = {
background: '#000000FF',
red: '#FF0000FF',
green: '#00FF00FF',
blue: '#0000FFFF'
};
const options: ITerminalOptions = {}
await ctx.value.page.evaluate(`
window.term.options.theme = ${JSON.stringify(theme)};
window.term.options.cursorStyle = 'underline';
@@ -1284,7 +1287,11 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
test('defers rendering until ESU', async () => {
await ctx.value.proxy.write('\x1b[?2026h'); // BSU
await ctx.value.proxy.write('\x1b[31m■');
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255], undefined, {
equalityFn: (a, b) => {
return !(a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]);
}
});
await ctx.value.proxy.write('\x1b[?2026l'); // ESU
frameDetails = undefined;
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255]);
@@ -1293,7 +1300,11 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
test('batches multiple writes', async () => {
await ctx.value.proxy.write('\x1b[?2026h'); // BSU
await ctx.value.proxy.write('\x1b[31m■\x1b[32m■\x1b[34m■');
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255], undefined, {
equalityFn: (a, b) => {
return !(a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]);
}
});
await ctx.value.proxy.write('\x1b[?2026l'); // ESU
frameDetails = undefined;
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255]);
@@ -1306,7 +1317,11 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
await ctx.value.proxy.write('\x1b[31m■');
await ctx.value.proxy.write('\x1b[?2026h'); // BSU
await ctx.value.proxy.write('\x1b[32m■');
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255], undefined, {
equalityFn: (a, b) => {
return !(a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]);
}
});
await ctx.value.proxy.write('\x1b[?2026l'); // ESU
frameDetails = undefined;
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255]);
@@ -1316,7 +1331,11 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
test('timeout flushes without ESU', async () => {
await ctx.value.proxy.write('\x1b[?2026h'); // BSU
await ctx.value.proxy.write('\x1b[31m■');
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255], undefined, {
equalityFn: (a, b) => {
return !(a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]);
}
});
await ctx.value.page.waitForTimeout(1000); // Timeout hard coded
frameDetails = undefined;
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 0, 0, 255]);