@@ -1394,9 +1394,15 @@ it.effect("rejects X11 capture without registering shortcuts or loading capture
13941394 ) ;
13951395} ) ;
13961396
1397- it . effect . each ( [ "gnome" , "niri" , "kde" , "hyprland" ] as const ) (
1398- "persists %s text without inventing AT-SPI screen coordinates" ,
1399- ( backend ) => {
1397+ it . effect . each ( [
1398+ { backend : "gnome" , screenshot : "PNG" } ,
1399+ { backend : "niri" , screenshot : "PNG" } ,
1400+ { backend : "kde" , screenshot : "PNG" } ,
1401+ { backend : "hyprland" , screenshot : "PNG" } ,
1402+ { backend : "gnome" , screenshot : "invalid" } ,
1403+ ] as const ) (
1404+ "persists $backend accessibility text with a $screenshot screenshot" ,
1405+ ( { backend, screenshot } ) => {
14001406 vi . stubEnv ( "XDG_SESSION_TYPE" , "wayland" ) ;
14011407 flashWindows . length = 0 ;
14021408 const window = {
@@ -1413,7 +1419,16 @@ it.effect.each(["gnome", "niri", "kde", "hyprland"] as const)(
14131419 ...( backend === "niri" ? { accessibilityBoundsReliable : false } : { } ) ,
14141420 ...( backend === "kde" ? { clientBounds : { x : 479 , y : 371 , width : 700 , height : 520 } } : { } ) ,
14151421 } ;
1416- linuxCaptureMock . mockResolvedValueOnce ( { png : Buffer . from ( [ 1 , 2 , 3 ] ) , window } ) ;
1422+ // The captured pixels differ from the compositor's logical window bounds.
1423+ const imageSize = screenshot === "PNG" ? { width : 1400 , height : 1040 } : window . bounds ;
1424+ const png =
1425+ screenshot === "PNG"
1426+ ? Buffer . from (
1427+ "iVBORw0KGgoAAAANSUhEUgAABXgAAAQQAQAAAABwoA4ZAAAAyElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHgYyx4AAepc/c0AAAAASUVORK5CYII=" ,
1428+ "base64" ,
1429+ )
1430+ : Buffer . from ( [ 1 , 2 , 3 ] ) ;
1431+ linuxCaptureMock . mockResolvedValueOnce ( { png, window } ) ;
14171432 activeWindowMock . mockClear ( ) ;
14181433 getSourcesMock . mockClear ( ) ;
14191434 accessibilityByPidMock . mockReset ( ) . mockResolvedValue ( {
@@ -1453,7 +1468,7 @@ it.effect.each(["gnome", "niri", "kde", "hyprland"] as const)(
14531468 assert . deepInclude ( saved . source . accessibility , {
14541469 format : "element-tree" ,
14551470 coordinateSpace : "captured-image" ,
1456- imageSize : { width : 700 , height : window . bounds . height } ,
1471+ imageSize : { width : imageSize . width , height : imageSize . height } ,
14571472 truncated : false ,
14581473 } ) ;
14591474 assert . deepInclude (
@@ -1463,7 +1478,7 @@ it.effect.each(["gnome", "niri", "kde", "hyprland"] as const)(
14631478 {
14641479 role : "window" ,
14651480 name : "Editor" ,
1466- bounds : { x : 0 , y : 0 , width : 700 , height : window . bounds . height } ,
1481+ bounds : { x : 0 , y : 0 , width : imageSize . width , height : imageSize . height } ,
14671482 state : { active : true } ,
14681483 } ,
14691484 ) ;
0 commit comments