Skip to content

Commit

Permalink
chore: test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonHough committed Jan 10, 2025
1 parent a334e20 commit b6a872f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Runtime/Core/Scripts/Animation/VoiceHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using UnityEngine.Android;
#endif


namespace ReadyPlayerMe.Core
{
/// <summary>
Expand Down Expand Up @@ -111,9 +110,10 @@ public void InitializeAudio()
{
try
{

if (AudioSource == null)
{
AudioSource = gameObject.AddComponent<AudioSource>();
AudioSource = GetComponent<AudioSource>() ?? gameObject.AddComponent<AudioSource>();
}

switch (AudioProvider)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Editor/AvatarConfigProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AvatarConfigProcessorTests
private const string MORPHTARGETS_EXPECTED_DEFAULT = "mouthOpen,mouthSmile";
private const string MORPHTARGETS_EXPECTED_NONE = "none";
private const string AVATAR_QUERY_PARAMS_ACTUAL =
"pose=T&lod=0&textureAtlas=none&textureSizeLimit=1024&textureChannels=baseColor,normal,metallicRoughness,emissive,occlusion&useHands=false&useDracoMeshCompression=false&useMeshOptCompression=false";
"pose=T&lod=0&textureAtlas=none&textureSizeLimit=1024&textureChannels=baseColor,normal,metallicRoughness,emissive,occlusion&morphTargets=none&useHands=false&useDracoMeshCompression=false&useMeshOptCompression=false&textureFormat=jpeg";
private readonly string[] morphTargetsDefault = { "mouthOpen", "mouthSmile" };
private readonly string[] morphTargetsNone = { "none" };
private readonly TextureChannel[] textureChannelsAll =
Expand Down
5 changes: 2 additions & 3 deletions Tests/Editor/AvatarLoaderWindowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public class AvatarLoaderWindowTests
[TearDown]
public void Cleanup()
{
TestUtils.DeleteAvatarDirectoryIfExists(TestAvatarData.DefaultAvatarUri.Guid, true);
TestUtils.DeleteCachedAvatar(TestAvatarData.DefaultAvatarUri.Guid);
TestUtils.DeleteEditorAvatarDirectoryIfExists(TestAvatarData.DefaultAvatarUri.Guid, true);
if (avatar != null)
{
Object.DestroyImmediate(avatar);
Expand Down Expand Up @@ -46,7 +45,7 @@ public IEnumerator Avatar_Loaded_Stored_And_No_Overrides()
{
yield return null;
avatar = GameObject.Find(TestAvatarData.DefaultAvatarUri.Guid);
} while (avatar == null && System.DateTime.Now.Subtract(time).Seconds < 5);
} while (avatar == null && System.DateTime.Now.Subtract(time).Seconds < 10);

window.Close();
Assert.IsNotNull(avatar);
Expand Down
9 changes: 9 additions & 0 deletions Tests/Editor/Common/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ public static void DeleteAvatarDirectoryIfExists(string avatarGuid, bool recursi
}
}

public static void DeleteEditorAvatarDirectoryIfExists(string avatarGuid, bool recursive = false)
{
var path = $"{Application.dataPath}/Assets/Ready Player Me/Avatars/{avatarGuid}";
if (Directory.Exists(path))
{
Directory.Delete(path, recursive);
}
}

public static void DeleteCachedAvatar(string avatarGuid)
{
var deleteAsset = AssetDatabase.DeleteAsset($"Assets/Ready Player Me/Avatars/{avatarGuid}");
Expand Down

0 comments on commit b6a872f

Please sign in to comment.