예제 #1
0
        int activeTestLogic;                                     // Track the active logic

        // ------------------------------------------------------------------------------------
        // Instance Management

        // Generate script instances for a type (Called by TestStructure)
        public void GenerateTestTypeInstance(TestModelBase model)
        {
            string typeName = model.logic.ToString().Replace("GraphicsTestFramework.", "").Replace("Logic", "");         // Get type name from logic name

            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Generating test type instances for " + typeName); // Write to console
            Transform instanceParent = Master.Instance.transform.Find("TestRunners");                                    // Find instance parent

            if (instanceParent)                                                                                          // If it exists
            {
                if (!instanceParent.Find(typeName))                                                                      // If instance doesnt already exist
                {
                    GameObject newChild = new GameObject();                                                              // Create a gameobject to hold the instance
                    newChild.transform.SetParent(instanceParent);                                                        // Set parent
                    newChild.name = typeName;                                                                            // Set gameobject name
                    TestLogicBase logic = (TestLogicBase)newChild.AddComponent(model.logic);                             // Add logic component
                    logic.SetupLogic();                                                                                  // Run setup on logic
                    logic.SetName();                                                                                     // Set name on logic
                    logic.SetDisplay();                                                                                  // Set display on logic
                    logic.SetResults();                                                                                  // Set results type on logic
                    TestDisplayBase display = (TestDisplayBase)newChild.AddComponent(logic.display);                     // Add display component
                    display.SetLogic(logic);                                                                             // Set logic on display
                    display.GetResultsContextObject();                                                                   // Get context object for results entry
                    AddType(logic);                                                                                      // Add to type list
                }
            }
            else
            {
                Console.Instance.Write(DebugLevel.Critical, MessageLevel.Log, "Test Runner parent not found! Aborting"); // Write to console
            }
        }
예제 #2
0
        // Create and expand context object
        IEnumerator ExpandContextObject(ResultsEntry inputEntry, TestDisplayBase display)
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Expanding context object");                                                                 // Write to console
            int entryIndex = FindEntryInDetailedResultsList(inputEntry);                                                                                           // Get index of selected entry

            activeContextEntry  = inputEntry;                                                                                                                      // Track selected entry
            activeContextObject = Instantiate(display.resultsContextPrefab, listContentRect, false);                                                               // Create context object instance
            RectTransform contextObjectRect = activeContextObject.GetComponent <RectTransform>();                                                                  // Get rect

            contextObjectRect.anchoredPosition = new Vector2(0, (entryIndex + 1) * -listEntries[0].GetComponent <RectTransform>().sizeDelta.y);                    // Set position
            listContentRect.sizeDelta          = new Vector2(listContentRect.sizeDelta.x, listContentRect.sizeDelta.y + contextObjectRect.sizeDelta.y);            // Set size
            NudgeDetailedResultsListEntries(entryIndex, -contextObjectRect.sizeDelta.y);                                                                           // Nudge entries
            ResultsContext resultsContext = activeContextObject.GetComponent <ResultsContext>();                                                                   // Get results context reference

            resultsContext.Setup(activeContextEntry);                                                                                                              // Setup base of results context
            ResultsIOData resultsDataFull = new ResultsIOData();                                                                                                   // Create output data

            yield return(StartCoroutine(ResultsIO.Instance.FetchSpecificEntry(inputEntry.resultsEntryData.resultsData, (value => { resultsDataFull = value; })))); // Get full results data // SQLCHECK

            ResultsIOData resultsDataFullB = new ResultsIOData();                                                                                                  // Create output data

            if (TestRunner.Instance)
            {
                if (TestRunner.Instance.runnerType == RunnerType.Analytic)
                {
                    yield return(StartCoroutine(SQL.SQLIO.FetchBaseline(inputEntry.resultsEntryData.resultsDataB, (value => { resultsDataFullB = value; })))); // Get full results data // SQLCHECK
                }
                else if (TestRunner.Instance.runnerType == RunnerType.AnalyticComparison)
                {
                    yield return(StartCoroutine(ResultsIO.Instance.FetchSpecificEntry(inputEntry.resultsEntryData.resultsDataB, (value => { resultsDataFullB = value; })))); // Get full results data // SQLCHECK
                }
            }
            //if(inputEntry.resultsEntryData.resultsDataB != null)
            display.SetupResultsContext(resultsContext, resultsDataFull, resultsDataFullB); // Tell Display how to setup the results context
        }
예제 #3
0
        // Create and expand context object
        void ExpandContextObject(ResultsEntry inputEntry, TestDisplayBase display)
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Expanding context object");                                                      // Write to console
            int entryIndex = FindEntryInDetailedResultsList(inputEntry);                                                                                // Get index of selected entry

            activeContextEntry  = inputEntry;                                                                                                           // Track selected entry
            activeContextObject = Instantiate(display.resultsContextPrefab, listContentRect, false);                                                    // Create context object instance
            RectTransform contextObjectRect = activeContextObject.GetComponent <RectTransform>();                                                       // Get rect

            contextObjectRect.anchoredPosition = new Vector2(0, (entryIndex + 1) * -listEntries[0].GetComponent <RectTransform>().sizeDelta.y);         // Set position
            listContentRect.sizeDelta          = new Vector2(listContentRect.sizeDelta.x, listContentRect.sizeDelta.y + contextObjectRect.sizeDelta.y); // Set size
            NudgeDetailedResultsListEntries(entryIndex, -contextObjectRect.sizeDelta.y);                                                                // Nudge entries
            ResultsContext resultsContext = activeContextObject.GetComponent <ResultsContext>();                                                        // Get results context reference

            resultsContext.Setup(activeContextEntry);                                                                                                   // Setup base of results context
            display.SetupResultsContext(resultsContext, inputEntry.resultsEntryData.resultsData);                                                       // Tell Display how to setup the results context
        }
예제 #4
0
        // ------------------------------------------------------------------------------------
        // Detailed Results Context Object

        // Toggle the context object
        public void ToggleContextObject(ResultsEntry inputEntry, TestDisplayBase display)
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Toggling context object for " + inputEntry); // Write to console
            if (activeContextObject == null)                                                                        // If context object is null
            {
                ExpandContextObject(inputEntry, display);                                                           // Create and expand
            }
            else
            {
                if (activeContextEntry == inputEntry) // If selected entry matches current context
                {
                    HideContextObject(inputEntry);    // Hide it
                }
                else
                {
                    HideContextObject(activeContextEntry);    // Hide the current
                    ExpandContextObject(inputEntry, display); // Create and expand
                }
            }
            RefreshMenu(); // Refresh menu - WORKAROUND
        }