feat(h5): align third feedback with latest PSD and scanning screen
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"""The third PSD inserts 扫描 before 登录; never silently use its index."""
|
||||
import unittest
|
||||
from export_psd_assets import layer_at, ASSET_SPECS
|
||||
|
||||
|
||||
class Page(list):
|
||||
def __init__(self, name):
|
||||
super().__init__([["background"], [], [], [], [], [], [], [None, "brand", None, None, None, None, "wechat", "guest"]])
|
||||
self.name = name
|
||||
|
||||
|
||||
class LoginMappingTest(unittest.TestCase):
|
||||
def test_old_and_new_layout(self):
|
||||
for index in (9, 10):
|
||||
pages = [Page("other") for _ in range(index)] + [Page("登录")]
|
||||
if index == 10:
|
||||
pages[9].name = "扫描"
|
||||
self.assertEqual(layer_at(pages, "login/0/0"), "background")
|
||||
self.assertEqual(layer_at(pages, "login/7/1"), "brand")
|
||||
self.assertEqual(layer_at(pages, "login/7/6"), "wechat")
|
||||
|
||||
def test_missing_or_ambiguous_login(self):
|
||||
for pages in ([], [Page("扫描")], [Page("登录"), Page("登录")]):
|
||||
with self.assertRaises(ValueError):
|
||||
layer_at(pages, "login/0/0")
|
||||
|
||||
def test_every_login_asset_uses_semantic_mapping(self):
|
||||
names = {"bg-login.jpg", "brand-login.png", "icon-wechat.png", "icon-guest.png"}
|
||||
for filename, key, _ in ASSET_SPECS:
|
||||
if filename in names:
|
||||
self.assertTrue(key.startswith("login/"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user