public void OnHierarchyWindowItemOnGui(int id, Rect rect) { var o = EditorUtility.InstanceIDToObject(id); if (o is GameObject) { var go = o as GameObject; if (TestManager.AnyTestsOnScene() && go.GetComponent <TestComponent>() != null) { if (!EditorApplication.isPlayingOrWillChangePlaymode && rect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseDown && Event.current.button == 1) { DrawContextTestMenu(testManager.GetResultFor(go)); } EditorGUIUtility.SetIconSize(new Vector2(12, 12)); EditorGUI.LabelField(new Rect(rect.xMax - 14, rect.yMin + 1, rect.width, rect.height), GetIconBasedOnResultType(testManager.GetResultFor(go))); EditorGUIUtility.SetIconSize(Vector2.zero); } } }
public void PrintTestList() { if (!testManager.AnyTestsOnScene()) { GUILayout.Label("No tests found on the scene", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); return; } GUILayout.Box("", new[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); GUILayout.Space(5); testListScroll = EditorGUILayout.BeginScrollView(testListScroll, new[] { GUILayout.ExpandHeight(true) }); DrawGroup(null, 0); EditorGUILayout.EndScrollView(); }
public void OnGUI() { if (isRunning) { Repaint(); if (!EditorApplication.isPlaying) { isRunning = false; Debug.Log("Test run was interrupted. Reseting Test Runner."); } } #if !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2 if (BuildPipeline.isBuildingPlayer) { isBuilding = true; } else if (isBuilding) { isBuilding = false; renderer.InvalidateTestList(); Repaint(); } #endif if (!TestManager.AnyTestsOnScene()) { renderer.PrintHeadPanel(isRunning); GUILayout.Label("No tests found on the scene", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); } else { renderer.PrintHeadPanel(isRunning); renderer.PrintTestList(); renderer.PrintSelectedTestDetails(); } if (renderer.forceRepaint) { renderer.forceRepaint = false; Repaint(); } }