From 7cbea6186c7921618f4f8e5219d09a12abf00bf6 Mon Sep 17 00:00:00 2001 From: ud18010 Date: Tue, 4 Aug 2026 15:13:23 +0800 Subject: [PATCH] test: define avatar picker prefab contract --- .../Tests/EditMode/PlayerProfileModuleTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs b/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs index 6e478cfc..e691c4b8 100644 --- a/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs +++ b/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs @@ -101,12 +101,28 @@ public sealed class PlayerProfileModuleTests Assert.That(PlayerAvatarCatalog.GetAssetPath(0), Is.EqualTo(PlayerAvatarCatalog.GetAssetPath(PlayerAvatarCatalog.DefaultAvatarId))); } + [Test] + public void AvatarPickerJson_DeclaresAllAvatarButtons() + { + string projectRoot = System.IO.Directory.GetParent(Application.dataPath).Parent.FullName; + string jsonPath = System.IO.Path.Combine(projectRoot, "Doc/UIPrefabCreater/UI_PlayerAvatarPicker.json"); + string json = System.IO.File.ReadAllText(jsonPath); + + for (int avatarId = 1; avatarId <= PlayerAvatarCatalog.Count; avatarId++) + { + string suffix = avatarId.ToString("00", System.Globalization.CultureInfo.InvariantCulture); + StringAssert.Contains("Btn_Avatar_" + suffix, json); + StringAssert.Contains("GamerPic_" + suffix + ".png", json); + } + } + #if UNITY_EDITOR [Test] public void PlayerProfileJsonFiles_PassPrefabBuilderValidation() { Assert.That(JsonUIPrefabBuilder.Validate("../Doc/UIPrefabCreater/UI_PlayerProfileHud.json").Ok, Is.True); Assert.That(JsonUIPrefabBuilder.Validate("../Doc/UIPrefabCreater/UI_PlayerProfilePanel.json").Ok, Is.True); + Assert.That(JsonUIPrefabBuilder.Validate("../Doc/UIPrefabCreater/UI_PlayerAvatarPicker.json").Ok, Is.True); } #endif }