예제 #1
0
 /// <summary>
 /// Start sending <paramref name="recordedActions"/> to the <see cref="window"/> and invoke <paramref name="finishedCallback"/> when done.
 /// </summary>
 public static void StartPlayback(EditorWindow window, IList <UserAction> recordedActions)
 {
     foreach (UserAction action in recordedActions)
     {
         TestableEditorElements.StartPlayback(action.PrepickedSelections);
         window.RepaintImmediately();
         window.SendEvent(action.Event);
         TestableEditorElements.StopPlayback();
     }
 }
예제 #2
0
        /// <summary>
        /// Start sending <paramref name="recordedActions"/> to the <see cref="window"/> and invoke <paramref name="finishedCallback"/> when done.
        /// </summary>
        public static void StartPlayback(EditorWindow window, IList <UserAction> recordedActions, FinishedHandler finishedCallback)
        {
            foreach (EditorWindowTestPlayer testPlayer in Resources.FindObjectsOfTypeAll <EditorWindowTestPlayer>())
            {
                testPlayer.Close();
            }

            IsPlaying = true;

            EditorWindowTestPlayer player = CreateInstance <EditorWindowTestPlayer>();

            player.ShowUtility();
            player.Finished += finishedCallback;
            player.window    = window;

            foreach (UserAction action in recordedActions)
            {
                TestableEditorElements.StartPlayback(action.PrepickedSelections);
                player.window.SendEvent(action.Event);
                player.SendEvent(EditorGUIUtility.CommandEvent("Wait"));
            }

            player.SendEvent(EditorGUIUtility.CommandEvent("Finished"));
        }