예제 #1
0
        private async Task RunWaitForNoVisualChangeInSceneTest()
        {
            AssertVisually assertVisually = NewAssertVisuallyInstance("Ui19_RunVisualRegression_ExampleUsage3");

            Task visualChangeMonitorTask = assertVisually.WaitForNoVisualChangeInScene();

            AssertV2.IsFalse(visualChangeMonitorTask.IsCompleted, "visualChangeMonitorTask.IsCompleted");

            gameObject.AddChild(await NewUiFor <MyUserModelv1>()); // Change the UI
            await TaskV2.Delay(200);                               // After 200 ms the monitorTask should still be checking:

            AssertV2.IsFalse(visualChangeMonitorTask.IsCompleted, "visualChangeMonitorTask.IsCompleted");

            gameObject.AddChild(await NewUiFor <MyUserModelv2>()); // Change the UI again
            await TaskV2.Delay(200);                               // After 200 ms the monitorTask should still be checking:

            AssertV2.IsFalse(visualChangeMonitorTask.IsCompleted, "visualChangeMonitorTask.IsCompleted");

            gameObject.AddChild(await NewUiFor <MyUserModelv1>()); // Change the UI again
            await TaskV2.Delay(200);                               // After 200 ms the monitorTask should still be checking:

            AssertV2.IsFalse(visualChangeMonitorTask.IsCompleted, "visualChangeMonitorTask.IsCompleted");

            await TaskV2.Delay(2000); // Dont change the UI for 2 sec

            // Now the change monitor task should have completed since the sceen did not change for 2 sec:
            AssertV2.IsTrue(visualChangeMonitorTask.IsCompleted, "visualChangeMonitorTask.IsCompleted");

            await visualChangeMonitorTask; // await the task in case there was an exception
        }
예제 #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");
        }
예제 #3
0
 private async Task ShowAllDialogs()
 {
     AssertVisually.SetupDefaultSingletonInDebugMode();
     ViewStackHelper.MainViewStack().ShowView("Canvas/DefaultViewStackView");
     await ShowCancelConfirmDialog();
     await ShowInfoDialog();
     await ShowWarningDialog();
     await ShowErrorDialog();
     await UseDialogLoaderManually();
 }
예제 #4
0
        public override IEnumerator RunTest()
        {
            AssertVisually.SetupDefaultSingletonInDebugMode();

            yield return(ShowCancelConfirmDialog().AsCoroutine());

            yield return(ShowInfoDialog().AsCoroutine());

            yield return(ShowWarningDialog().AsCoroutine());

            yield return(ShowErrorDialog().AsCoroutine());

            yield return(UseDialogLoaderManually().AsCoroutine());
        }
예제 #5
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");
        }