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(); }
public void PrintHeadPanel( ) { GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); var layoutOptions = new[] { GUILayout.Height(24), GUILayout.Width(32) }; if (GUILayout.Button(guiRunAllTests, Styles.buttonLeft, layoutOptions) && !EditorApplication.isPlayingOrWillChangePlaymode) { RunTests(TestComponent.FindAllTestsOnScene().Cast <ITestComponent> ().ToList()); } if (GUILayout.Button(guiRunSelectedTests, Styles.buttonMid, layoutOptions) && !EditorApplication.isPlayingOrWillChangePlaymode) { RunTests(Selection.gameObjects.Select(t => t.GetComponent(typeof(TestComponent))).Cast <ITestComponent> ().ToList()); } if (GUILayout.Button(guiCreateNewTest, Styles.buttonRight, layoutOptions) && !EditorApplication.isPlayingOrWillChangePlaymode) { 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(); } GUILayout.FlexibleSpace(); if (GUILayout.Button(showOptions ? guiOptionsHideLabel : guiOptionsShowLabel, GUILayout.Height(24), GUILayout.Width(80))) { showOptions = !showOptions; } EditorGUILayout.EndHorizontal(); if (showOptions) { PrintOptions(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Filter:", GUILayout.Width(35)); filterString = EditorGUILayout.TextField(filterString); if (GUILayout.Button(showAdvancedFilter ? guiAdvancedFilterHide : guiAdvancedFilterShow, GUILayout.Width(80), GUILayout.Height(16))) { showAdvancedFilter = !showAdvancedFilter; } EditorGUILayout.EndHorizontal(); if (showAdvancedFilter) { PrintAdvancedFilter(); } }