Exemple #1
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();
        }
Exemple #2
0
        public void OnGUI()
        {
            GUILayout.Space(10);
            EditorGUILayout.BeginVertical();

            EditorGUILayout.BeginHorizontal();

            var layoutOptions = new[] { GUILayout.Width(32), GUILayout.Height(24) };

            if (GUILayout.Button(guiRunAllTestsIcon, Styles.buttonLeft, layoutOptions))
            {
                RunTests();
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button(guiRunSelectedTestsIcon, Styles.buttonMid, layoutOptions))
            {
                testLines.RunSelectedTests();
            }
            if (GUILayout.Button(guiRerunFailedTestsIcon, Styles.buttonRight, layoutOptions))
            {
                testLines.RunTests(resultList.Where(result => result.IsFailure || result.IsError).Select(l => l.FullName).ToArray());
            }

            GUILayout.FlexibleSpace();

            if (GUILayout.Button(settings.optionsFoldout ? guiHideButton : guiOptionButton, GUILayout.Height(24), GUILayout.Width(80)))
            {
                settings.optionsFoldout = !settings.optionsFoldout;
            }
            EditorGUILayout.EndHorizontal();

            if (settings.optionsFoldout)
            {
                DrawOptions();
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Filter:", GUILayout.Width(35));
            settings.testFilter = EditorGUILayout.TextField(settings.testFilter, EditorStyles.textField);

            if (availableCategories != null && availableCategories.Length > 1)
            {
                settings.categoriesMask = EditorGUILayout.MaskField(settings.categoriesMask, availableCategories, GUILayout.MaxWidth(90));
            }

            if (GUILayout.Button(settings.filtersFoldout ? "Hide" : "Advanced", GUILayout.Width(80), GUILayout.Height(15)))
            {
                settings.filtersFoldout = !settings.filtersFoldout;
            }
            EditorGUILayout.EndHorizontal();

            if (settings.filtersFoldout)
            {
                DrawFilters();
            }

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

            RenderTestList();
            RenderTestInfo();

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

            EditorGUILayout.EndVertical();
        }