@@ -182,7 +182,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
182182 } ;
183183 await ctx . value . page . evaluate ( `window.term.options.theme = ${ JSON . stringify ( theme ) } ;` ) ;
184184 await waitForRenderAfter ( ctx . value , ( ) => ctx . value . proxy . write ( `\x1b[8;40m■\x1b[8;41m■\x1b[8;42m■\x1b[8;43m■\x1b[8;44m■\x1b[8;45m■\x1b[8;46m■\x1b[8;47m■` ) ) ;
185- const getBgColor = ( col : number , row : number ) => getCellDomBackgroundColor ( ctx . value , col , row ) ;
185+ const getBgColor = ( col : number , row : number ) : Promise < [ number , number , number , number ] > => getCellDomBackgroundColor ( ctx . value , col , row ) ;
186186 await pollFor ( ctx . value . page , ( ) => getBgColor ( 1 , 1 ) , [ 1 , 2 , 3 , 255 ] ) ;
187187 await pollFor ( ctx . value . page , ( ) => getBgColor ( 2 , 1 ) , [ 4 , 5 , 6 , 255 ] ) ;
188188 await pollFor ( ctx . value . page , ( ) => getBgColor ( 3 , 1 ) , [ 7 , 8 , 9 , 255 ] ) ;
@@ -344,7 +344,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
344344 data += '\r\n' ;
345345 }
346346 await waitForRenderAfter ( ctx . value , ( ) => ctx . value . proxy . write ( data ) ) ;
347- const getBgColor = ( col : number , row : number ) => getCellDomBackgroundColor ( ctx . value , col , row ) ;
347+ const getBgColor = ( col : number , row : number ) : Promise < [ number , number , number , number ] > => getCellDomBackgroundColor ( ctx . value , col , row ) ;
348348 const firstCssColor = COLORS_16_TO_255 [ 1 ] ;
349349 const firstR = parseInt ( firstCssColor . slice ( 1 , 3 ) , 16 ) ;
350350 const firstG = parseInt ( firstCssColor . slice ( 3 , 5 ) , 16 ) ;
@@ -725,7 +725,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
725725 data += '\r\n' ;
726726 }
727727 await waitForRenderAfter ( ctx . value , ( ) => ctx . value . proxy . write ( data ) ) ;
728- const getBgColor = ( col : number , row : number ) => getCellDomBackgroundColor ( ctx . value , col , row ) ;
728+ const getBgColor = ( col : number , row : number ) : Promise < [ number , number , number , number ] > => getCellDomBackgroundColor ( ctx . value , col , row ) ;
729729 await pollFor ( ctx . value . page , ( ) => getBgColor ( 2 , 1 ) , [ 1 , 1 , 1 , 255 ] ) ;
730730 for ( let y = 0 ; y < 16 ; y ++ ) {
731731 for ( let x = 0 ; x < 16 ; x ++ ) {
@@ -914,7 +914,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
914914 255
915915 ] ;
916916 } ;
917- const getFgColor = async ( col : number , row : number ) => compositeOverBackground ( await getCellDomForegroundColor ( ctx . value , col , row ) ) ;
917+ const getFgColor = async ( col : number , row : number ) : Promise < [ number , number , number , number ] > => compositeOverBackground ( await getCellDomForegroundColor ( ctx . value , col , row ) ) ;
918918 await pollForApproximate ( ctx . value . page , marginOfError , ( ) => getFgColor ( 1 , 1 ) , [ Math . floor ( ( 255 + 0x2e ) / 2 ) , Math . floor ( ( 255 + 0x34 ) / 2 ) , Math . floor ( ( 255 + 0x36 ) / 2 ) , 255 ] ) ;
919919 await pollForApproximate ( ctx . value . page , marginOfError , ( ) => getFgColor ( 2 , 1 ) , [ Math . floor ( ( 255 + 0xcc ) / 2 ) , Math . floor ( ( 255 + 0x00 ) / 2 ) , Math . floor ( ( 255 + 0x00 ) / 2 ) , 255 ] ) ;
920920 await pollForApproximate ( ctx . value . page , marginOfError , ( ) => getFgColor ( 3 , 1 ) , [ Math . floor ( ( 255 + 0x4e ) / 2 ) , Math . floor ( ( 255 + 0x9a ) / 2 ) , Math . floor ( ( 255 + 0x06 ) / 2 ) , 255 ] ) ;
@@ -1384,10 +1384,10 @@ async function pollForCellColorFresh(ctx: ITestContext, col: number, row: number
13841384 } ) ;
13851385}
13861386
1387- async function pollForCellColorApproximateFresh ( ctx : ITestContext , marginOfError : number , col : number , row : number , expected : [ number , number , number , number ] , position : CellColorPosition = CellColorPosition . CENTER ) : Promise < void > {
1388- await pollForApproximate ( ctx . page , marginOfError , ( ) => getCellColor ( ctx , col , row , position ) , expected , async ( ) => {
1389- frameDetails = undefined ;
1390- } ) ;
1387+ interface ICellDomInfo {
1388+ fg : string ;
1389+ bg : string ;
1390+ char : string ;
13911391}
13921392
13931393function parseCssColor ( value : string ) : [ number , number , number , number ] {
@@ -1405,7 +1405,7 @@ function parseCssColor(value: string): [number, number, number, number] {
14051405 return [ r , g , b , a ] ;
14061406}
14071407
1408- async function getCellDomInfo ( ctx : ITestContext , col : number , row : number ) : Promise < { fg : string ; bg : string ; char : string } > {
1408+ async function getCellDomInfo ( ctx : ITestContext , col : number , row : number ) : Promise < ICellDomInfo > {
14091409 const info = await ctx . page . evaluate ( ( { col, row } ) => {
14101410 const rows = document . querySelectorAll ( '#terminal-container .xterm-rows > div' ) ;
14111411 const rowEl = rows [ row - 1 ] ;
0 commit comments