@@ -1048,9 +1048,15 @@ it.effect("matches Windows accessibility windows on a scaled display", () => {
10481048 ) ;
10491049} ) ;
10501050
1051- it . effect . each ( [ "gnome" , "niri" , "kde" , "hyprland" ] as const ) (
1052- "persists %s text without inventing AT-SPI screen coordinates" ,
1053- ( backend ) => {
1051+ it . effect . each ( [
1052+ { backend : "gnome" , screenshot : "PNG" } ,
1053+ { backend : "niri" , screenshot : "PNG" } ,
1054+ { backend : "kde" , screenshot : "PNG" } ,
1055+ { backend : "hyprland" , screenshot : "PNG" } ,
1056+ { backend : "gnome" , screenshot : "invalid" } ,
1057+ ] as const ) (
1058+ "persists $backend accessibility text with a $screenshot screenshot" ,
1059+ ( { backend, screenshot } ) => {
10541060 vi . stubEnv ( "XDG_SESSION_TYPE" , "wayland" ) ;
10551061 flashWindows . length = 0 ;
10561062 const window = {
@@ -1067,7 +1073,16 @@ it.effect.each(["gnome", "niri", "kde", "hyprland"] as const)(
10671073 ...( backend === "niri" ? { accessibilityBoundsReliable : false } : { } ) ,
10681074 ...( backend === "kde" ? { clientBounds : { x : 479 , y : 371 , width : 700 , height : 520 } } : { } ) ,
10691075 } ;
1070- linuxCaptureMock . mockResolvedValueOnce ( { png : Buffer . from ( [ 1 , 2 , 3 ] ) , window } ) ;
1076+ // The captured pixels differ from the compositor's logical window bounds.
1077+ const imageSize = screenshot === "PNG" ? { width : 1400 , height : 1040 } : window . bounds ;
1078+ const png =
1079+ screenshot === "PNG"
1080+ ? Buffer . from (
1081+ "iVBORw0KGgoAAAANSUhEUgAABXgAAAQQAQAAAABwoA4ZAAAAyElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHgYyx4AAepc/c0AAAAASUVORK5CYII=" ,
1082+ "base64" ,
1083+ )
1084+ : Buffer . from ( [ 1 , 2 , 3 ] ) ;
1085+ linuxCaptureMock . mockResolvedValueOnce ( { png, window } ) ;
10711086 activeWindowMock . mockClear ( ) ;
10721087 getSourcesMock . mockClear ( ) ;
10731088 accessibilityByPidMock . mockReset ( ) . mockResolvedValue ( {
@@ -1107,7 +1122,7 @@ it.effect.each(["gnome", "niri", "kde", "hyprland"] as const)(
11071122 assert . deepInclude ( saved . source . accessibility , {
11081123 format : "element-tree" ,
11091124 coordinateSpace : "captured-image" ,
1110- imageSize : { width : 700 , height : window . bounds . height } ,
1125+ imageSize : { width : imageSize . width , height : imageSize . height } ,
11111126 truncated : false ,
11121127 } ) ;
11131128 assert . deepInclude (
@@ -1117,7 +1132,7 @@ it.effect.each(["gnome", "niri", "kde", "hyprland"] as const)(
11171132 {
11181133 role : "window" ,
11191134 name : "Editor" ,
1120- bounds : { x : 0 , y : 0 , width : 700 , height : window . bounds . height } ,
1135+ bounds : { x : 0 , y : 0 , width : imageSize . width , height : imageSize . height } ,
11211136 state : { active : true } ,
11221137 } ,
11231138 ) ;
0 commit comments