Integrate AVA2 native shop and refine mobile controls and locale tooltips
This commit is contained in:
@@ -29,6 +29,7 @@ class MockWidget(object):
|
||||
def SetDownVisual(self, v): self.visuals['down'] = v
|
||||
def SetEvent(self, ev): self.event = ev
|
||||
def SetText(self, t): self.text = t
|
||||
def SetToolTipText(self, t): self.tooltip = t
|
||||
def SetOutline(self): pass
|
||||
def SetHorizontalAlignRight(self): pass
|
||||
def SetPackedFontColor(self, c): pass
|
||||
@@ -40,11 +41,15 @@ class MockWidget(object):
|
||||
|
||||
class MinimapButtonsTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
names = ('app', 'game', 'ui', 'wndMgr', 'mt_dungeons', 'mt_battlepass', 'mt_biolog')
|
||||
names = ('app', 'game', 'ui', 'wndMgr', 'mt_dungeons', 'mt_battlepass', 'mt_biolog', 'player', 'mt_channel', 'mt_wiki')
|
||||
mods = {n: types.ModuleType(n) for n in names}
|
||||
mods['app'].DIK_F5 = 63
|
||||
mods['app'].DIK_F6 = 64
|
||||
mods['app'].DIK_F7 = 65
|
||||
mods['app'].DIK_F8 = 66
|
||||
mods['player'].AutoHuntLocalize = lambda text: text.encode('gbk')
|
||||
mods['mt_channel'].Toggle = lambda: None
|
||||
mods['mt_wiki'].Toggle = lambda: None
|
||||
|
||||
self.toggles = {'dungeon': 0, 'battlepass': 0, 'biolog': 0}
|
||||
mods['mt_dungeons'].Toggle = lambda: self.toggles.__setitem__('dungeon', self.toggles['dungeon'] + 1)
|
||||
@@ -75,7 +80,10 @@ class MinimapButtonsTests(unittest.TestCase):
|
||||
self.wndMiniMap.ShowMiniMap = lambda: self.wndMiniMap.OpenWindow.Show()
|
||||
self.wndMiniMap.OnUpdate = lambda: None
|
||||
|
||||
self.gw.interface = types.SimpleNamespace(wndMiniMap=self.wndMiniMap)
|
||||
self.expanded = MockWidget()
|
||||
self.expanded.expandedTaskBarBoard = MockWidget()
|
||||
self.gw.interface = types.SimpleNamespace(
|
||||
wndMiniMap=self.wndMiniMap, wndExpandedTaskBar=self.expanded)
|
||||
self.game.GameWindow.Open(self.gw)
|
||||
self.ring = self.ns['g_ring']
|
||||
|
||||
@@ -96,17 +104,27 @@ class MinimapButtonsTests(unittest.TestCase):
|
||||
# Dungeon: (-10, 40)
|
||||
self.assertEqual(self.ring.btnDungeon.pos, (-10, 40))
|
||||
self.assertEqual(self.ring.btnDungeon.visuals['up'], "d:/ymir work/ui/game/minimapa/dungeon_0.tga")
|
||||
self.assertEqual(self.ring.tipDungeon.textLine.text, "[F5] 副本信息")
|
||||
self.assertEqual(self.ring.tipDungeon.textLine.text, "[F5] 副本信息".encode("gbk"))
|
||||
|
||||
# BattlePass: (0, 80)
|
||||
self.assertEqual(self.ring.btnBattlePass.pos, (0, 80))
|
||||
self.assertEqual(self.ring.btnBattlePass.visuals['up'], "d:/ymir work/ui/game/battle_pass/battlepass_icon_0.tga")
|
||||
self.assertEqual(self.ring.tipBattlePass.textLine.text, "[F6] 战斗通行证")
|
||||
self.assertEqual(self.ring.tipBattlePass.textLine.text, "[F6] 战斗通行证".encode("gbk"))
|
||||
|
||||
# Biolog: (15, 105)
|
||||
self.assertEqual(self.ring.btnBiolog.pos, (15, 105))
|
||||
self.assertEqual(self.ring.btnBiolog.visuals['up'], "d:/ymir work/ui/game/minimapa/biolog_0.tga")
|
||||
self.assertEqual(self.ring.tipBiolog.textLine.text, "[F7] 生物学家")
|
||||
self.assertEqual(self.ring.tipBiolog.textLine.text, "[F7] 生物学家".encode("gbk"))
|
||||
|
||||
def test_all_chinese_tooltips_use_locale_bytes(self):
|
||||
expected = ((self.ring.tipDungeon, "[F5] 副本信息"),
|
||||
(self.ring.tipBattlePass, "[F6] 战斗通行证"),
|
||||
(self.ring.tipBiolog, "[F7] 生物学家"),
|
||||
(self.ring.tipChannel, "[F8] 点击换线"))
|
||||
for tooltip, label in expected:
|
||||
self.assertEqual(tooltip.textLine.text.decode('gbk'), label)
|
||||
self.assertEqual(self.expanded.btnSwitchbot.tooltip.decode('gbk'), "自动洗练")
|
||||
self.assertEqual(self.expanded.btnWiki.tooltip.decode('gbk'), "游戏百科")
|
||||
|
||||
def test_button_clicks_trigger_subsystems(self):
|
||||
self.ring.btnDungeon.event()
|
||||
|
||||
Reference in New Issue
Block a user