public void TestExportOptionsReset() { var instance = ExportSettings.instance; var go = new GameObject("temp"); var exportWindow = ExportModelEditorWindow.Init(new Object[] { go }); var convertWindow = ConvertToPrefabEditorWindow.Init(new GameObject[] { go }); // test export window reset // change one setting from default instance.ExportModelSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary); Assert.That(instance.ExportModelSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary)); // reset export settings instance.Reset(); // check that setting was reverted to default Assert.That(instance.ExportModelSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.ASCII)); exportWindow.ResetSessionSettings(); exportWindow.Close(); // test convert prefab window reset // change one setting from default instance.ConvertToPrefabSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary); Assert.That(instance.ConvertToPrefabSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary)); // reset export settings instance.Reset(); // check that setting was reverted to default Assert.That(instance.ConvertToPrefabSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.ASCII)); convertWindow.ResetSessionSettings(); convertWindow.Close(); }
public void TestConvertOptionsWindow() { var instance = ExportSettings.instance; // check loading export settings from preset var convertSettingsPreset = ScriptableObject.CreateInstance(typeof(ConvertToPrefabSettings)) as ConvertToPrefabSettings; convertSettingsPreset.info.SetAnimatedSkinnedMesh(true); convertSettingsPreset.info.SetExportFormat(ExportSettings.ExportFormat.ASCII); var preset = new Preset(convertSettingsPreset); // set default preset var type = preset.GetPresetType(); Assert.That(type.IsValidDefault(), Is.True); var defaultPreset = new DefaultPreset(string.Empty, preset); Assert.That(Preset.SetDefaultPresetsForType(type, new DefaultPreset[] { defaultPreset }), Is.True); // make sure the instance settings do not match the preset instance.ConvertToPrefabSettings.info.SetAnimatedSkinnedMesh(false); instance.ConvertToPrefabSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary); Assert.That(convertSettingsPreset.info.AnimateSkinnedMesh, Is.Not.EqualTo(instance.ConvertToPrefabSettings.info.AnimateSkinnedMesh)); Assert.That(convertSettingsPreset.info.ExportFormat, Is.Not.EqualTo(instance.ConvertToPrefabSettings.info.ExportFormat)); // create an empty object to have something in the export set var go = new GameObject("temp"); var convertWindow = ConvertToPrefabEditorWindow.Init(new GameObject[] { go }); // clear any previous settings convertWindow.ResetSessionSettings(); Assert.That(convertWindow.ConvertToPrefabSettingsInstance.info.AnimateSkinnedMesh, Is.EqualTo(convertSettingsPreset.info.AnimateSkinnedMesh)); Assert.That(convertWindow.ConvertToPrefabSettingsInstance.info.ExportFormat, Is.EqualTo(convertSettingsPreset.info.ExportFormat)); convertWindow.Close(); // check loading export settings from project settings // remove preset Preset.RemoveFromDefault(preset); Assert.That(Preset.GetDefaultPresetsForType(type), Is.Empty); convertWindow = ConvertToPrefabEditorWindow.Init(new GameObject[] { go }); // clear any previous settings convertWindow.ResetSessionSettings(); Assert.That(convertWindow.ConvertToPrefabSettingsInstance.info.AnimateSkinnedMesh, Is.EqualTo(instance.ConvertToPrefabSettings.info.AnimateSkinnedMesh)); Assert.That(convertWindow.ConvertToPrefabSettingsInstance.info.ExportFormat, Is.EqualTo(instance.ConvertToPrefabSettings.info.ExportFormat)); // check modifying export settings persist and don't modify project settings convertWindow.ConvertToPrefabSettingsInstance.info.SetAnimatedSkinnedMesh(true); convertWindow.ConvertToPrefabSettingsInstance.info.SetExportFormat(ExportSettings.ExportFormat.ASCII); convertWindow.SaveExportSettings(); convertWindow.Close(); convertWindow = ConvertToPrefabEditorWindow.Init(new GameObject[] { go }); Assert.That(convertWindow.ConvertToPrefabSettingsInstance.info.AnimateSkinnedMesh, Is.Not.EqualTo(instance.ConvertToPrefabSettings.info.AnimateSkinnedMesh)); Assert.That(convertWindow.ConvertToPrefabSettingsInstance.info.ExportFormat, Is.Not.EqualTo(instance.ConvertToPrefabSettings.info.ExportFormat)); // make sure these settings don't persist and close window convertWindow.ResetSessionSettings(); convertWindow.Close(); }