ShowSuiteResults() public static method

public static ShowSuiteResults ( Vector2 scrollPosition, ArrayList results ) : Vector2
scrollPosition Vector2
results ArrayList
return Vector2
示例#1
0
 public void OnGUI()
 {
     if (TestRunner == null)
     {
         GUI.depth = -10;
         GUILayout.BeginArea(GUITools.FullScreen, GetType().Name, "window");
         scrollPosition = TestRunnerGUI.ShowSuiteResults(scrollPosition, results);
         GUILayout.EndArea();
     }
 }
示例#2
0
 public void OnGUI()
 {
     if (UnityTestController.Instance != null)
     {
         aggregateResults = UnityTestController.Instance.aggregateResults;
     }
     GUILayout.BeginVertical(GUITools.ConstrainedBox);
     if (UnityTestController.Instance != null)
     {
         viewState = TestRunnerGUI.ShowAggregateResults(viewState, aggregateResults);
     }
     else if (UnityTest.Instance != null)
     {
         viewState.innerScrollPosition = TestRunnerGUI.ShowSuiteResults(viewState.innerScrollPosition, UnityTest.Instance.results);
     }
     else
     {
         GUILayout.Label("No test data...");
         GUILayout.FlexibleSpace();
     }
     GUILayout.EndVertical();
 }
示例#3
0
    public static TestResultsViewState ShowAggregateResults(TestResultsViewState state, ArrayList aggregateResults)
    {
        if (state.labels.Length != aggregateResults.Count)
        {
            state.labels = new string[aggregateResults.Count];
            for (int i = 0; i < state.labels.Length; i++)
            {
                SuiteResults sr = ((SuiteResults)(aggregateResults[i]));
                state.labels[i] = sr.suite.Name + ((sr.variant != null) ? sr.variant : "");
            }
        }
        GUILayout.BeginHorizontal(GUITools.ConstrainedBox);
        GUILayout.BeginVertical();
        GUITools.TextColorState tcs;
        state.outerScrollPosition = GUILayout.BeginScrollView(state.outerScrollPosition, false, false, GUILayout.Width(180));
        if ((state.labels.Length > 0) && (state.selectedIndex >= 0))
        {
            for (int i = 0; i < state.labels.Length; i++)
            {
                SuiteResults    sr    = ((SuiteResults)(aggregateResults[i]));
                TestResultStyle style = TestResultStyle.Pass;
                // TODO: UGH!  This SUCKS!  We shouldn't have to iterate every
                // result multiple times every frame!!!!
                bool isFailed = false;
                foreach (TestResult r in sr.results)
                {
                    // If ANY result is ongoing, the result is Ongoing.
                    // If there's no ongoing test AND there is ANY failed test, the
                    // result is Failed.
                    // Otherwise, the result is Passed.
                    if (r.IsRunning)
                    {
                        style = TestResultStyle.Ongoing;
                        if (Application.isPlaying)
                        {
                            state.selectedIndex = i;
                        }
                        break;
                    }
                    else if (r.Passed)
                    {
                        if (!isFailed)
                        {
                            style = TestResultStyle.Pass;
                        }
                    }
                    else
                    {
                        style = TestResultStyle.Fail; isFailed = true; continue;
                    }
                }

                tcs = GUITools.SetTextColor(style.color, "button");
                if (GUILayout.Toggle((state.selectedIndex == i), state.labels[i], "button", GUILayout.Width(150)))
                {
                    state.selectedIndex = i;
                }
                GUITools.RestoreTextColor(tcs);
            }
        }
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        GUILayout.BeginVertical();
        if (state.labels.Length > 0)
        {
            if (state.selectedIndex >= state.labels.Length)
            {
                state.selectedIndex = state.labels.Length - 1;
            }
            GUILayout.Label(state.labels[state.selectedIndex]);
            if ((state.selectedIndex >= 0) && (aggregateResults.Count > 0))
            {
                state.innerScrollPosition = TestRunnerGUI.ShowSuiteResults(state.innerScrollPosition, ((SuiteResults)(aggregateResults[state.selectedIndex])).results);
            }
        }
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        return(state);
    }