예제 #1
0
    public IEnumerator UIInputTextTest1()
    {
        yield return(InitUIVisualTestScene("UIInputTextTest"));

        string mainContainerId = "herodes";

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = screenSpaceId,
            color = Color.green,
            width = new UIValue(50f, UIValue.Unit.PERCENT),
            height = new UIValue(50f, UIValue.Unit.PERCENT)
        }, mainContainerId));

        yield return(CreateUIComponent <UIInputText, Mock_UIInputTextModel>(CLASS_ID.UI_INPUT_TEXT_SHAPE, new Mock_UIInputTextModel
        {
            parentComponent = mainContainerId,
            width = new UIValue(80f, UIValue.Unit.PERCENT),
            height = new UIValue(25f),
            vAlign = "bottom",
            hAlign = "left",
            placeholder = "Write message here",
            placeholderColor = Color.gray,
            positionX = new UIValue(10f, UIValue.Unit.PERCENT),
            positionY = new UIValue(10f),
            fontSize = 10f
        }, "textInput"));

        yield return(VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)));
    }
예제 #2
0
    protected IEnumerator InitUIVisualTestScene(string testName)
    {
        yield return(InitScene());

        yield return(VisualTestHelpers.InitVisualTestsScene(testName));

        // Create UIScreenSpace
        UIScreenSpace screenSpace = TestHelpers.SharedComponentCreate <UIScreenSpace, UIScreenSpace.Model>(scene, CLASS_ID.UI_SCREEN_SPACE_SHAPE);

        yield return(screenSpace.routine);

        screenSpaceId = screenSpace.id;

        // The canvas has to be in ScreenSpaceCamera mode to be able to render the UI correctly for the snapshots
        screenSpace.canvas.renderMode    = RenderMode.ScreenSpaceCamera;
        screenSpace.canvas.worldCamera   = VisualTestController.i.camera;
        screenSpace.canvas.planeDistance = 1;

        // The camera should only render UI to decrease conflict chance with future ground changes, etc.
        VisualTestController.i.camera.cullingMask = 1 << LayerMask.NameToLayer("UI");

        int id = GameViewUtils.AddOrGetCustomSize(GameViewUtils.GameViewSizeType.FixedResolution, UnityEditor.GameViewSizeGroupType.Standalone, 1280, 720, "Test Resolution");

        GameViewUtils.SetSize(id);
    }
    public IEnumerator AlbedoTexture_AlbedoAlpha(float alpha)
    {
        yield return(InitVisualTestsScene($"PBRMaterialVisualTests_AlbedoTexture_AlbedoAlpha_{alpha.ToString(CultureInfo.InvariantCulture)}"));

        VisualTestHelpers.SetSSAOActive(true);

        Vector3 camTarget = new Vector3(5, 1, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(4.6f, 1.8f, 0.6f), camTarget);

        DCLTexture texture = TestHelpers.CreateDCLTexture(scene, TestAssetsUtils.GetPath() + "/Images/avatar.png");

        yield return(texture.routine);

        PlaneShape plane       = TestHelpers.CreateEntityWithPlaneShape(scene, new Vector3(5, 1, 5), true);
        IDCLEntity planeEntity = plane.attachedEntities.FirstOrDefault();

        TestHelpers.SetEntityTransform(scene, planeEntity, new Vector3(5, 1, 5), Quaternion.Euler(0, 0, 180), Vector3.one * 3);
        PBRMaterial planeMaterial = TestHelpers.AttachPBRMaterialToEntity(scene, planeEntity, new PBRMaterial.Model
        {
            transparencyMode = 2,
            albedoTexture    = texture.id,
            albedoColor      = new Color(1, 1, 1, alpha)
        });

        yield return(plane.routine);

        yield return(planeMaterial.routine);

        yield return(null);

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #4
0
        public IEnumerator VisualTest0()
        {
            yield return(InitVisualTestsScene("AvatarNamesHUD_VisualTest0"));

            //Set the canvas to CameraSpace so it gets renderer in the screenshot
            Canvas canvas = hudView.GetComponent <Canvas>();

            canvas.worldCamera = Camera.main;
            canvas.renderMode  = RenderMode.ScreenSpaceCamera;

            VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(6, 1.2f, -1.5f), new Vector3(6, 1.2f, -1.5f) + Vector3.forward);

            BoxShape     box0  = TestHelpers.CreateEntityWithBoxShape(scene, new Vector3(4, 0, 4), true);
            PlayerStatus user0 = new PlayerStatus {
                id = "user0", name = "The User0 in Box", worldPosition = box0.attachedEntities.First().gameObject.transform.position, isTalking = false
            };

            yield return(box0.routine);

            hudView.TrackPlayer(user0);

            SphereShape  sphere = TestHelpers.CreateEntityWithSphereShape(scene, new Vector3(8, 0, 8), true);
            PlayerStatus user1  = new PlayerStatus {
                id = "user1", name = "The User1 in Sphere", worldPosition = sphere.attachedEntities.First().gameObject.transform.position, isTalking = true
            };

            yield return(sphere.routine);

            hudView.TrackPlayer(user1);

            yield return(null);

            yield return(VisualTestHelpers.TakeSnapshot());
        }
예제 #5
0
        /// <summary>
        /// Position camera based on renderer bounds and take snapshot
        /// </summary>
        private static IEnumerator TakeObjectSnapshot(GameObject targetGO, string testName)
        {
            Vector3 originalScale = targetGO.transform.localScale;
            var     renderers     = targetGO.GetComponentsInChildren <Renderer>();

            // unify all child renderer bounds and use that to position the snapshot camera
            var mergedBounds = Helpers.Utils.BuildMergedBounds(renderers);

            // Some objects are imported super small (like 0.00x in scale) and we can barely see them in the snapshots
            if (mergedBounds.size.magnitude < 1f)
            {
                targetGO.transform.localScale *= 100;
                mergedBounds = Helpers.Utils.BuildMergedBounds(renderers);
            }

            Vector3 offset = mergedBounds.extents;

            offset.x = Mathf.Max(1, offset.x);
            offset.y = Mathf.Max(1, offset.y);
            offset.z = Mathf.Max(1, offset.z);

            Vector3 cameraPosition = new Vector3(mergedBounds.min.x - offset.x, mergedBounds.max.y + offset.y, mergedBounds.min.z - offset.z);

            yield return(VisualTestHelpers.TakeSnapshot(testName, Camera.main, cameraPosition, mergedBounds.center));

            targetGO.transform.localScale = originalScale;
        }
예제 #6
0
    public IEnumerator AlphaTextureShouldWork()
    {
        yield return(InitVisualTestsScene("PBRMaterialVisualTests_AlphaTextureShouldWork"));

        DCLTexture texture = TestHelpers.CreateDCLTexture(scene, Utils.GetTestsAssetsPath() + "/Images/alphaTexture.png");

        yield return(texture.routine);

        Vector3 camTarget = new Vector3(5, 2, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, camTarget - new Vector3(2, -1, 2), camTarget);

        PBRMaterial matPBR = TestHelpers.CreateEntityWithPBRMaterial(scene, new PBRMaterial.Model
        {
            albedoTexture    = texture.id,
            transparencyMode = 2,
            albedoColor      = Color.blue
        }, camTarget, out IDCLEntity entity);

        yield return(matPBR.routine);


        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #7
0
    public IEnumerator NFTShapeVisualTests4()
    {
        yield return(InitVisualTestsScene("NFTShapeVisualTest4"));

        yield return(SpawnNFTShapes(18, 5, 3));

        yield return(VisualTestHelpers.TakeSnapshot(new Vector3(2f, 1.5f, 6.25f)));
    }
    IEnumerator TakeSnapshots()
    {
        yield return(VisualTestHelpers.TakeSnapshotOrTest("snapshot_1.png", new Vector3(10f, 10f, 0f), Vector3.zero));

        yield return(VisualTestHelpers.TakeSnapshotOrTest("snapshot_2.png", new Vector3(0f, 10f, 0f), Vector3.zero));

        yield return(VisualTestHelpers.TakeSnapshotOrTest("snapshot_3.png", new Vector3(-10f, 10f, 0f), Vector3.zero));

        yield return(VisualTestHelpers.TakeSnapshotOrTest("snapshot_4.png", new Vector3(0f, 10f, -10f), Vector3.zero));
    }
    public IEnumerator AlphaTestWearable()
    {
        //Arrange
        yield return(InitVisualTestsScene("WearableVisualTests_AlphaTestWearable"));

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(8, 1.8f, 9), new Vector3(8, 1.75f, 8));
        const string ALPHA_TEST_WEARABLE_ID = "urn:decentraland:ethereum:collections-v1:tech_tribal_marc0matic:techtribal_beast_mask";

        //Act
        yield return(LoadWearable(ALPHA_TEST_WEARABLE_ID, WearableLiterals.BodyShapes.MALE, new Vector3(8, -0.75f, 8)));

        //Assert
        yield return(VisualTestHelpers.TakeSnapshot());
    }
    public IEnumerator EmissiveWearable()
    {
        //Arrange
        yield return(InitVisualTestsScene("WearableVisualTests_EmissiveWearable"));

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(8, 1.8f, 9), new Vector3(8, 1.75f, 8));
        const string EMISSIVE_WEARABLE_ID = "urn:decentraland:ethereum:collections-v1:dc_niftyblocksmith:blocksmith_feet";

        //Act
        yield return(LoadWearable(EMISSIVE_WEARABLE_ID, WearableLiterals.BodyShapes.MALE, new Vector3(8, 1, 8)));

        //Assert
        yield return(VisualTestHelpers.TakeSnapshot());
    }
    public IEnumerator AlphaBlendWearable()
    {
        //Arrange
        yield return(InitVisualTestsScene("WearableVisualTests_AlphaBlendWearable"));

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(8, 1.8f, 9), new Vector3(8, 1.75f, 8));
        const string ALPHA_BLEND_WEARABLE_ID = "urn:decentraland:ethereum:collections-v1:community_contest:cw_raver_eyewear";

        //Act
        yield return(LoadWearable(ALPHA_BLEND_WEARABLE_ID, WearableLiterals.BodyShapes.MALE, new Vector3(8, -0.65f, 8.5f)));

        //Assert
        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #12
0
    public IEnumerator UITextTest1()
    {
        yield return(InitUIVisualTestScene("UITextTest"));

        var uiInputText = TestHelpers.SharedComponentCreate <UIText, UIText.Model>(scene, CLASS_ID.UI_TEXT_SHAPE);

        yield return(uiInputText.routine);

        yield return(TestHelpers.SharedComponentUpdate(uiInputText, new UIText.Model
        {
            parentComponent = screenSpaceId,
            name = "testUIText",
            isPointerBlocker = true,
            hAlign = "center",
            vAlign = "center",
            positionX = new UIValue(0f),
            positionY = new UIValue(0f),
            visible = true,
            textModel = new TextShape.Model
            {
                paddingLeft = 10,
                paddingRight = 10,
                paddingTop = 10,
                paddingBottom = 10,
                outlineWidth = 0.1f,
                outlineColor = Color.green,
                color = Color.red,
                fontSize = 100,
                fontWeight = "normal",
                opacity = 1,
                value = "Hello World!",
                lineSpacing = 0,
                lineCount = 0,
                adaptWidth = true,
                adaptHeight = true,
                textWrapping = false,
                shadowBlur = 0,
                shadowOffsetX = 0,
                shadowOffsetY = 0,
                shadowColor = Color.black,
                hTextAlign = "center",
                vTextAlign = "center",
                width = 300,
                height = 200,
            }
        }));

        yield return(VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)));
    }
예제 #13
0
        public IEnumerator AvatarShapeVisualTest2()
        {
            yield return(InitVisualTestsScene("AvatarShape_B"));

            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            AvatarShape avatar = AvatarShapeTestHelpers.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());
        }
        public IEnumerator MouthWithMask()
        {
            yield return(InitVisualTestsScene("AvatarShapeVisualTests_MouthWithMask"));

            AvatarAssetsTestHelpers.CreateTestCatalogLocal();
            var         model  = AvatarShapeTestHelpers.GetTestAvatarModel("Avatar #1", "TestAvatar_MaskMouth.json");
            AvatarShape avatar = AvatarShapeTestHelpers.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());
        }
    public IEnumerator UIImageTest1()
    {
        yield return(InitUIVisualTestScene("UIImageTest"));

        string mainContainerId = "herodes";

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = screenSpaceId,
            color = Color.green,
            width = new UIValue(50f, UIValue.Unit.PERCENT),
            height = new UIValue(50f, UIValue.Unit.PERCENT)
        }, mainContainerId));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(128f),
            height = new UIValue(128f)
        }, "imageBack"));

        DCLTexture texture = TestHelpers.CreateDCLTexture(scene, DCL.Helpers.Utils.GetTestsAssetsPath() + "/Images/atlas.png");

        yield return(texture.routine);

        yield return(CreateUIComponent <UIImage, UIImage.Model>(CLASS_ID.UI_IMAGE_SHAPE, new UIImage.Model
        {
            parentComponent = mainContainerId,
            source = texture.id,
            width = new UIValue(128f),
            height = new UIValue(128f),
            sourceWidth = 128f,
            sourceHeight = 128f,
            sourceTop = 0f,
            sourceLeft = 0f,
            paddingLeft = 10f,
            paddingRight = 10f,
            paddingTop = 10f,
            paddingBottom = 10f,
            isPointerBlocker = true,
        }, "testUIImage"));

        yield return(VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)));
    }
    [Explicit, Category("Explicit")] //Enable the test once we properly render opaque objects with SSAO behind transparents
    public IEnumerator TransparentObjectsAndSSAO()
    {
        yield return(InitVisualTestsScene("PBRMaterialVisualTests_TransparentObjectsAndSSAO"));

        VisualTestHelpers.SetSSAOActive(true);

        Vector3 camTarget = new Vector3(5, 1, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(4.6f, 1.8f, 0.6f), camTarget);

        PlaneShape plane       = TestHelpers.CreateEntityWithPlaneShape(scene, new Vector3(5, 1, 5), true);
        IDCLEntity planeEntity = plane.attachedEntities.FirstOrDefault();

        TestHelpers.SetEntityTransform(scene, planeEntity, new Vector3(5, 1, 5), Quaternion.identity, Vector3.one * 3);
        PBRMaterial planeMaterial = TestHelpers.AttachPBRMaterialToEntity(scene, planeEntity, new PBRMaterial.Model {
            alphaTest = 1, transparencyMode = 1, albedoColor = Vector4.one
        });

        yield return(plane.routine);

        yield return(planeMaterial.routine);

        BoxShape    box1         = TestHelpers.CreateEntityWithBoxShape(scene, new Vector3(4, 1, 6), true);
        PBRMaterial box1Material = TestHelpers.AttachPBRMaterialToEntity(scene, box1.attachedEntities.FirstOrDefault(), new PBRMaterial.Model {
            transparencyMode = 0, albedoColor = Color.blue
        });

        yield return(box1.routine);

        yield return(box1Material.routine);

        BoxShape    box2         = TestHelpers.CreateEntityWithBoxShape(scene, new Vector3(5, 1, 6.5f), true);
        PBRMaterial box2Material = TestHelpers.AttachPBRMaterialToEntity(scene, box2.attachedEntities.FirstOrDefault(), new PBRMaterial.Model {
            transparencyMode = 0, albedoColor = Color.red
        });

        yield return(box2.routine);

        yield return(box2Material.routine);

        yield return(null);

        yield return(VisualTestHelpers.TakeSnapshot());
    }
    IEnumerator Start()
    {
        if (instantiateSceneObjects)
        {
            yield return(InstantiateTestedObjects());
        }

        if (takeSnapshots)
        {
            if (snapshotsAreBaseline)
            {
                yield return(VisualTestHelpers.GenerateBaselineForTest(TakeSnapshots()));
            }
            else
            {
                yield return(TakeSnapshots());
            }
        }
    }
    public IEnumerator ProcessTextureOffsetAndScale()
    {
        yield return(InitVisualTestsScene("GLTFImporterVisualTests_ProcessTextureOffsetAndScale"));

        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero, TestAssetsUtils.GetPath() + "/GLB/PlaneUVsOffset/planeUVsOffset.glb", out IDCLEntity entity);

        yield return(gltfShape.routine);

        yield return(new WaitForAllMessagesProcessed());

        yield return(new WaitUntil(() => GLTFComponent.downloadingCount == 0));

        Vector3 camPos    = new Vector3(0f, 2f, 5f);
        Vector3 camTarget = new Vector3(7.5f, 0f, 10f);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, camPos, camTarget);
        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #19
0
    public IEnumerator CastShadowTrueShouldWork()
    {
        yield return(InitVisualTestsScene("BasicMaterialVisualTests_CastShadowTrueShouldWork"));

        Vector3 camTarget = new Vector3(5, 1, 5);

        VisualTestHelpers.RepositionVisualTestsCamera(camTarget + new Vector3(5, 1, 5), camTarget);

        BasicMaterial basicMaterialComponent = TestHelpers.CreateEntityWithBasicMaterial(scene, new BasicMaterial.Model
        {
            alphaTest   = 1f,
            castShadows = true
        }, camTarget, out DecentralandEntity entity);

        yield return(basicMaterialComponent.routine);

        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #20
0
    public IEnumerator ReceiveShadowsCorrectly()
    {
        yield return(InitVisualTestsScene("PlaneShape_ReceiveShadowsCorrectly"));

        TestHelpers.CreateEntityWithBoxShape(scene, Vector3.up);

        var planeShape = TestHelpers.CreateEntityWithPlaneShape(scene, Vector3.zero);
        var entity     = planeShape.attachedEntities.First();

        TestHelpers.SetEntityTransform(scene, entity, Vector3.zero, Quaternion.Euler(90, 0, 0), Vector3.one);

        Vector3 camPos    = new Vector3(-0.75f, 2.0f, 2.25f);
        Vector3 camTarget = Vector3.zero;

        VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);

        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #21
0
    public IEnumerator ProcessTexturesUVs()
    {
        yield return(InitVisualTestsScene("GLTFImporterVisualTests_ProcessTexturesUVs"));

        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero, Utils.GetTestsAssetsPath() + "/GLB/PlaneUVsMultichannel/PlaneUVsMultichannel.glb", out DecentralandEntity entity);

        yield return(gltfShape.routine);

        yield return(new WaitForAllMessagesProcessed());

        yield return(new WaitUntil(() => GLTFComponent.downloadingCount == 0));

        Vector3 camPos    = new Vector3(0f, 2f, 5f);
        Vector3 camTarget = new Vector3(7.5f, 0f, 10f);

        VisualTestHelpers.RepositionVisualTestsCamera(camPos, camTarget);
        yield return(new WaitForAllMessagesProcessed());

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #22
0
    public IEnumerator UIScrollRectTest1()
    {
        yield return(InitUIVisualTestScene("UIScrollRectTest"));

        yield return(CreateUIComponent <UIScrollRect, UIScrollRect.Model>(CLASS_ID.UI_SLIDER_SHAPE, new UIScrollRect.Model
        {
            parentComponent = screenSpaceId,
            backgroundColor = Color.gray,
            width = new UIValue(50f, UIValue.Unit.PERCENT),
            height = new UIValue(50f, UIValue.Unit.PERCENT),
            isVertical = true
        }, "herodes"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = screenSpaceId,
            color = Color.clear,
            width = new UIValue(50f, UIValue.Unit.PERCENT),
            height = new UIValue(50f, UIValue.Unit.PERCENT),
            isPointerBlocker = false
        }, "testContainer"));

        yield return(CreateUIComponent <UIInputText, UIInputText.Model>(CLASS_ID.UI_INPUT_TEXT_SHAPE, new UIInputText.Model
        {
            parentComponent = screenSpaceId,
            width = new UIValue(80f, UIValue.Unit.PERCENT),
            height = new UIValue(25f),
            vAlign = "bottom",
            hAlign = "left",
            placeholder = "Write message here",
            placeholderColor = Color.gray,
            positionX = new UIValue(10f, UIValue.Unit.PERCENT),
            positionY = new UIValue(10f),
            textModel = new TextShape.Model
            {
                fontSize = 10f
            }
        }, "textInput"));

        yield return(VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)));
    }
    public IEnumerator StandardConfigurations()
    {
        yield return(InitVisualTestsScene("PBRMaterialVisualTests_StandardConfigurations"));

        Vector3 camTarget = new Vector3(8, 3, 8);

        VisualTestHelpers.RepositionVisualTestsCamera(VisualTestController.i.camera, new Vector3(9, 4, 17), camTarget);

        GLTFShape gltfShape = TestHelpers.CreateEntityWithGLTFShape(scene, Vector3.zero,
                                                                    new LoadableShape.Model
        {
            src = TestAssetsUtils.GetPath() + "/GLB/MaterialsScene.glb"
        }, out IDCLEntity entity);

        TestHelpers.SetEntityTransform(scene, entity, new DCLTransform.Model {
            position = new Vector3(0, 0, 8), rotation = Quaternion.Euler(90, 180, 0)
        });

        LoadWrapper loader = GLTFShape.GetLoaderForEntity(entity);

        yield return(new WaitUntil(() => loader.alreadyLoaded));

        yield return(VisualTestHelpers.TakeSnapshot());
    }
예제 #24
0
 public IEnumerator UIScrollRectVisualTests_Generate()
 {
     yield return(VisualTestHelpers.GenerateBaselineForTest(UIScrollRectTest1()));
 }
예제 #25
0
    public IEnumerator UIContainerStackTest1()
    {
        yield return(InitUIVisualTestScene("UIContainerStackTest"));

        string mainContainerId = "herodes";

        yield return(CreateUIComponent <UIContainerStack, UIContainerStack.Model>(CLASS_ID.UI_CONTAINER_STACK, new UIContainerStack.Model
        {
            parentComponent = screenSpaceId,
            color = Color.green,
            width = new UIValue(50f, UIValue.Unit.PERCENT),
            height = new UIValue(50f, UIValue.Unit.PERCENT)
        }, mainContainerId));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.blue,
            width = new UIValue(200f),
            height = new UIValue(200f)
        }, "testContainerRect1"));

        DCLTexture texture = TestHelpers.CreateDCLTexture(scene, TestAssetsUtils.GetPath() + "/Images/atlas.png");

        yield return(texture.routine);

        yield return(CreateUIComponent <UIImage, UIImage.Model>(CLASS_ID.UI_IMAGE_SHAPE, new UIImage.Model
        {
            parentComponent = mainContainerId,
            source = texture.id,
            width = new UIValue(100f),
            height = new UIValue(100f),
            positionX = new UIValue(20f),
            sourceWidth = 100f,
            sourceHeight = 100f
        }, "testUIImage"));

        string mainContainer2Id = "herodes2";

        yield return(CreateUIComponent <UIContainerStack, UIContainerStack.Model>(CLASS_ID.UI_CONTAINER_STACK, new UIContainerStack.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            stackOrientation = UIContainerStack.StackOrientation.HORIZONTAL,
            positionX = new UIValue(20f),
            positionY = new UIValue(20f),
            width = new UIValue(200f),
            height = new UIValue(200f)
        }, mainContainer2Id));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainer2Id,
            color = Color.blue,
            width = new UIValue(200f),
            height = new UIValue(200f),
            positionY = new UIValue(0f)
        }, "testContainerRect2"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainer2Id,
            color = Color.magenta,
            width = new UIValue(200f),
            height = new UIValue(200f),
            positionY = new UIValue(10f)
        }, "testContainerRect3"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainer2Id,
            color = Color.yellow,
            width = new UIValue(200f),
            height = new UIValue(200f),
            positionY = new UIValue(20f)
        }, "testContainerRect4"));

        yield return(VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)));
    }
예제 #26
0
 public IEnumerator UIContainerStackVisualTests_Generate()
 {
     yield return(VisualTestHelpers.GenerateBaselineForTest(UIContainerStackTest1()));
 }
예제 #27
0
 public IEnumerator AvatarShapeVisualTest2_Generate()
 {
     yield return(VisualTestHelpers.GenerateBaselineForTest(AvatarShapeVisualTest2()));
 }
예제 #28
0
 public IEnumerator ProcessTexturesUVs_Generate()
 {
     yield return(VisualTestHelpers.GenerateBaselineForTest(ProcessTexturesUVs()));
 }
예제 #29
0
 public IEnumerator ProcessTextureOffsetAndScale_Generate()
 {
     yield return(VisualTestHelpers.GenerateBaselineForTest(ProcessTextureOffsetAndScale()));
 }
예제 #30
0
    public IEnumerator UIContainerRectTest1()
    {
        yield return(InitUIVisualTestScene("UIContainerRectTest"));

        string mainContainerId = "herodes";

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = screenSpaceId,
            color = Color.green,
            width = new UIValue(50f, UIValue.Unit.PERCENT),
            height = new UIValue(50f, UIValue.Unit.PERCENT)
        }, mainContainerId));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(100f),
            hAlign = "left",
            vAlign = "top"
        }, "innerPanelTopLeft"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(100f),
            hAlign = "left"
        }, "innerPanelCenterLeft"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(25f, UIValue.Unit.PERCENT),
            hAlign = "left",
            vAlign = "bottom"
        }, "innerPanelBottomLeft"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(25f, UIValue.Unit.PERCENT),
            vAlign = "top"
        }, "innerPanelTopCenter"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(25f, UIValue.Unit.PERCENT),
            vAlign = "top"
        }, "innerPanelTopCenter"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f),
            height = new UIValue(25f)
        }, "innerPanelCenterCenter"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(25f, UIValue.Unit.PERCENT),
            vAlign = "bottom"
        }, "innerPanelBottomCenter"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(100f),
            height = new UIValue(25f, UIValue.Unit.PERCENT),
            hAlign = "right",
            vAlign = "top"
        }, "innerPanelTopRight"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(25f, UIValue.Unit.PERCENT),
            hAlign = "right"
        }, "innerPanelCenterRight"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.red,
            width = new UIValue(25f, UIValue.Unit.PERCENT),
            height = new UIValue(25f, UIValue.Unit.PERCENT),
            hAlign = "right",
            vAlign = "bottom"
        }, "innerPanelBottomRight"));

        yield return(CreateUIComponent <UIContainerRect, UIContainerRect.Model>(CLASS_ID.UI_CONTAINER_RECT, new UIContainerRect.Model
        {
            parentComponent = mainContainerId,
            color = Color.blue,
            width = new UIValue(50f, UIValue.Unit.PERCENT),
            height = new UIValue(50f, UIValue.Unit.PERCENT),
            hAlign = "right",
            vAlign = "bottom",
            positionX = new UIValue(-20f, UIValue.Unit.PERCENT),
            positionY = new UIValue(20f, UIValue.Unit.PERCENT)
        }, "innerPanel1"));

        yield return(VisualTestHelpers.TakeSnapshot(new Vector3(0f, 2f, 0f)));
    }