Esempio n. 1
0
        public IEnumerator MaterialsSetCorrectly()
        {
            AvatarTestHelpers.CreateTestCatalog();
            AvatarShape avatar = AvatarTestHelpers.CreateAvatarShape(scene, "Joan Darteis", "TestAvatar.json");

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            AssertMaterialsAreCorrect(avatar.transform);
        }
Esempio n. 2
0
        public IEnumerator NameBackgroundHasCorrectSize()
        {
            AvatarTestHelpers.CreateTestCatalog();
            AvatarShape avatar = AvatarTestHelpers.CreateAvatarShape(scene, "Maiqel Yacson", "TestAvatar.json");

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            avatar.transform.position = new Vector3(13, 0, 4);

            RectTransform rt = avatar.avatarName.uiContainer.GetComponent <RectTransform>();

            Assert.IsTrue((int)Mathf.Abs(rt.sizeDelta.x) == 190 && (int)Mathf.Abs(rt.sizeDelta.y) == 40, $"Avatar name dimensions are incorrect!. Current: {rt.sizeDelta}");
        }
Esempio n. 3
0
        public IEnumerator WhenTwoAvatarsLoadAtTheSameTimeTheyHaveProperMaterials()
        {
            //NOTE(Brian): Avatars must be equal to share their meshes.
            AvatarTestHelpers.CreateTestCatalog();
            AvatarShape avatar  = AvatarTestHelpers.CreateAvatarShape(scene, "Naicholas Keig", "TestAvatar.json");
            AvatarShape avatar2 = AvatarTestHelpers.CreateAvatarShape(scene, "Naicholas Keig", "TestAvatar2.json");

            avatar.transform.position  = new Vector3(-5, 0, 0);
            avatar2.transform.position = new Vector3(5, 0, 0);

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded && avatar2.everythingIsLoaded, 25));

            AssertMaterialsAreCorrect(avatar.transform);
            AssertMaterialsAreCorrect(avatar2.transform);
        }
Esempio n. 4
0
        public IEnumerator DestroyWhileLoading()
        {
            AvatarTestHelpers.CreateTestCatalog();
            AvatarShape avatar = AvatarTestHelpers.CreateAvatarShape(scene, "Abortit", "TestAvatar.json");

            GameObject goEntity = avatar.entity.gameObject;

            TestHelpers.RemoveSceneEntity(scene, avatar.entity);

            yield return(null);

            bool destroyedOrPooled = goEntity == null || !goEntity.activeSelf;

            Assert.IsTrue(destroyedOrPooled);
        }
Esempio n. 5
0
        public IEnumerator AvatarShapeVisualTest2()
        {
            yield return(InitVisualTestsScene("AvatarShape_B"));

            AvatarTestHelpers.CreateTestCatalog();
            AvatarShape avatar = AvatarTestHelpers.CreateAvatarShape(scene, "Avatar #2", "TestAvatar2.json");

            Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
            Vector3 camTarget = avatar.transform.position + Vector3.up * 2.0f;

            VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            yield return(VisualTestHelpers.TakeSnapshot());
        }
Esempio n. 6
0
        public IEnumerator MouthWithMask()
        {
            yield return(InitVisualTestsScene("AvatarShapeVisualTests_MouthWithMask"));

            AvatarTestHelpers.CreateTestCatalogLocal();
            var         model  = AvatarTestHelpers.GetTestAvatarModel("Avatar #1", "TestAvatar_MaskMouth.json");
            AvatarShape avatar = AvatarTestHelpers.CreateAvatarShape(scene, model);

            Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
            Vector3 camTarget = avatar.transform.position + Vector3.up * 2.0f;

            VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

            yield return(new WaitUntil(() => avatar.everythingIsLoaded, 20));

            yield return(VisualTestHelpers.TakeSnapshot());
        }
Esempio n. 7
0
        public IEnumerator InterpolatePosition()
        {
            AvatarTestHelpers.CreateTestCatalog();
            AvatarShape avatar = AvatarTestHelpers.CreateAvatarShape(scene, "Abortitus", "TestAvatar.json");

            // We must wait for the AvatarShape to finish or the OnTransformChanged event is not used
            yield return(new DCL.WaitUntil(() => avatar.everythingIsLoaded, 20));

            Assert.AreEqual(0f, avatar.entity.gameObject.transform.position.x);
            Assert.AreEqual(0f, avatar.entity.gameObject.transform.position.z);

            // Update position to the other end of the parcel
            var transformModel = new DCLTransform.Model {
                position = new Vector3(15, 2, 15)
            };

            TestHelpers.SetEntityTransform(scene, avatar.entity, transformModel);

            yield return(null);

            Assert.AreNotEqual(15f, avatar.entity.gameObject.transform.position.x);
            Assert.AreNotEqual(15f, avatar.entity.gameObject.transform.position.z);
        }