Exemple #1
0
        public void CleanupAfterAllTests()
        {
            EditingContextManager.SaveProjectSettings(projectSettingsBackup);
            EditingContextManager.SaveUserSettings(userSettingsBackup);

            EditorApplication.delayCall += () => { EditorWindow.GetWindow <VRView>("EditorVR", false).Close(); };
        }
        public void LoadProjectSettings_IfAssetFound()
        {
            EditingContextManager.SaveProjectSettings(settings);
            var loaded = EditingContextManager.LoadProjectSettings();

            Assert.AreEqual(settings.defaultContextName, loaded.defaultContextName);
        }
        public void Setup()
        {
            manager = EditingContextManager.instance;
            go      = new GameObject("context test object");
            var transformTool       = go.AddComponent <TransformTool>();
            var createPrimitiveTool = go.AddComponent <CreatePrimitiveTool>();

            context      = ScriptableObject.CreateInstance <EditorXRContext>();
            context.name = "Some Other Context";
            context.m_DefaultToolStack = new List <MonoScript>();
            context.m_DefaultToolStack.Add(MonoScript.FromMonoBehaviour(transformTool));
            context.m_DefaultToolStack.Add(MonoScript.FromMonoBehaviour(createPrimitiveTool));
            ObjectUtils.Destroy(go);

            context2      = ScriptableObject.CreateInstance <EditorXRContext>();
            context2.name = "Yet Another Context";
            context2.m_DefaultToolStack = context.m_DefaultToolStack;

            settings = ScriptableObject.CreateInstance <EditingContextManagerSettings>();
            settings.defaultContextName = "Custom Default Context";
            newSettings = ScriptableObject.CreateInstance <EditingContextManagerSettings>();
            newSettings.defaultContextName = "New Custom Default Context";

            // Save once so that we can detect a change--without this, SaveProjectSettings_UpdatesProjectSettingsFile will fail on CloudBuild
            EditingContextManager.SaveProjectSettings(settings);
        }
        public void LoadUserSettings_OlderThanProjectSettings()
        {
            EditingContextManager.SaveUserSettings(newSettings);
            EditingContextManager.SaveProjectSettings(settings);

            var loaded = EditingContextManager.LoadUserSettings();

            Assert.AreEqual(settings.defaultContextName, loaded.defaultContextName);
        }
Exemple #5
0
        public void SaveProjectSettings_UpdatesProjectSettingsFile()
        {
            var path        = EditingContextManager.k_SettingsPath;
            var lastModTime = File.GetLastWriteTime(path);

            EditingContextManager.SaveProjectSettings(settings);

            Assert.AreEqual(JsonUtility.ToJson(settings, true), File.ReadAllText(path));
            Assert.Greater(File.GetLastWriteTime(path), lastModTime);
        }
        public void SaveProjectSettings_UpdatesProjectSettingsFile()
        {
            var path        = EditingContextManager.settingsPath;
            var lastModTime = File.GetLastWriteTime(path);

            Thread.Sleep(1000); // Wait one second to make sure modified time is later
            EditingContextManager.SaveProjectSettings(settings);

            Assert.AreEqual(JsonUtility.ToJson(settings, true), File.ReadAllText(path));
            Assert.Greater(File.GetLastWriteTime(path), lastModTime);
        }