Ejemplo n.º 1
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
        }
Ejemplo n.º 2
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
        }