예제 #1
0
        /// <summary> Forces a visual regression error to be thrown </summary>
        private async Task RunVisualRegressionErrorExample()
        {
            // Create an AssertVisually instance for testing:
            AssertVisually assertVisually = NewAssertVisuallyInstance("Ui19_RunVisualRegression_ErrorExample");

            // Create and show a UI based on the fields in MyUserModelv1:
            gameObject.AddChild(await NewUiFor <MyUserModelv1>());
            await assertVisually.AssertNoVisualChange("UserUiScreen");

            Toast.Show("Will now load a slightly different UI to cause a visual regression error..");
            await TaskV2.Delay(4000);

            // Now load MyUserModelv2 which creates a slightly different UI compared to MyUserModelv1:
            gameObject.AddChild(await NewUiFor <MyUserModelv2>());
            await assertVisually.AssertNoVisualChange("UserUiScreen");

            Toast.Show("See visual assertion error in the console");
        }
예제 #2
0
        private async Task ExampleUsage1()
        {
            // First create a default instance and pass it as a singleton to the injection logic:
            AssertVisually.SetupDefaultSingletonInDebugMode();

            // Create and show a UI based on the fields in MyUserModelv1:
            gameObject.AddChild(await NewUiFor <MyUserModelv1>());
            await AssertVisually.AssertNoVisualChange("Ui for MyUserModelv1");
        }