Beispiel #1
0
        public IEnumerator AccessSettings()
        {
            int frameCount = 0;

            string[] assets = new string[0] {
            };

            TestPackage.Editor.TestPackage pkg = new TestPackage.Editor.TestPackage();
            AdaptivePerformancePackageMetadataStore.AddPluginPackage(pkg);
            AdaptivePerformancePackageInitializationBootstrap.InitPackage(pkg);

            while (frameCount < 60)
            {
                yield return(null);

                frameCount++;
            }

            yield return(null);

            var metadata = AdaptivePerformancePackageMetadataStore.GetMetadataForPackage("com.unity.adaptiveperformance.testpackage");

            Assert.IsNotNull(metadata);

            assets = AssetDatabase.FindAssets($"t:{metadata.settingsType}");
            Assert.IsTrue(assets.Length == 1);
            var assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);

            var instance = AssetDatabase.LoadAssetAtPath(assetPath, typeof(TestSettings));

            Assert.IsNotNull(instance);
        }
Beispiel #2
0
        public void Setup()
        {
            AssetDatabase.DeleteAsset("Assets/Adaptive Performance");
            AdaptivePerformancePackageInitializationBootstrap.BeginPackageInitialization();

            TestPackage.Editor.TestPackage pkg = new TestPackage.Editor.TestPackage();
            AdaptivePerformancePackageMetadataStore.AddPluginPackage(pkg);
            AdaptivePerformancePackageInitializationBootstrap.InitPackage(pkg);
        }
Beispiel #3
0
        public void SetUp()
        {
            AssetDatabase.DeleteAsset("Assets/Adaptive Performance");

            AssetDatabase.CreateFolder("Assets", "Adaptive Performance");

            m_Settings      = ScriptableObject.CreateInstance <AdaptivePerformanceManagerSettings>() as AdaptivePerformanceManagerSettings;
            m_Settings.name = "Actual testable settings.";

            m_TestSettings         = ScriptableObject.CreateInstance <AdaptivePerformanceGeneralSettings>() as AdaptivePerformanceGeneralSettings;
            m_TestSettings.Manager = m_Settings;
            m_TestSettings.name    = "Standalone Settings Container.";

            m_TestSettingsPerBuildTarget = ScriptableObject.CreateInstance <AdaptivePerformanceGeneralSettingsPerBuildTarget>() as AdaptivePerformanceGeneralSettingsPerBuildTarget;
            m_TestSettingsPerBuildTarget.SetSettingsForBuildTarget(BuildTargetGroup.Standalone, m_TestSettings);

            var testPath = AdaptivePerformanceGeneralSettingsTests.GetAssetPathForComponents(s_TempSettingsPath);

            if (!string.IsNullOrEmpty(testPath))
            {
                AssetDatabase.CreateAsset(m_TestSettingsPerBuildTarget, Path.Combine(testPath, "Test_AdaptivePerformanceGeneralSettings.asset"));

                AssetDatabase.AddObjectToAsset(m_TestSettings, AssetDatabase.GetAssetOrScenePath(m_TestSettingsPerBuildTarget));

                AssetDatabase.CreateFolder(testPath, "Settings");
                testPath = Path.Combine(testPath, "Settings");
                AssetDatabase.CreateAsset(m_Settings, Path.Combine(testPath, "Test_AdaptivePerformanceSettingsManager.asset"));

                m_TestSettings.AssignedSettings = m_Settings;
                AssetDatabase.SaveAssets();
            }

            EditorBuildSettings.AddConfigObject(AdaptivePerformanceGeneralSettings.k_SettingsKey, m_TestSettingsPerBuildTarget, true);

            AdaptivePerformancePackageInitializationBootstrap.BeginPackageInitialization();

            TestPackage.Editor.TestPackage pkg = new TestPackage.Editor.TestPackage();
            AdaptivePerformancePackageMetadataStore.AddPluginPackage(pkg);
            AdaptivePerformancePackageInitializationBootstrap.InitPackage(pkg);

            TestLoaderBase.WasAssigned   = false;
            TestLoaderBase.WasUnassigned = false;
        }