@@ -869,6 +869,69 @@ it.effect("captures the active Windows window without enumerating desktop source
869869 ) . pipe ( Effect . provide ( layer ) ) ;
870870} ) ;
871871
872+ it . effect . each ( [ "darwin" , "win32" ] as const ) (
873+ "drops shortcut bursts during flight and accepts a fresh capture after landing on %s" ,
874+ ( platform ) => {
875+ const fixture = concurrentCaptureFixture ( platform , true ) ;
876+ fixture . releaseAll ( ) ;
877+ const flying = Promise . withResolvers < void > ( ) ;
878+ const heldFlights : Array < ( ) => void > = [ ] ;
879+ const push = heldFlights . push . bind ( heldFlights ) ;
880+ vi . spyOn ( heldFlights , "push" ) . mockImplementation ( ( ...resolvers ) => {
881+ const count = push ( ...resolvers ) ;
882+ flying . resolve ( ) ;
883+ return count ;
884+ } ) ;
885+ transitionScriptState . heldFlights = heldFlights ;
886+ return Effect . scoped (
887+ Effect . gen ( function * ( ) {
888+ const service = yield * DesktopSnapShot . make ;
889+ yield * service . configure ( fixture . settings ) ;
890+ yield * Effect . promise ( fixture . trigger ) ;
891+ const firstId = fixture . readyIds [ 0 ] ! ;
892+ const landing = yield * service
893+ . setAnimationDestination ( firstId , {
894+ frame : { x : 100 , y : 400 , width : 208 , height : 112 } ,
895+ backgroundColor : "#fff" ,
896+ borderColor : "#ccc" ,
897+ borderWidth : 1 ,
898+ cornerRadius : 8 ,
899+ scaleFactor : 1 ,
900+ } )
901+ . pipe ( Effect . forkChild ( { startImmediately : true } ) ) ;
902+ yield * Effect . promise ( ( ) => flying . promise ) ;
903+ const overlayCount = flashWindows . length ;
904+
905+ for ( let repeat = 0 ; repeat < 20 ; repeat ++ ) {
906+ yield * TestClock . adjust ( "200 millis" ) ;
907+ yield * Effect . promise ( fixture . trigger ) ;
908+ }
909+ assert . equal ( fixture . state . snapshots , 1 ) ;
910+ assert . lengthOf ( fixture . readyIds , 1 ) ;
911+ assert . lengthOf ( flashWindows , overlayCount ) ;
912+ assert . isTrue ( flashWindows . every ( ( window ) => ! window . destroyed ) ) ;
913+
914+ for ( const finish of heldFlights ) finish ( ) ;
915+ yield * Fiber . join ( landing ) ;
916+ // Landing releases the guard even before the first capture is acknowledged.
917+ yield * Effect . promise ( fixture . trigger ) ;
918+ assert . equal ( fixture . state . snapshots , 2 ) ;
919+ assert . lengthOf ( fixture . readyIds , 2 ) ;
920+ assert . isTrue ( fixture . second . oldOverlaysCleared ) ;
921+ } ) ,
922+ ) . pipe (
923+ Effect . provide ( fixture . layer ) ,
924+ Effect . ensuring (
925+ Effect . sync ( ( ) => {
926+ for ( const finish of heldFlights ) finish ( ) ;
927+ transitionScriptState . heldFlights = null ;
928+ fixture . reset ( ) ;
929+ } ) ,
930+ ) ,
931+ ) ;
932+ } ,
933+ ) ;
934+
872935it . effect . each ( [
873936 { length : 1_000 , suffix : "" , expectedLength : 1_000 } ,
874937 { length : 1_001 , suffix : "" , expectedLength : 1_000 } ,
@@ -2203,7 +2266,9 @@ it("does not flash a dismissed overlay after its initial compositor receipt arri
22032266 true ,
22042267 ) ;
22052268 await readingFrame . promise ;
2269+ assert . isFalse ( transition . isAnimating ) ;
22062270 transition . dismiss ( "capture-1" ) ;
2271+ assert . isFalse ( transition . isAnimating ) ;
22072272 frame . resolve ( ) ;
22082273 await begin ;
22092274
@@ -2292,7 +2357,9 @@ it("does not start a dismissed transition after its compositor receipt arrives",
22922357 } ) ;
22932358 const landing = transition . waitForLanding ( "capture-1" ) ;
22942359 await readingFrame . promise ;
2360+ assert . isTrue ( transition . isAnimating ) ;
22952361 transition . dismiss ( "capture-1" ) ;
2362+ assert . isFalse ( transition . isAnimating ) ;
22962363 frame . resolve ( ) ;
22972364 await landing ;
22982365
@@ -2424,6 +2491,7 @@ it("does not let a failed transition fail landing or capture completion", async
24242491 } ) ;
24252492
24262493 await transition . waitForLanding ( "capture-1" ) ;
2494+ assert . isFalse ( transition . isAnimating ) ;
24272495 await transition . complete ( "capture-1" ) ;
24282496
24292497 assert . isTrue ( flashWindows [ 0 ] ?. destroyed ) ;
0 commit comments