public void PrintHeadPanel()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
            if (GUILayout.Button(m_GUIRunAllTests, EditorStyles.toolbarButton))
            {
                RunTests(TestComponent.FindAllTestsOnScene().Cast <ITestComponent>().ToList());
            }
            EditorGUI.BeginDisabledGroup(!Selection.gameObjects.Any(t => t.GetComponent(typeof(ITestComponent))));
            if (GUILayout.Button(m_GUIRunSelectedTests, EditorStyles.toolbarButton))
            {
                RunTests(Selection.gameObjects.Select(t => t.GetComponent(typeof(TestComponent))).Cast <ITestComponent>().ToList());
            }
            EditorGUI.EndDisabledGroup();
            if (GUILayout.Button(m_GUICreateNewTest, EditorStyles.toolbarButton))
            {
                var test = TestComponent.CreateTest();
                if (Selection.gameObjects.Length == 1 &&
                    Selection.activeGameObject != null &&
                    Selection.activeGameObject.GetComponent <TestComponent>())
                {
                    test.transform.parent = Selection.activeGameObject.transform.parent;
                }
                Selection.activeGameObject = test;
                RebuildTestList();
            }
            EditorGUI.EndDisabledGroup();

            GUILayout.FlexibleSpace();

            m_FilterSettings.OnGUI();

            EditorGUILayout.EndHorizontal();
        }
Пример #2
0
        public void OnGUI()
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            if (GUILayout.Button(m_GUIRunAllTestsIcon, EditorStyles.toolbarButton))
            {
                RunTests();
                GUIUtility.ExitGUI();
            }
            EditorGUI.BeginDisabledGroup(!m_TestLines.IsAnySelected);
            if (GUILayout.Button(m_GUIRunSelectedTestsIcon, EditorStyles.toolbarButton))
            {
                m_TestLines.RunSelectedTests();
            }
            EditorGUI.EndDisabledGroup();
            if (GUILayout.Button(m_GUIRerunFailedTestsIcon, EditorStyles.toolbarButton))
            {
                m_TestLines.RunTests(m_ResultList.Where(result => result.IsFailure || result.IsError).Select(l => l.FullName).ToArray());
            }

            GUILayout.FlexibleSpace();

            m_FilterSettings.OnGUI();

            EditorGUILayout.EndHorizontal();

            if (m_Settings.horizontalSplit)
            {
                EditorGUILayout.BeginVertical();
            }
            else
            {
                EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            }

            RenderTestList();
            RenderTestInfo();

            if (m_Settings.horizontalSplit)
            {
                EditorGUILayout.EndVertical();
            }
            else
            {
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();
        }