Exemplo n.º 1
0
 private void RunTest()
 {
     methodNode.ResetTestState();
     PlayModeTestRunner.RunTestByDoubleClick(
         PlayModeTestRunner.SpecificTestType.Method,
         methodNode);
 }
Exemplo n.º 2
0
        public override bool Draw()
        {
            PreDraw();

            if (methodNode.IsHided)
            {
                return(false);
            }

            GUILayout.Space(METHOD_MARGIN);

            Rect rect = EditorGUILayout.BeginHorizontal();


            if (currentPlayingTest.Node == methodNode)
            {
                DrawCurrentTestBackground(rect);
            }
            else
            {
                DrawBackgroundIfSelected(rect);
            }

            GUILayout.Space(20);


            HandleKeyboardEvent(RunTest);

            var prevSelection = methodNode.IsSelected;

            DrawTestLine(rect,
                         () =>
            {
                selectedNode.UpdateSelectedNode(methodNode);
            },
                         () =>
            {
                methodNode.ResetTestState();
                PlayModeTestRunner.RunTestByDoubleClick(
                    PlayModeTestRunner.SpecificTestType.Method,
                    methodNode);
            },
                         () =>
            {
                selectedNode.UpdateSelectedNode(methodNode);
                drawContextMenu = true;
            },
                         NamePostfix());

            bool isDirty = prevSelection != methodNode.IsSelected;

            EditorGUILayout.EndHorizontal();

            return(isDirty);
        }
        private void RunClass()
        {
            foreach (var method in classNode.GetChildrenOfType <MethodNode>())
            {
                method.ResetTestState();
            }

            PlayModeTestRunner.RunTestByDoubleClick(
                PlayModeTestRunner.SpecificTestType.Class,
                classNode);
        }
        public override bool Draw()
        {
            PreDraw();

            if (classNode.IsHided)
            {
                return(false);
            }

            GUILayout.Space(CLASS_MARGIN);

            Rect rect = EditorGUILayout.BeginHorizontal();

            if (!IsNodeOpened && currentPlayingTest.Node != null &&
                currentPlayingTest.Node.IsChildOf(classNode))
            {
                DrawCurrentTestBackground(rect);
            }
            else
            {
                DrawBackgroundIfSelected(rect);
            }


            var isOpenedOld = IsNodeOpened;
            var isOpenedNew = DrawFoldout();

            if (IsOpenFiltered.HasValue)
            {
                IsOpenFiltered = isOpenedNew;
            }
            else
            {
                classNode.SetOpened(isOpenedNew);
            }

            HandleKeyboardEvent(RunClass);

            var prevSelection = classNode.IsSelected;

            DrawTestLine(rect,
                         () => { selectedNode.UpdateSelectedNode(classNode); },
                         () =>
            {
                foreach (var method in classNode.GetChildrenOfType <MethodNode>())
                {
                    method.ResetTestState();
                }

                PlayModeTestRunner.RunTestByDoubleClick(
                    PlayModeTestRunner.SpecificTestType.Class,
                    classNode);
            },
                         () =>
            {
                selectedNode.UpdateSelectedNode(classNode);
                drawContextMenu = true;
            },
                         string.Empty);

            var isDirty = IsNodeOpened != isOpenedOld;

            isDirty |= prevSelection != classNode.IsSelected;


            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            if (IsNodeOpened)
            {
                GUILayout.Space(PARENT_MARGIN);
                EditorGUILayout.BeginVertical(offsetStyle);

                foreach (var childNode in classNode.Children)
                {
                    isDirty |= childNode.View.Draw();
                }


                EditorGUILayout.EndVertical();
            }
            return(isDirty);
        }