@@ -110,13 +110,17 @@ def analyze(
110110
111111 # 测试 get_node_data (Context 级别)
112112 node_data = new_ctx .get_node_data (argv .node_name )
113- print (f" ctx.get_node_data keys: { list (node_data .keys ()) if node_data else None } " )
113+ print (
114+ f" ctx.get_node_data keys: { list (node_data .keys ()) if node_data else None } "
115+ )
114116
115117 # 测试 anchor API
116118 new_ctx .set_anchor ("test_anchor" , "TaskA" )
117119 anchor_result = new_ctx .get_anchor ("test_anchor" )
118120 print (f" anchor_result: { anchor_result } " )
119- assert anchor_result == "TaskA" , f"anchor should be 'TaskA', got { anchor_result } "
121+ assert (
122+ anchor_result == "TaskA"
123+ ), f"anchor should be 'TaskA', got { anchor_result } "
120124
121125 # 测试 hit count API
122126 hit_count = new_ctx .get_hit_count (argv .node_name )
@@ -218,6 +222,12 @@ def run(
218222 cached_image = controller .cached_image
219223 print (f" cached_image shape: { cached_image .shape } " )
220224
225+ # 测试 resolution (需要在首次截图后才能获取有效值)
226+ resolution = controller .resolution
227+ print (f" resolution: { resolution } " )
228+ assert isinstance (resolution , tuple ), "resolution should be a tuple"
229+ assert len (resolution ) == 2 , "resolution should have 2 elements"
230+
221231 # 测试基本输入操作
222232 controller .post_click (191 , 98 ).wait ()
223233 controller .post_swipe (100 , 200 , 300 , 400 , 100 ).wait ()
@@ -250,7 +260,9 @@ def run(
250260 task_detail = task_job .get ()
251261
252262 if task_detail :
253- print (f" task_detail: entry={ task_detail .entry } , status={ task_detail .status } " )
263+ print (
264+ f" task_detail: entry={ task_detail .entry } , status={ task_detail .status } "
265+ )
254266
255267 # 测试 get_task_detail
256268 fetched_task_detail = tasker .get_task_detail (task_detail .task_id )
@@ -262,13 +274,13 @@ def run(
262274 if task_detail .nodes :
263275 node = task_detail .nodes [0 ]
264276 node_detail = tasker .get_node_detail (node .node_id )
265- print (
266- f" get_node_detail: { node_detail .name if node_detail else None } "
267- )
277+ print (f" get_node_detail: { node_detail .name if node_detail else None } " )
268278
269279 # 测试 get_recognition_detail
270280 if node .recognition :
271- reco_detail = tasker .get_recognition_detail (node .recognition .reco_id )
281+ reco_detail = tasker .get_recognition_detail (
282+ node .recognition .reco_id
283+ )
272284 print (
273285 f" get_recognition_detail: { reco_detail .name if reco_detail else None } "
274286 )
0 commit comments