AEUPH commited on
Commit
f7b30fc
·
verified ·
1 Parent(s): de56710

Fix black tiles on connect; 64px tiles, byte-based delta choice

Browse files
Files changed (1) hide show
  1. test_e2e_wire.py +20 -2
test_e2e_wire.py CHANGED
@@ -10,10 +10,12 @@ import struct
10
  import subprocess
11
  import sys
12
  import time
 
13
 
14
  import urllib.request
15
 
16
  import websockets
 
17
 
18
 
19
  def get_json(url, timeout=10):
@@ -47,8 +49,6 @@ async def run():
47
  continue
48
  assert t == 0, f"expected full frame, got type {t}"
49
  assert h["w"] == h["h"] == 1024
50
- from io import BytesIO
51
- from PIL import Image
52
  img = Image.open(BytesIO(payload)); img.load()
53
  assert img.size == (1024, 1024), img.size
54
  full_bytes = len(payload)
@@ -83,6 +83,24 @@ async def run():
83
  break
84
  assert saw, "no frame after Text2OS"
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  # 4) metrics endpoint
87
  m = get_json(f"{BASE}/metrics")
88
  print("FULL bytes:", full_bytes)
 
10
  import subprocess
11
  import sys
12
  import time
13
+ from io import BytesIO
14
 
15
  import urllib.request
16
 
17
  import websockets
18
+ from PIL import Image
19
 
20
 
21
  def get_json(url, timeout=10):
 
49
  continue
50
  assert t == 0, f"expected full frame, got type {t}"
51
  assert h["w"] == h["h"] == 1024
 
 
52
  img = Image.open(BytesIO(payload)); img.load()
53
  assert img.size == (1024, 1024), img.size
54
  full_bytes = len(payload)
 
83
  break
84
  assert saw, "no frame after Text2OS"
85
 
86
+ # 3.5) a late-joining client must receive the WHOLE desktop, not just the
87
+ # tiles the cursor happens to dirty. Regression: "black tiles until
88
+ # mouseover" -- the shared delta stream left new sockets almost blank.
89
+ await asyncio.sleep(0.5)
90
+ async with websockets.connect(WS, max_size=None) as late:
91
+ deadline = time.time() + 10
92
+ got_full = None
93
+ while time.time() < deadline:
94
+ t, h, payload = unpack(await asyncio.wait_for(late.recv(), 10))
95
+ if t == 2:
96
+ continue
97
+ got_full = t
98
+ break
99
+ assert got_full == 0, f"late client got frame type {got_full}, want full(0)"
100
+ img = Image.open(BytesIO(payload)); img.load()
101
+ assert img.size == (1024, 1024), img.size
102
+ kinds.append("late_full")
103
+
104
  # 4) metrics endpoint
105
  m = get_json(f"{BASE}/metrics")
106
  print("FULL bytes:", full_bytes)