|  |  | @ -12,7 +12,7 @@ import time | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | from cereal import messaging, log |  |  |  | from cereal import messaging, log | 
			
		
	
		
		
			
				
					
					|  |  |  | from msgq.visionipc import VisionIpcServer, VisionStreamType |  |  |  | from msgq.visionipc import VisionIpcServer, VisionStreamType | 
			
		
	
		
		
			
				
					
					|  |  |  | from cereal.messaging import SubMaster, PubMaster |  |  |  | from cereal.messaging import PubMaster | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | from openpilot.common.basedir import BASEDIR |  |  |  | from openpilot.common.basedir import BASEDIR | 
			
		
	
		
		
			
				
					
					|  |  |  | from openpilot.common.params import Params |  |  |  | from openpilot.common.params import Params | 
			
		
	
		
		
			
				
					
					|  |  |  | from openpilot.common.prefix import OpenpilotPrefix |  |  |  | from openpilot.common.prefix import OpenpilotPrefix | 
			
		
	
	
		
		
			
				
					|  |  | @ -95,6 +95,7 @@ def setup_onroad_alert(click, pm: PubMaster, text1, text2, size, status=log.Self | 
			
		
	
		
		
			
				
					
					|  |  |  |   cs.alertStatus = status |  |  |  |   cs.alertStatus = status | 
			
		
	
		
		
			
				
					
					|  |  |  |   cs.alertType = "test_onroad_alert" |  |  |  |   cs.alertType = "test_onroad_alert" | 
			
		
	
		
		
			
				
					
					|  |  |  |   pm.send('selfdriveState', dat) |  |  |  |   pm.send('selfdriveState', dat) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   time.sleep(UI_DELAY) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | def setup_onroad_alert_small(click, pm: PubMaster): |  |  |  | def setup_onroad_alert_small(click, pm: PubMaster): | 
			
		
	
		
		
			
				
					
					|  |  |  |   setup_onroad_alert(click, pm, 'This is a small alert message', '', log.SelfdriveState.AlertSize.small) |  |  |  |   setup_onroad_alert(click, pm, 'This is a small alert message', '', log.SelfdriveState.AlertSize.small) | 
			
		
	
	
		
		
			
				
					|  |  | @ -123,9 +124,14 @@ def setup_update_available(click, pm: PubMaster): | 
			
		
	
		
		
			
				
					
					|  |  |  |   setup_settings_device(click, pm) |  |  |  |   setup_settings_device(click, pm) | 
			
		
	
		
		
			
				
					
					|  |  |  |   click(240, 216) |  |  |  |   click(240, 216) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | def setup_pair_device(click, pm: PubMaster): | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   click(1950, 435) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   click(1800, 900) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | CASES = { |  |  |  | CASES = { | 
			
		
	
		
		
			
				
					
					|  |  |  |   "homescreen": setup_homescreen, |  |  |  |   "homescreen": setup_homescreen, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   "prime": setup_homescreen, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   "pair_device": setup_pair_device, | 
			
		
	
		
		
			
				
					
					|  |  |  |   "settings_device": setup_settings_device, |  |  |  |   "settings_device": setup_settings_device, | 
			
		
	
		
		
			
				
					
					|  |  |  |   "onroad": setup_onroad, |  |  |  |   "onroad": setup_onroad, | 
			
		
	
		
		
			
				
					
					|  |  |  |   "onroad_sidebar": setup_onroad_sidebar, |  |  |  |   "onroad_sidebar": setup_onroad_sidebar, | 
			
		
	
	
		
		
			
				
					|  |  | @ -152,13 +158,12 @@ class TestUI: | 
			
		
	
		
		
			
				
					
					|  |  |  |     sys.modules["mouseinfo"] = False |  |  |  |     sys.modules["mouseinfo"] = False | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   def setup(self): |  |  |  |   def setup(self): | 
			
		
	
		
		
			
				
					
					|  |  |  |     Params().put("DongleId", "123456789012345") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     self.sm = SubMaster(["uiDebug"]) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     self.pm = PubMaster(list(DATA.keys())) |  |  |  |     self.pm = PubMaster(list(DATA.keys())) | 
			
		
	
		
		
			
				
					
					|  |  |  |     while not self.sm.valid["uiDebug"]: |  |  |  |     DATA['deviceState'].deviceState.networkType = log.DeviceState.NetworkType.wifi | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       self.sm.update(1) |  |  |  |     for _ in range(10): | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     time.sleep(UI_DELAY) # wait a bit more for the UI to start rendering |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       self.pm.send('deviceState', DATA['deviceState']) |  |  |  |       self.pm.send('deviceState', DATA['deviceState']) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       DATA['deviceState'].clear_write_flag() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       time.sleep(0.05) | 
			
		
	
		
		
			
				
					
					|  |  |  |     try: |  |  |  |     try: | 
			
		
	
		
		
			
				
					
					|  |  |  |       self.ui = pywinctl.getWindowsWithTitle("ui")[0] |  |  |  |       self.ui = pywinctl.getWindowsWithTitle("ui")[0] | 
			
		
	
		
		
			
				
					
					|  |  |  |     except Exception as e: |  |  |  |     except Exception as e: | 
			
		
	
	
		
		
			
				
					|  |  | @ -231,8 +236,15 @@ def create_screenshots(): | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   t = TestUI() |  |  |  |   t = TestUI() | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   with OpenpilotPrefix(): |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   for name, setup in CASES.items(): |  |  |  |   for name, setup in CASES.items(): | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     with OpenpilotPrefix(): | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       params = Params() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       params.put("DongleId", "123456789012345") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if name == 'prime': | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         params.put('PrimeType', '1') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       elif name == 'pair_device': | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         params.put('ApiCache_Device', '{"is_paired":0, "prime_type":-1}') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       t.test_ui(name, setup) |  |  |  |       t.test_ui(name, setup) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | if __name__ == "__main__": |  |  |  | if __name__ == "__main__": | 
			
		
	
	
		
		
			
				
					|  |  | 
 |