复查修正: 饰品三选一被上游倒序、选队顶栏同名被覆盖
- 饰品(P1-3): 三张及以上时上游把认出体系图标的卡逐张 insert(0), 后看的排到最前,
两张命中关键词的卡都带图标时补丁的顺序会被倒过来, 先拿命中少的。现在交给上游
"没命中的(原顺序) + 命中的(倒着)", 上游查体系图标时对命中的卡答"有", 拼出来是
命中多 -> 命中少 -> 只认出图标 -> 其余。测试的假界面加上体系图标, 先复现再修。
- 选队(P1-5): _team_ocr 经 _run_ocr_for_text 的 {文本: 坐标} 取结果, 选中某队后
顶栏和列表同名, 顶栏那条会被覆盖; 旧测试用成对结果模拟重复, 真实 dict 做不到。
改读 OCR 引擎逐行结果(同一引擎、同一截图), 引擎导入不了才退回 dict。
- 事件(P1-4): 同一张截图只判断一次, 单通模式再找 "???" 时不再整屏 OCR 第二遍。
- 文档: 修正 BACKLOG/README/交接文档对应描述, 去掉两处没核实的推断。
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,12 @@ class GiftCardHitsTest(unittest.TestCase):
|
|||||||
lines = [('流血', 440, 300), ('流血', 500, 300)]
|
lines = [('流血', 440, 300), ('流血', 500, 300)]
|
||||||
self.assertEqual(ap.gift_card_hits(cards, lines, ('流血',), SCALE), [['流血'], ['流血']])
|
self.assertEqual(ap.gift_card_hits(cards, lines, ('流血',), SCALE), [['流血'], ['流血']])
|
||||||
|
|
||||||
|
def test_upstream_order_undoes_the_icon_insertion(self):
|
||||||
|
# 两张卡上游按给的顺序挑; 三张时命中的卡被上游逐张 insert(0), 所以倒着给、放在最后
|
||||||
|
self.assertEqual(ap.gift_upstream_order([[], ['x']]), [1, 0])
|
||||||
|
self.assertEqual(ap.gift_upstream_order([['x'], [], ['x', 'y']]), [1, 0, 2])
|
||||||
|
self.assertEqual(ap.gift_upstream_order([[], [], []]), [0, 1, 2])
|
||||||
|
|
||||||
def test_rank_is_stable(self):
|
def test_rank_is_stable(self):
|
||||||
cards = ['a', 'b', 'c']
|
cards = ['a', 'b', 'c']
|
||||||
self.assertEqual(ap.rank_gift_cards(cards, [[], ['x'], []]), ['b', 'a', 'c'])
|
self.assertEqual(ap.rank_gift_cards(cards, [[], ['x'], []]), ['b', 'a', 'c'])
|
||||||
@@ -96,7 +102,8 @@ class KeywordTableTest(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class GiftScreen:
|
class GiftScreen:
|
||||||
"""饰品选择界面: 每张卡 {'pos', 'lines'}; 系统图标模板永远匹配不上(本机现状)。"""
|
"""饰品选择界面: 每张卡 {'pos', 'lines', 'icon'}; icon 为 True 的卡体系图标模板能匹配上
|
||||||
|
(本机日志里没见它匹配上过, 默认 False)。"""
|
||||||
|
|
||||||
def __init__(self, cards, pick='0/1'):
|
def __init__(self, cards, pick='0/1'):
|
||||||
self.cards = cards
|
self.cards = cards
|
||||||
@@ -122,6 +129,11 @@ class GiftScreen:
|
|||||||
def find_element(self, target, find_type='image', threshold=0.8, my_crop=None, **kwargs):
|
def find_element(self, target, find_type='image', threshold=0.8, my_crop=None, **kwargs):
|
||||||
if target == ap.GIFT_CARD and find_type == 'image_with_multiple_targets':
|
if target == ap.GIFT_CARD and find_type == 'image_with_multiple_targets':
|
||||||
return [card['pos'] for card in self.cards]
|
return [card['pos'] for card in self.cards]
|
||||||
|
if target.startswith('mirror/road_in_mir/acquire_ego_gift/') and my_crop:
|
||||||
|
x1, y1, x2, y2 = my_crop
|
||||||
|
for card in self.cards:
|
||||||
|
if card.get('icon') and x1 <= card['pos'][0] <= x2 and y1 <= card['pos'][1] <= y2:
|
||||||
|
return card['pos']
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def find_language_text(self, zh_text, en_text, my_crop=None, **kwargs):
|
def find_language_text(self, zh_text, en_text, my_crop=None, **kwargs):
|
||||||
@@ -146,8 +158,8 @@ class GiftScreen:
|
|||||||
for _, x, y in lines])
|
for _, x, y in lines])
|
||||||
|
|
||||||
|
|
||||||
def card(x, *lines):
|
def card(x, *lines, icon=False):
|
||||||
return {'pos': (x, 300), 'lines': list(lines)}
|
return {'pos': (x, 300), 'lines': list(lines), 'icon': icon}
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(MIRROR.is_file(), 'vendor/aalc 子模块未检出')
|
@unittest.skipUnless(MIRROR.is_file(), 'vendor/aalc 子模块未检出')
|
||||||
@@ -222,6 +234,25 @@ class UpstreamAcquireEgoGiftTest(unittest.TestCase):
|
|||||||
cards = [card(300, '烧伤'), card(600, '流血'), card(900, '流血', '施加流血')]
|
cards = [card(300, '烧伤'), card(600, '流血'), card(900, '流血', '施加流血')]
|
||||||
self.assertEqual(self.choose(cards, pick='0/2')[0], [2, 1])
|
self.assertEqual(self.choose(cards, pick='0/2')[0], [2, 1])
|
||||||
|
|
||||||
|
def test_icon_cards_keep_the_keyword_order(self):
|
||||||
|
# 上游把认出体系图标的卡逐张 insert(0), 后认出的反而排前面; 补丁要抵消这一步
|
||||||
|
cards = [card(300, '施加流血', icon=True), card(600, '流血', '施加流血', '流血层数', icon=True), card(900, '烧伤')]
|
||||||
|
self.assertEqual(self.choose(cards)[0], [1])
|
||||||
|
self.assertEqual(self.choose(cards, pick='0/2')[0], [1, 0])
|
||||||
|
|
||||||
|
def test_keyword_card_without_icon_still_beats_an_icon_card(self):
|
||||||
|
cards = [card(300, '流血', '施加流血', '流血层数'), card(600, '施加流血', icon=True), card(900, '烧伤')]
|
||||||
|
self.assertEqual(self.choose(cards)[0], [0])
|
||||||
|
|
||||||
|
def test_icon_only_card_comes_after_keyword_cards_but_before_the_rest(self):
|
||||||
|
cards = [card(300, '烧伤'), card(600, '没读出关键词', icon=True), card(900, '施加流血')]
|
||||||
|
self.assertEqual(self.choose(cards, patched=False)[0], [1])
|
||||||
|
self.assertEqual(self.choose(cards, pick='0/2')[0], [2, 1])
|
||||||
|
|
||||||
|
def test_without_keywords_icons_behave_like_upstream(self):
|
||||||
|
cards = [card(300, '烧伤', icon=True), card(600, '震颤', icon=True), card(900, '充能')]
|
||||||
|
self.assertEqual(self.choose(cards, pick='0/2')[0], self.choose(cards, pick='0/2', patched=False)[0])
|
||||||
|
|
||||||
def test_misread_keyword_for_tremor(self):
|
def test_misread_keyword_for_tremor(self):
|
||||||
cards = [card(300, '流血'), card(600, '施加震颐')]
|
cards = [card(300, '流血'), card(600, '施加震颐')]
|
||||||
self.assertEqual(self.choose(cards, system='tremor')[0], [1])
|
self.assertEqual(self.choose(cards, system='tremor')[0], [1])
|
||||||
|
|||||||
Reference in New Issue
Block a user