public void TestOverridesChanges() { VolumeComponent component = null; VolumeComponentEditor editor = null; CreateEditorAndComponent(typeof(VolumeComponentMixedAdditionalAttributes), ref component, ref editor); component.SetAllOverridesTo(false); bool allOverridesState = (bool)editor.Invoke("AreAllOverridesTo", false); Assert.True(allOverridesState); component.SetAllOverridesTo(true); // Was the change correct? allOverridesState = (bool)editor.Invoke("AreAllOverridesTo", true); Assert.True(allOverridesState); // Enable the advance mode on the editor editor.showAdditionalProperties = true; // Everything is false component.SetAllOverridesTo(false); // Disable the advance mode on the editor editor.showAdditionalProperties = false; // Now just set to true the overrides of non additional properties editor.Invoke("SetOverridesTo", true); // Check that the non additional properties must be false allOverridesState = (bool)editor.Invoke("AreAllOverridesTo", true); Assert.False(allOverridesState); ScriptableObject.DestroyImmediate(component); }
private void CreateEditorAndComponent(Type volumeComponentType, ref VolumeComponent component, ref VolumeComponentEditor editor) { component = (VolumeComponent)ScriptableObject.CreateInstance(volumeComponentType); editor = (VolumeComponentEditor)Editor.CreateEditor(component); editor.Invoke("Init"); }