コード例 #1
0
        private void RemoveTest(TestResult test)
        {
            var testsToDelete = new List <TestResult> {
                test
            };

            if (selectedTests.Count > 1)
            {
                testsToDelete = selectedTests;
            }

            foreach (var t in testsToDelete)
            {
#if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
                Undo.RegisterSceneUndo("Destroy Tests");
                GameObject.DestroyImmediate(t.TestComponent.gameObject);
#else
                Undo.DestroyObjectImmediate(t.TestComponent.gameObject);
#endif
            }

            TestManager.InvalidateTestList();
            selectedTests.Clear();
            forceRepaint = true;
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            var component = (TestComponent)target;

            if (component.IsTestGroup())
            {
                component.name = EditorGUILayout.TextField(guiTestName, component.name);
                serializedObject.ApplyModifiedProperties();
                TestManager.InvalidateTestList();
                return;
            }

            serializedObject.Update();
            if (!serializedObject.isEditingMultipleObjects)
            {
                component.name = EditorGUILayout.TextField(guiTestName, component.name);
                component.includedPlatforms = (TestComponent.IncludedPlatforms)EditorGUILayout.EnumMaskField(guiIncludePlatforms, component.includedPlatforms, EditorStyles.popup);
            }
            EditorGUILayout.PropertyField(timeout, guiTimeout);
            EditorGUILayout.PropertyField(ignored, guiIgnore);
            EditorGUILayout.PropertyField(succeedAssertions, guiSuccedOnAssertions);
            EditorGUILayout.PropertyField(expectException, guiExpectException);

            EditorGUI.BeginDisabledGroup(!expectException.boolValue);
            EditorGUILayout.PropertyField(expectedExceptionList, guiExpectExceptionList);
            EditorGUILayout.PropertyField(succeedWhenExceptionIsThrown, guiSucceedWhenExceptionIsThrown);
            EditorGUI.EndDisabledGroup();

            if (serializedObject.ApplyModifiedProperties() || GUI.changed)
            {
                TestManager.InvalidateTestList();
            }
        }