# Picture in picture (S048, S056): the tab's own view moves into the PiP window and back; the page keeps its state (no
# reload, video keeps playing); only the video shows (element full screen inside the PiP window, the main window stays
# as it was). Offline. Run with tools/smoke.sh; read the PNGs (pip-window: the video alone, controls on hover).
# Floating on niri: tools/hidden.sh tests/smoke/pip.txt <out> -- tests/smoke/pip-driver.sh, then <out>/windows.json
# has the PiP window (app id dev.nacre.Nacre.Pip) with is_floating true.
wait 3
open @PAGES@/video.html
waitload
waitfor 10 document.getElementById('v').currentTime > 0.5
js window.marker = 42
cmd pip
wait 2
expect /active/pip true
expect /windows 2
shot pip-window pip
shot pip-tab
assert window.marker === 42 && !document.getElementById('v').paused && document.fullscreenElement === document.getElementById('v').parentElement
expect /fullscreen false
hover 200 120 pip
wait 1
shot pip-hover pip
set /theme/mode "dark"
hover 210 120 pip
wait 1
shot pip-hover-dark pip
js window.t0 = document.getElementById('v').currentTime
wait 1.5
assert document.getElementById('v').currentTime !== window.t0
cmd exitpip
wait 1.5
expect /windows 1
expect /active/pip false
assert window.marker === 42 && !document.getElementById('v').paused && !document.fullscreenElement && !document.documentElement.classList.contains('__nacre_pip')
shot pip-back
status done
quit
