Beispiel #1
0
        // Set scripting define symbols
        public static void SetScriptingDefines()
        {
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();  // Get settings
            string          output          = "";                                 // Create output string

            for (int i = 0; i < coreScriptingDefines.Length; i++)                 // Iterate core defines
            {
                output += coreScriptingDefines[i] + ";";                          // Add
            }
            if (projectSettings.scriptingDefines != null)                         // Check for null
            {
                for (int i = 0; i < projectSettings.scriptingDefines.Length; i++) // Iterate settings defines
                {
                    output += projectSettings.scriptingDefines[i] + ";";          // Add
                }
            }
            int platformCount = Enum.GetNames(typeof(BuildTargetGroup)).Length; // Get platform count

            for (int i = 0; i < platformCount; i++)                             // Iterate all platforms
            {
                if (!depreciatedBuiltTargets.Contains(i))
                {
                    PlayerSettings.SetScriptingDefineSymbolsForGroup((BuildTargetGroup)i, output); // Add custom to current
                }
            }
        }
Beispiel #2
0
        public static void GetUnityVersionInfo()
        {
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();                            // Get settings

            projectSettings.unityVersion = UnityEditorInternal.InternalEditorUtility.GetFullUnityVersion(); // Set unity version
            projectSettings.unityBranch  = UnityEditorInternal.InternalEditorUtility.GetUnityBuildBranch(); // Set unity branch
            SuiteManager.SetProjectSettings(projectSettings);
        }
Beispiel #3
0
        // ------------------------------------------------------------------------------------
        // Test Execution

        // Start an individual test (called by TestRunner)
        public void StartTest(TestEntry inputTest, RunnerType runnerType)
        {
            Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "Starting test " + inputTest.testName);                        // Write to console
            activeTest = SuiteManager.GetTest(inputTest);                                                                             // Get the active test
            TestLogicBase activeTestLogic = GetLogicInstance(SuiteManager.GetSuiteName(inputTest.suiteIndex), activeTest, inputTest); // Get active test logic instance

            StartCoroutine(activeTestLogic.SetupTest(inputTest, runnerType));                                                         // Setup test
        }
Beispiel #4
0
        void Start()
        {
            runTestButton.interactable = SuiteManager.HasSuites();

            runTestButton.onClick.AddListener(RunTestClick);
            analyticButton.onClick.AddListener(AnalyticClick);

            Menu.Instance.MakeCanvasScaleWithScreenSize(titleMenu);
        }
Beispiel #5
0
 // Setup for debug build
 public static void PrepareDebugBuild()
 {
     GetUnityVersionInfo();                                    // Get unity version info
     SuiteManager.GenerateSceneList(true);                     // Create suite structure
     SetApplicationSettings(null);                             // Set application settings
     SetScriptingDefines();                                    // Set defines
     SetPlayerSettings();                                      // Set player settings
     SetQualitySettings();                                     // Set quality settings
     PlayerSettings.bundleVersion = Common.applicationVersion; // Set application version
 }
Beispiel #6
0
        // Set various application specific settings
        public static void SetApplicationSettings(BuildTarget target)
        {
            PlayerSettings.companyName = "Unity Technologies";
            string          productName     = "";
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();

            if (projectSettings)
            {
                if (projectSettings.buildNameOverride != null && projectSettings.buildNameOverride.Length > 0)
                {
                    productName = projectSettings.buildNameOverride;
                }
                else
                {
                    if (projectSettings.suiteList.Count == 0)
                    {
                        Debug.LogError("No suites found on Settings object. Aborting.");
                        return;
                    }
                    else if (projectSettings.suiteList.Count > 1)
                    {
                        productName = "UTF_Various";
                    }
                    else
                    {
                        productName = "UTF_" + projectSettings.suiteList[0].suiteName;
                    }
                }
            }
            else
            {
                Debug.LogError("No Settings object found. Aborting.");
                return;
            }
            productName += BuildPipeline.AppendProductName(target);
            PlayerSettings.productName = productName;

            int platformCount = Enum.GetNames(typeof(BuildTargetGroup)).Length; // Get platform count

            for (int i = 0; i < platformCount; i++)                             // Iterate all platforms
            {
                if (!depreciatedBuiltTargets.Contains(i))
                {
                    if ((BuildTargetGroup)i == BuildTargetGroup.iOS)
                    {
                        PlayerSettings.SetApplicationIdentifier((BuildTargetGroup)i, "com.UnityTechnologies." + productName.Replace("_", "-")); // Set bundle identifier for iOS
                    }
                    else
                    {
                        PlayerSettings.SetApplicationIdentifier((BuildTargetGroup)i, "com.UnityTechnologies." + productName); // Set bundle identifiers for other
                    }
                }
            }
        }
Beispiel #7
0
        public void RunBuildPipeline()
        {
            GetUnityVersionInfo(); // Get unity version info
            //SetApplicationSettings(null); // Set application settings
            SetScriptingDefines(); // Set defines
            SetPlayerSettings();   // Set player settings
            SetQualitySettings();  // Set quality settings
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();

            this.StartCoroutine(BuildPipeline.ProcessBuildPipeline(buildConfiguration, projectSettings));
        }
Beispiel #8
0
        // ------------------------------------------------------------------------------------
        // Filters

        // Get suite names and generate dropdown content
        void GenerateSuitesDropdown()
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Generating suites dropdown"); // Write to console
            List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();                   // Create new options list

            options.Add(Common.ConvertStringToDropdownOptionData("All Suites"));
            string[] suites = SuiteManager.GetSuiteNames();                       // Get suite names
            for (int i = 0; i < suites.Length; i++)                               // Iterate suites
            {
                options.Add(Common.ConvertStringToDropdownOptionData(suites[i])); // Convert string to option data and add
            }
            suitesDropdown.options = options;                                     // Add options
        }
Beispiel #9
0
        // Set various application specific settings
        public static void SetApplicationSettings(BuildTarget target, string append)
        {
            PlayerSettings.companyName = "Unity Technologies";
            string          productName     = "";
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();

            if (projectSettings)
            {
                if (projectSettings.buildNameOverride != null && projectSettings.buildNameOverride.Length > 0)
                {
                    productName = projectSettings.buildNameOverride;
                }
                else
                {
                    if (projectSettings.suiteList.Count == 0)
                    {
                        Debug.LogError("No suites found on Settings object. Aborting.");
                        return;
                    }
                    else if (projectSettings.suiteList.Count > 1)
                    {
                        productName = "UTF_Various";
                    }
                    else
                    {
                        productName = "UTF_" + projectSettings.suiteList[0].suiteName;
                    }
                }
            }
            else
            {
                Debug.LogError("No Settings object found. Aborting.");
                return;
            }
            productName += append;
            PlayerSettings.productName = productName;
            if (target != null)
            {
                if (target.platform == UnityEditor.BuildTarget.iOS)
                {
                    productName = productName.Replace("_", "-");
                }
            }
            int platformCount = Enum.GetNames(typeof(BuildTargetGroup)).Length;                                       // Get platform count

            for (int i = 0; i < platformCount; i++)                                                                   // Iterate all platforms
            {
                PlayerSettings.SetApplicationIdentifier((BuildTargetGroup)i, "com.UnityTechnologies." + productName); // Set bundle identifiers
            }
        }
Beispiel #10
0
        public RenderPipelineAsset GetRenderPipeline()
        {
            RenderPipelineAsset renderPipeline = null;
            Suite suite = SuiteManager.GetSuiteByName(suiteName);                                 // Get current suite

            if (suite != null)                                                                    // If suite was returned
            {
                renderPipeline = suite.groups[activeTestEntry.groupIndex].renderPipelineOverride; // Get the groups override render pipeline
                if (renderPipeline == null)                                                       // if still null fallback to suite default
                {
                    renderPipeline = suite.defaultRenderPipeline;                                 // Apply suite default
                }
            }
            return(renderPipeline);
        }
Beispiel #11
0
        public RenderPipelineAsset GetTestRenderPipeline(int suite, int group, int test)
        {
            RenderPipelineAsset pipeline = null;

            GraphicsTestFramework.Suite s = SuiteManager.GetSuiteByIndex(suite);
            if (s != null)
            {
                pipeline = s.defaultRenderPipeline;
                if (pipeline == null)
                {
                    pipeline = s.groups[group].renderPipelineOverride;
                }
            }
            return(pipeline);
        }
Beispiel #12
0
        // ------------------------------------------------------------------------------------
        // Test Execution

        // Start an individual test (called by TestRunner)
        public void StartTest(TestEntry inputTest, RunnerType runnerType)
        {
            Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "Starting test " + inputTest.testName); // Write to console
            TestLogicBase activeTestLogic = null;

            if (!isAnalytic)                                                                                    // If not analytic mode
            {
                activeTest      = SuiteManager.GetTest(inputTest);                                              // Get the active test from suite manager
                activeTestLogic = GetLogicInstance(SuiteManager.GetSuiteName(inputTest.suiteIndex), inputTest); // Get active test logic instance
            }
            else
            {
                activeTest      = Common.GenerateTestFromTestEntry(inputTest);                                                     // Get the active test from structure
                activeTestLogic = GetLogicInstance(TestStructure.Instance.GetSuiteNameFromIndex(inputTest.suiteIndex), inputTest); // Get active test logic instance
            }
            StartCoroutine(activeTestLogic.SetupTest(inputTest, runnerType));                                                      // Setup test
        }
Beispiel #13
0
        void CompareBaselineTimestamps(string suiteName, string dateTime)
        {
            System.DateTime cloudTimestamp = System.DateTime.Parse(dateTime);

            if (_suiteBaselineData.Count == 0)                                                                           // TODO - shouldnt add this to pull baselines as has issue with iOS trying to pull baselines for OSX
            {
                Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Putting " + suiteName + " in the pull list"); // Write to console
                suiteBaselinesPullList.Add(SuiteManager.GetSuiteByName(suiteName));
            }
            else
            {
                int matches = 0;
                foreach (SuiteBaselineData SBD in _suiteBaselineData)
                {
                    if (SBD.suiteName == suiteName && SBD.platform == sysData.Platform && SBD.api == sysData.API)
                    {
                        matches++;
                        System.DateTime localTimestamp = System.DateTime.ParseExact(SBD.suiteTimestamp, Common.dateTimeFormat, null);
                        Console.Instance.Write(DebugLevel.File, MessageLevel.Log, string.Format("Comparing cloud time {0} vs local time {1}", cloudTimestamp, localTimestamp));

                        int timeDiff = cloudTimestamp.CompareTo(localTimestamp);
                        if (timeDiff < 0f)
                        {
                            Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Cloud Timestamp is old");                              // Write to console
                        }
                        else if (timeDiff > 0f)
                        {
                            Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Cloud Timestamp is newer, adding " + suiteName + " to pull list");                              // Write to console
                            suiteBaselinesPullList.Add(SuiteManager.GetSuiteByName(suiteName));
                        }
                        else if (timeDiff == 0f)
                        {
                            Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Cloud Timestamp is the same");                              // Write to console
                        }
                    }
                }

                if (matches == 0)
                {
                    suiteBaselinesPullList.Add(SuiteManager.GetSuiteByName(suiteName));
                }
            }
        }
Beispiel #14
0
        // Check if Render Pipeline needs to be changed and change if necessary
        public void SetRenderPipeline()
        {
            RenderPipelineAsset renderPipeline = model.settings.renderPipeline; // Get the models render pipeline

            if (renderPipeline == null)                                         // If none found
            {
                Suite suite = SuiteManager.GetSuiteByName(suiteName);           // Get current suite
                if (suite != null)                                              // If suite was returned
                {
                    renderPipeline = suite.defaultRenderPipeline;               // Apply suite default
                }
            }
            RenderPipelineAsset currentRenderPipeline = Common.GetRenderPipeline();

            if (renderPipeline != currentRenderPipeline)
            {
                GraphicsSettings.renderPipelineAsset = renderPipeline;
            }
        }
Beispiel #15
0
        // ------------------------------------------------------------------------------------
        // Get System Data

        // Get SystemData to use for building ResultsCommon
        public SystemData GetSystemData()
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Getting system data");              // Write to console
            SystemData      output          = new SystemData();                                            // Create new class instance
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();                           // Get settings

            output.UnityVersion = projectSettings.unityVersion + "|" + projectSettings.unityBranch;        // Get Unity version
            output.AppVersion   = Common.applicationVersion.ToString();                                    // Get application version
            output.OS           = SystemInfo.operatingSystem;                                              // Get OS
            output.Device       = SystemInfo.deviceModel + "|" + SystemInfo.graphicsDeviceName + "|" + SystemInfo.processorType;
            output.Platform     = Application.platform.ToString();                                         // Get platform
#if UNITY_EDITOR
            if (!Common.IsStandaloneTarget(UnityEditor.EditorUserBuildSettings.activeBuildTarget))         // Check if target platform is emulated editor
            {
                output.Platform += "_" + UnityEditor.EditorUserBuildSettings.activeBuildTarget.ToString(); // Append build target
            }
#endif
            output.API = SystemInfo.graphicsDeviceType.ToString(); // Get graphics device type
            return(output);                                        // Return
        }
Beispiel #16
0
        // Find if Unity version is above specified index from unityVersionList
        public static bool IsUnityVersionAboveMinimum(int input)
        {
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings(); // Get settings
            int             versionIndex    = 0;                                 // Create version index

            for (int i = 0; i < unityVersionList.Length; i++)                    // Iterate version list
            {
                if (projectSettings.unityVersion.Contains(unityVersionList[i]))  // If unity version contains current index
                {
                    versionIndex = i;                                            // Set output index
                }
            }
            if (input > versionIndex) // If minimum is higher than current
            {
                return(false);        // Return false
            }
            else
            {
                return(true); // Return true
            }
        }
Beispiel #17
0
        public IEnumerator PullAlt(string platform, string api)
        {
            ProgressScreen.Instance.SetState(true, ProgressType.CloudLoad, "Pulling Alternate Baselines");
            ResultsIOData[] data = null;
            StartCoroutine(SQL.SQLIO.FetchBaselines(SuiteManager.GetSuites(), platform, api, (value => { data = value; }))); // SQLCHECK
            while (data == null)
            {
                yield return(null);
            }
            //ResultsIOData[] data = SQL.SQLIO.Instance.FetchBaselines (suiteBaselinesPullList.ToArray (), sysData.Platform, sysData.API);
            Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Cloud baselines pulled, writing local files");
            ProgressScreen.Instance.SetState(true, ProgressType.LocalSave, "Writing Baselines to Disk");
            foreach (ResultsIOData rd in data)
            {
                yield return(StartCoroutine(LocalIO.Instance.WriteDataFiles(rd, fileType.Baseline)));
            }
            ProgressScreen.Instance.SetState(true, ProgressType.LocalLoad, "Loading Baselines to Memory");
            BroadcastBaselineParsed();
            yield return(null);

            Menu.Instance.UpdateMenu();
        }
Beispiel #18
0
        // Set project settings for this test from TestSettings object
        public void SetTestSettings()
        {
            TestSettings testSettings = model.settings.testSettings;                         // Get the models test settings

            if (testSettings == null)                                                        // If none found
            {
                Suite suite = SuiteManager.GetSuiteByName(suiteName);                        // Get current suite
                if (suite != null)                                                           // If suite was returned
                {
                    testSettings = suite.defaultTestSettings;                                // Apply suite default
                    if (testSettings == null)                                                // If still none found
                    {
                        testSettings = Resources.Load <TestSettings>("DefaultTestSettings"); // Apply default
                    }
                }
            }
            if (testSettings == null)             // If still none found
            {
                return;                           // Fail, return
            }
            Common.SetTestSettings(testSettings); // Set settings
        }
Beispiel #19
0
        // ------------------------------------------------------------------------------------
        // AltBaseline Menu
        // - Menu for chosing alternative baselines if current baselines are incomplete

        // Generate a resolve list
        IEnumerator GenerateAltBaselineList()
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Generating alternative baseline list"); // Write to console

            NameValueCollection fullSet = null;

            SQL.SQLIO.StartCoroutine(SQL.SQLIO.BaselineSetCheck(SuiteManager.GetSuiteNames(), (value => { fullSet = value; })));
            while (fullSet == null)
            {
                yield return(null);
            }

            Master.SetAltBaselines(fullSet);

            int count = 0;

            foreach (string key in fullSet.AllKeys)
            {
                foreach (string val in fullSet.GetValues(key))
                {
                    GameObject go = Instantiate(altBaselineWindow.listEntryPrefab, altBaselineWindow.contentRect, false);
                    MenuAltBaselineListEntry newEntry = go.GetComponent <MenuAltBaselineListEntry>();
                    newEntry.Setup(key, val);
                    count++;
                }
            }
            if (count == 0)
            {
                altBaselineWindow.button.interactable    = false;
                altBaselineWindow.altBaselineButton.text = String.Format("No Alternative Baselines Available", count);
            }
            else
            {
                altBaselineWindow.button.interactable    = true;
                altBaselineWindow.altBaselineButton.text = String.Format("Alternative Baselines  ( {0} )", count);
            }
        }
Beispiel #20
0
        public IEnumerator Init()
        {
            ProgressScreen.Instance.SetState(true, ProgressType.LocalLoad, "Loading local data"); //Show loading screen
            _suiteBaselineData = LocalIO.Instance.ReadLocalBaselines();                           // - TODO this needs to get called again at some point

            //Hardcoded wait for SuiteManager to populate - TODO might be cleaner way to do later
            float timeout = 0f;

            while (SuiteManager.GetSuiteNames().Length == 0)
            {
                timeout += Time.deltaTime;
                if (timeout > 5f)
                {
                    break;
                }
                yield return(new WaitForEndOfFrame());
            }

            //wait for the SQL connection to be made, timeout after 10seconds
            timeout = 0f;
            do
            {
                yield return(new WaitForEndOfFrame());

                timeout += Time.deltaTime;
            } while(SQL.SQLIO.Instance.liveConnection == connectionStatus.Internet && timeout < 10f);

            //if timeout reaches 10f then no network

            //fetch suite names from the suite manager
            string[] suiteNames = SuiteManager.GetSuiteNames();

            if (suiteNames.Length == 0)                                                                                                       //if there are no suites loaded fail - TODO need to add code path for this
            {
                Console.Instance.Write(DebugLevel.Critical, MessageLevel.LogWarning, "No suites loaded in SuiteManager, unable to continue"); // Write to console
            }
            else
            {
                //now we check local timestamps vs server to make sure up to date, then add the outdated ones to be pulled
                foreach (string suiteName in suiteNames)
                {
                    Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Fetching baseline timestamps from cloud");
                    //Get timestamp for suite via SQL
                    DateTime dt = DateTime.MaxValue;
                    StartCoroutine(SQL.SQLIO.Instance.GetbaselineTimestamp(suiteName, (value => { dt = value; })));
                    while (dt == DateTime.MaxValue)
                    {
                        yield return(null);
                    }
                    if (dt != DateTime.MinValue)//Min value is null(doesnt exist)
                    {
                        CompareBaselineTimestamps(suiteName, dt.ToString());
                    }
                }

                if (suiteBaselinesPullList.Count > 0)
                {
                    ResultsIOData[] data = null;
                    StartCoroutine(SQL.SQLIO.Instance.FetchBaselines(suiteBaselinesPullList.ToArray(), sysData.Platform, sysData.API, (value => { data = value; })));
                    while (data == null)
                    {
                        yield return(null);
                    }
                    //ResultsIOData[] data = SQL.SQLIO.Instance.FetchBaselines (suiteBaselinesPullList.ToArray (), sysData.Platform, sysData.API);
                    Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Cloud baselines pulled, writing local files");
                    foreach (ResultsIOData rd in data)
                    {
                        StartCoroutine(LocalIO.Instance.WriteDataFiles(rd, fileType.Baseline));
                    }
                    yield return(new WaitForSeconds(0.5f));

                    _suiteBaselineData = LocalIO.Instance.ReadLocalBaselines();
                    BroadcastBaselineParsed();
                }
                else
                {
                    Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "No cloud based baselines to pull");                      // Write to console
                    BroadcastBaselineParsed();
                }
            }
        }
Beispiel #21
0
        // Generate test structure
        // - Loads all scenes and gets data from test lists
        // - Reorganises for menu layout
        IEnumerator GenerateStructure()
        {
            yield return(null);                                                  // TODO - Remove

            testStructure = new Structure();                                     // Create new test structure instance
            List <TestType> typeList        = GenerateTypeListAndInstances();    // Generate type list and create instances
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings(); // Get the suite list

            if (projectSettings == null)                                         // If no suite list found
            {
                StopAllCoroutines();                                             // Abort
            }
            for (int su = 0; su < projectSettings.suiteList.Count; su++)         // Iterate suites on suite list
            {
                Suite newSuite = new Suite();                                    // Create new suite instance
                newSuite.suiteName = projectSettings.suiteList[su].suiteName;    // Set suite name from suite list
                newSuite.types     = CloneTestTypeList(typeList);                // Clone the type list
                RenderPipelineAsset pipeline = projectSettings.suiteList[su].defaultRenderPipeline;
                newSuite.suitePipeline = Common.GetRenderPipelineName(pipeline);
                for (int gr = 0; gr < projectSettings.suiteList[su].groups.Count; gr++) // Iterate groups
                {
                    RenderPipelineAsset grpPipeline = projectSettings.suiteList[su].groups[gr].renderPipelineOverride;
                    for (int te = 0; te < projectSettings.suiteList[su].groups[gr].tests.Count; te++)         // Iterate tests
                    {
                        GraphicsTestFramework.Test test = projectSettings.suiteList[su].groups[gr].tests[te]; // Get test
                        if (Common.IsTestApplicable(test))
                        {
                            int[] types = TestTypeManager.Instance.GetTypeSelectionFromBitMask(test.testTypes);                                     // Get type array from test's bitmask
                            for (int ty = 0; ty < types.Length; ty++)                                                                               // Iterate types of the test
                            {
                                Group newGroup = FindDuplicateGroupInType(newSuite, types[ty], projectSettings.suiteList[su].groups[gr].groupName); // Find duplicate groups in the type
                                if (newGroup == null)                                                                                               // If not found
                                {
                                    newGroup           = new Group();                                                                               // Create a new group instance
                                    newGroup.groupName = projectSettings.suiteList[su].groups[gr].groupName;                                        // Set group name
                                    if (grpPipeline != null)
                                    {
                                        newGroup.groupPipeline = Common.GetRenderPipelineName(grpPipeline);                   // Set the group pipeline name
                                    }
                                    FindDuplicateTypeInSuite(newSuite, types[ty]).groups.Add(newGroup);                       // Add the group to the type
                                }
                                Test     newTest   = new Test();                                                              // Create new test instance
                                string[] pathSplit = projectSettings.suiteList[su].groups[gr].tests[te].scenePath.Split('/'); // Split path for scene name
                                newTest.testName  = pathSplit[pathSplit.Length - 1].Replace(".unity", "");;                   // Set test name
                                newTest.scenePath = projectSettings.suiteList[su].groups[gr].tests[te].scenePath;             // Set scene path
                                newGroup.tests.Add(newTest);                                                                  // Add test to scene
                            }
                        }
                    }
                }
                for (int ty = 0; ty < newSuite.types.Count; ty++) // Iterate types
                {
                    if (newSuite.types[ty].groups.Count == 0)     // If empty
                    {
                        newSuite.types.RemoveAt(ty);              // Remove it
                    }
                }
                newSuite.types.TrimExcess();                                                                 // Trim the types list
                testStructure.suites.Add(newSuite);                                                          // Add to suites list
            }
            m_IsGenerated = true;                                                                            // Set generated
            Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "TestStructure finished generating"); // Write to console
            ProgressScreen.Instance.SetState(false, ProgressType.LocalLoad, "");                             // Disable ProgressScreen
        }
Beispiel #22
0
        // Generate test structure
        // - Loads all scenes and gets data from test lists
        // - Reorganises for menu layout
        IEnumerator GenerateStructure()
        {
            yield return(null);                                                                               // TODO - Remove

            testStructure = new Structure();                                                                  // Create new test structure instance

            string[]        testTypes = TestTypes.GetTypeStringList();                                        // Get the type list
            List <TestType> typeList  = new List <TestType>();                                                // Create new list to fill

            for (int i = 0; i < testTypes.Length; i++)                                                        // ITerate type list
            {
                TestType newType = new TestType();                                                            // Create new instance
                newType.typeName  = testTypes[i];                                                             // Set name
                newType.typeIndex = i;                                                                        // Set index
                typeList.Add(newType);                                                                        // Add to list
                TestModelBase model = (TestModelBase)Activator.CreateInstance(TestTypes.GetTypeFromIndex(i)); // Create model instance for logic references
                model.SetLogic();                                                                             // Need to set logic before generating type instances
                TestTypeManager.Instance.GenerateTestTypeInstance(model);                                     // Generate an instance object for test logic/display
            }
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();                              // Get the suite list

            if (projectSettings == null)                                                                      // If no suite list found
            {
                StopAllCoroutines();                                                                          // Abort
            }
            for (int su = 0; su < projectSettings.suiteList.Count; su++)                                      // Iterate suites on suite list
            {
                Suite newSuite = new Suite();                                                                 // Create new suite instance
                newSuite.suiteName = projectSettings.suiteList[su].suiteName;                                 // Set suite name from suite list
                newSuite.types     = CloneTestTypeList(typeList);                                             // Clone the type list
                for (int gr = 0; gr < projectSettings.suiteList[su].groups.Count; gr++)                       // Iterate groups
                {
                    for (int te = 0; te < projectSettings.suiteList[su].groups[gr].tests.Count; te++)         // Iterate tests
                    {
                        GraphicsTestFramework.Test test = projectSettings.suiteList[su].groups[gr].tests[te]; // Get test
                        if (Common.IsTestApplicable(test))
                        {
                            int[] types = TestTypeManager.Instance.GetTypeSelectionFromBitMask(test.testTypes);                                     // Get type array from test's bitmask
                            for (int ty = 0; ty < types.Length; ty++)                                                                               // Iterate types of the test
                            {
                                Group newGroup = FindDuplicateGroupInType(newSuite, types[ty], projectSettings.suiteList[su].groups[gr].groupName); // Find duplicate groups in the type
                                if (newGroup == null)                                                                                               // If not found
                                {
                                    newGroup           = new Group();                                                                               // Create a new group instance
                                    newGroup.groupName = projectSettings.suiteList[su].groups[gr].groupName;                                        // Set group name
                                    FindDuplicateTypeInSuite(newSuite, types[ty]).groups.Add(newGroup);                                             // Add the group to the type
                                }
                                Test     newTest   = new Test();                                                                                    // Create new test instance
                                string[] pathSplit = projectSettings.suiteList[su].groups[gr].tests[te].scenePath.Split('/');                       // Split path for scene name
                                newTest.testName  = pathSplit[pathSplit.Length - 1].Replace(".unity", "");;                                         // Set test name
                                newTest.scenePath = projectSettings.suiteList[su].groups[gr].tests[te].scenePath;                                   // Set scene path
                                newGroup.tests.Add(newTest);                                                                                        // Add test to scene
                            }
                        }
                    }
                }
                for (int ty = 0; ty < newSuite.types.Count; ty++) // Iterate types
                {
                    if (newSuite.types[ty].groups.Count == 0)     // If empty
                    {
                        newSuite.types.RemoveAt(ty);              // Remove it
                    }
                }
                newSuite.types.TrimExcess();                                                                 // Trim the types list
                testStructure.suites.Add(newSuite);                                                          // Add to suites list
            }
            m_IsGenerated = true;                                                                            // Set generated
            Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "TestStructure finished generating"); // Write to console
            ProgressScreen.Instance.SetState(false, ProgressType.LocalLoad, "");                             // Disable ProgressScreen
        }