fix: 修复自绘颜色行安全点击误判 (#270)

This commit is contained in:
chengma
2026-08-18 16:40:47 +08:00
parent b538370171
commit e2ed00c38c
2 changed files with 78 additions and 1 deletions
+37
View File
@@ -263,6 +263,43 @@ class StaticColorSelectionTest(unittest.TestCase):
self.assertTrue(selected)
self.assertEqual(device.clicks, [(194, 1389)])
def test_non_scrollable_row_ignores_same_row_style_option_as_heading(self):
simplified = "纯欲莹白【透.视蕾丝衣.免脱款】"
traditional = "純欲瑩白【透.視蕾絲衣.免脫款】"
panel_xml = f'''<hierarchy>
<node bounds="[0,0][1080,2340]">
<node text="请选择:颜色 尺码" bounds="[36,950][1044,1000]" />
<node clickable="true" bounds="[0,1039][1080,1174]">
<node bounds="[36,1039][220,1174]">
<node text="{simplified}" bounds="[36,1081][216,1134]" />
</node>
<node bounds="[635,1039][1044,1174]">
<node text="款式" bounds="[639,1081][1044,1134]" />
</node>
</node>
<node text="尺码" bounds="[36,1200][126,1253]" />
</node>
</hierarchy>'''
device = StaticColorDevice(
panel_xml,
selected_text=simplified,
)
selected = select_color(
device,
panel_xml,
traditional,
action_delay=0.001,
)
self.assertTrue(selected)
self.assertEqual(device.swipes, [])
self.assertEqual(device.clicks, [(126, 1107)])
self.assertEqual(
color_selection_failure_reason(panel_xml, traditional),
"selection_unconfirmed",
)
def test_traditional_size_matches_unique_simplified_option(self):
simplified = "均码【40.0-60.0公斤】"
traditional = "均碼【40.0-60.0公斤】"