private void OnGUI() { Init(); DrawHeader((int)position.width); if (rootNode == null) { GUILayout.Label("No serialized tests found after compilation"); GUILayout.Label("You can adjust tests updating in Advanced Options"); return; } if (GUI.GetNameOfFocusedControl() != string.Empty) { selectedNode.UpdateSelectedNode(null); } DrawStatistics(); DrawFilter(); DrawClasses(); DrawFooter(); }
protected void HandleKeyboardEvent(Action OnReturnKeyPress) { if (selectedNode.IsGivenNodeSelected(node) && Event.current.type == EventType.KeyDown) { if (GUI.GetNameOfFocusedControl() != "") { return; } if ((Event.current.control || Event.current.command) && Event.current.keyCode == KeyCode.C) { CopyName(); return; } switch (Event.current.keyCode) { case KeyCode.Return: if (Application.isPlaying) { return; } if (OnReturnKeyPress != null) { OnReturnKeyPress(); } return; case KeyCode.UpArrow: if (selectedNode.Node != null && selectedNode.Node.Parent != null && !selectedNode.Node.Parent.IsRoot) { Node upperChild = null; foreach (var child in selectedNode.Node.Parent.Children) { if (!child.IsHided) { if (child != selectedNode.Node) { upperChild = child; } else { break; } } } if (upperChild != null) { upperChild = GetLastOpenChild(upperChild); selectedNode.UpdateSelectedNode(upperChild); } else { selectedNode.UpdateSelectedNode(selectedNode.Node.Parent); } } Event.current.Use(); return; case KeyCode.DownArrow: if (selectedNode.Node != null && selectedNode.Node.ChildrenCount > 0 && IsNodeOpened) { Node upperChild = null; foreach (var child in selectedNode.Node.Children) { if (!child.IsHided) { selectedNode.UpdateSelectedNode(child); Event.current.Use(); return; } } } TrySelectElementBelow(node); Event.current.Use(); return; case KeyCode.RightArrow: if (selectedNode.Node != null && selectedNode.Node.ChildrenCount > 0) { if (!IsNodeOpened) { if (IsOpenFiltered.HasValue) { IsOpenFiltered = true; } node.SetOpened(true); Event.current.Use(); return; } selectedNode.UpdateSelectedNode(selectedNode.Node.ChildAt(0)); } Event.current.Use(); return; case KeyCode.LeftArrow: if (IsNodeOpened) { //IsOpenFiltered = false; if (IsOpenFiltered.HasValue) { IsOpenFiltered = false; } node.SetOpened(false); Event.current.Use(); return; } if (selectedNode.Node != null && selectedNode.Node.Parent != null && !selectedNode.Node.Parent.IsRoot) { selectedNode.UpdateSelectedNode(selectedNode.Node.Parent); } Event.current.Use(); return; } } }