From 0fecc6aa6198c4f3e31100a1368eaeb32969264c Mon Sep 17 00:00:00 2001 From: ud18010 Date: Tue, 4 Aug 2026 14:57:51 +0800 Subject: [PATCH] test: define avatar catalog behavior --- .../Tests/EditMode/PlayerProfileModuleTests.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs b/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs index d305d7d8..6e478cfc 100644 --- a/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs +++ b/Client/Assets/Script/Tests/EditMode/PlayerProfileModuleTests.cs @@ -84,6 +84,23 @@ public sealed class PlayerProfileModuleTests Assert.That(profile.Experience01, Is.EqualTo(1f)); } + [Test] + public void AvatarCatalog_NormalizesLegacyAndInvalidIdsToDefault() + { + Assert.That(PlayerAvatarCatalog.NormalizeId(0), Is.EqualTo(PlayerAvatarCatalog.DefaultAvatarId)); + Assert.That(PlayerAvatarCatalog.NormalizeId(-3), Is.EqualTo(PlayerAvatarCatalog.DefaultAvatarId)); + Assert.That(PlayerAvatarCatalog.NormalizeId(PlayerAvatarCatalog.Count + 1), Is.EqualTo(PlayerAvatarCatalog.DefaultAvatarId)); + } + + [Test] + public void AvatarCatalog_MapsIdsToTwoDigitGamerPicPaths() + { + Assert.That(PlayerAvatarCatalog.GetAssetPath(1), Is.EqualTo("Assets/Game/Art/UI/Texture/Icon/GamerPic/GamerPic_01.png")); + Assert.That(PlayerAvatarCatalog.GetAssetPath(9), Is.EqualTo("Assets/Game/Art/UI/Texture/Icon/GamerPic/GamerPic_09.png")); + Assert.That(PlayerAvatarCatalog.GetAssetPath(54), Is.EqualTo("Assets/Game/Art/UI/Texture/Icon/GamerPic/GamerPic_54.png")); + Assert.That(PlayerAvatarCatalog.GetAssetPath(0), Is.EqualTo(PlayerAvatarCatalog.GetAssetPath(PlayerAvatarCatalog.DefaultAvatarId))); + } + #if UNITY_EDITOR [Test] public void PlayerProfileJsonFiles_PassPrefabBuilderValidation()