Reset maxAtlasPages after tests that lower it
setMaxAtlasPages mutates a static that lives for the page's lifetime, so a lowered cap silently leaked into every renderer built by later tests in the same file (their GL texture and shader sampler arrays were sized at the tiny cap, making tests order-dependent). Add resetMaxAtlasPages and call it in afterEach wherever the cap is lowered on a shared page.
This commit is contained in:
@@ -292,6 +292,23 @@ export async function setMaxAtlasPages(ctx: ITestContext, maxAtlasPages: number)
|
||||
expect(applied, 'should be able to reach the texture atlas to set maxAtlasPages').toBe(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets `maxAtlasPages` to undefined so the next constructed renderer re-derives it from GL
|
||||
* capabilities. Call after any test that used {@link setMaxAtlasPages}: the static lives for
|
||||
* the page's lifetime, so without a reset every terminal opened later in the same file builds
|
||||
* its GL texture and shader sampler arrays at the lowered cap.
|
||||
* @param ctx The test context.
|
||||
*/
|
||||
export async function resetMaxAtlasPages(ctx: ITestContext): Promise<void> {
|
||||
await ctx.page.evaluate(() => {
|
||||
const renderer = (window as any).term?._core?._renderService?._renderer?.value;
|
||||
const atlas = renderer?._charAtlas;
|
||||
if (atlas) {
|
||||
(atlas.constructor as any).maxAtlasPages = undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes `chunks` screenfuls of distinct glyphs, rendering after each chunk.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user