public override void Setup()
    {
        DeviceTestManager TestManager = GameObject.FindGameObjectWithTag("Facilitator").GetComponent <DeviceTestManager>();

        if ((DeviceUnderTest.characteristics & InputDeviceCharacteristics.HeadMounted) == 0)
        {
            // Set up visualizer
            m_Visualizer = Object.Instantiate(TestManager.TrackedDeviceVisualizerRotationPrefab);
            m_Visualizer.transform.SetParent(TestManager.XRRig.transform);
            TrackedDevice Device = m_Visualizer.GetComponent <TrackedDevice>();
            Device.device        = DeviceUnderTest;
            Device.rotationUsage = FeatureUsageUnderTest.As <Quaternion>();

            m_Visualizer.transform.localPosition = Vector3.forward;

            Vector3 trash;
            if (DeviceUnderTest.TryGetFeatureValue(CommonUsages.devicePosition, out trash))
            {
                Device.positionUsage = CommonUsages.devicePosition;
            }
            else if (DeviceUnderTest.TryGetFeatureValue(CommonUsages.colorCameraPosition, out trash))
            {
                Device.positionUsage = CommonUsages.colorCameraPosition;
            }
        }
        else
        {
            m_TextOnFace = TestManager.rotationTextOnFace;
            m_TextOnFace.SetDrivingUsage(DeviceUnderTest, FeatureUsageUnderTest.As <Quaternion>());
        }
    }
예제 #2
0
    // Run the check, which should be a single testable property or characteristic
    public override void RunCheck()
    {
        bool value;

        if (FeatureUsageUnderTest.type == typeof(bool) &&
            DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As <bool>(), out value) &&
            value == true)
        {
            passed = true;
        }
    }
    // Run the check, which should be a single testable property or characteristic
    public override void RunCheck()
    {
        float value;

        if (FeatureUsageUnderTest.type == typeof(float) &&
            DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As <float>(), out value) &&
            value == 1.0f)
        {
            passed = true;
        }
    }
예제 #4
0
    // Run the check, which should be a single testable property or characteristic
    public override void RunCheck()
    {
        Vector2 value;

        if (FeatureUsageUnderTest.type == typeof(Vector2) &&
            DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As <Vector2>(), out value) &&
            value.x < 0f &&
            value.y < 0f)
        {
            passed = true;
        }
    }
 // Run the check, which should be a single testable property or characteristic
 public override void RunCheck()
 {
     float value = float.NaN;
     if (!
         (FeatureUsageUnderTest.type == typeof(float)
         && DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As<float>(), out value)
         && value >= 0f
         && value <= 1f)
        )
     {
         ForceFail("Value of " + FeatureUsageUnderTest.name + " is outside of the range 0f to 1f");
     }
 }
    // Run the check, which should be a single testable property or characteristic
    public override void RunCheck()
    {
        Quaternion value;

        if (FeatureUsageUnderTest.type == typeof(Quaternion) &&
            DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As <Quaternion>(), out value) &&
            Mathf.Sqrt(Mathf.Pow(value.x, 2) + Mathf.Pow(value.y, 2) + Mathf.Pow(value.z, 2) + Mathf.Pow(value.w, 2)) != 1.0f)
        {
            ForceFail("ForceFail: quaternion is not normalized. Magnitude = " + (Mathf.Sqrt(Mathf.Pow(value.x, 2.0f) + Mathf.Pow(value.y, 2.0f) + Mathf.Pow(value.z, 2.0f) + Mathf.Pow(value.w, 2.0f))).ToString("F8"));
        }

        passed = true;
    }
    // Run the check, which should be a single testable property or characteristic
    public override void RunCheck()
    {
        Quaternion value;

        if (FeatureUsageUnderTest.type == typeof(Quaternion) &&
            DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As <Quaternion>(), out value) &&
            value.x == 0.0f &&
            value.y == 0.0f &&
            value.z == 0.0f &&
            value.w == 1.0f)
        {
            passed = true;
        }
    }
예제 #8
0
    public override void Setup()
    {
        DeviceTestManager TestManager = GameObject.FindGameObjectWithTag("Facilitator").GetComponent <DeviceTestManager>();

        // Set up visualizer
        m_Visualizer = Object.Instantiate(TestManager.TrackedDeviceVisualizerPointerPrefab);
        m_Visualizer.transform.SetParent(TestManager.XRRig.transform);
        TrackedDevice Device = m_Visualizer.GetComponent <TrackedDevice>();

        Device.device = DeviceUnderTest;
        //Device.rotationUsage = FeatureUsageUnderTest.As<Quaternion>();

        m_Visualizer.transform.localPosition = Vector3.forward;

        Quaternion checkIfRotationIsPresent;

        if (DeviceUnderTest.TryGetFeatureValue(CommonUsages.deviceRotation, out checkIfRotationIsPresent))
        {
            Device.rotationUsage = CommonUsages.deviceRotation;
        }
        else if (DeviceUnderTest.TryGetFeatureValue(CommonUsages.colorCameraRotation, out checkIfRotationIsPresent))
        {
            Device.rotationUsage = CommonUsages.colorCameraRotation;
        }
        Vector3 checkIfPositionIsPresent;

        if (DeviceUnderTest.TryGetFeatureValue(CommonUsages.devicePosition, out checkIfPositionIsPresent))
        {
            Device.positionUsage = CommonUsages.devicePosition;
        }
        else if (DeviceUnderTest.TryGetFeatureValue(CommonUsages.colorCameraPosition, out checkIfPositionIsPresent))
        {
            Device.positionUsage = CommonUsages.colorCameraPosition;
        }

        // Set up bearings
        m_Bearings = GameObject.FindGameObjectWithTag("Facilitator").GetComponent <DeviceTestManager>().bearings;
        if (m_Bearings != null)
        {
            m_Bearings.EnableAngularAcceleration(DeviceUnderTest, FeatureUsageUnderTest.As <Vector3>());
        }

        m_Graph = GameObject.FindGameObjectWithTag("Facilitator").GetComponent <DeviceTestManager>().graphVector3;
        if (m_Graph != null)
        {
            m_Graph.gameObject.SetActive(true);
            m_Graph.SetActive(DeviceUnderTest, FeatureUsageUnderTest.As <Vector3>(), 10f);
        }
    }
예제 #9
0
    // Run the check, which should be a single testable property or characteristic
    public override void RunCheck()
    {
        Vector2 value = new Vector2(float.NaN, float.NaN);

        if (!
            (FeatureUsageUnderTest.type == typeof(Vector2) &&
             DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As <Vector2>(), out value) &&
             value.x >= -1f &&
             value.x <= 1f &&
             value.y >= -1f &&
             value.y <= 1f)
            )
        {
            ForceFail("Value of " + FeatureUsageUnderTest.name + " is outside of the range -1.0 to 1.0.  " +
                      "X = " + value.x.ToString("F8") +
                      "Y = " + value.y.ToString("F8"));
        }
    }
예제 #10
0
    // Run the check, which should be a single testable property or characteristic
    public override void RunCheck()
    {
        Eyes  value = new Eyes();
        float left  = 0;
        float right = 0;

        if (DeviceUnderTest.TryGetFeatureValue(FeatureUsageUnderTest.As <Eyes>(), out value))
        {
            value.TryGetLeftEyeOpenAmount(out left);
            value.TryGetRightEyeOpenAmount(out right);

            if (left < 0 || left > 1)
            {
                ForceFail("ForceFail: Left Eye open value is not within [0, 1]. Left Eye Open Value is " + left);
            }
            if (right < 0 || right > 1)
            {
                ForceFail("ForceFail: Right Eye open value is not within [0, 1]. Right Eye Open Value is " + right);
            }
        }

        passed = true;
    }
예제 #11
0
        /// <summary>
        /// Run GFriend Script
        /// </summary>
        /// <param name="executionData">Execution data</param>
        /// <param name="gfScriptPath">Path of GFriend Script to run</param>
        /// <param name="device">Device info</param>
        /// <returns></returns>
        private PluginExecutionResult RunGFriendScript(PluginExecutionData executionData, string gfScriptPath, IDeviceInfo device)
        {
            _workflowLogger.RecordEvent(DeviceWorkflowMarker.ActivityBegin);
            string gfLibraryPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "GFriend", "libs");
            string outputPath    = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "GFriend_Output", executionData.SessionId, executionData.ActivityExecutionId.ToString());

            // Prepare GF Native Libraries and Add event handler
            // Developer Note :
            // GFriend dynamically load native libraries (GFK.*.dll files) when execution.
            // For exeucting GFriend script path of library files should be given.
            // In this step plugin unzip the embeded archive which contains GFriend native library to Plugin\GFriend\libs
            if (!_isGFPrepared)
            {
                UpdateStatus("Preparing GF libraries");
                GFEvent.OnGFEvent += GFEvent_OnGFEvent;
                GFriendPreparationManager.PrepareLibrary(gfLibraryPath);
                LibraryUtils.LibraryPath = gfLibraryPath;

                _isGFPrepared = true;
            }
            TestDataManager        testDataManager = new TestDataManager();
            List <DeviceUnderTest> gfDevices       = new List <DeviceUnderTest>();

            if (device != null)
            {
                DeviceUnderTest dut = new DeviceUnderTest()
                {
                    DeviceId        = device.AssetId,
                    DeviceAddress   = device.Address,
                    LanDebugAddress = device.Address2,
                    AdminPassword   = device.AdminPassword
                };
                gfDevices.Add(dut);
            }
            UpdateStatus("GFrined Initialization");
            Runner.InitGFRunner(gfDevices, outputPath);
            UpdateStatus("Running GFriend Script");
            Runner.Run(gfScriptPath, out testDataManager, null, gfLibraryPath);

            // Check Result with output.xml
            string      outputXMLPath = Path.Combine(outputPath, "output.xml");
            XmlDocument outputXML     = new XmlDocument();

            outputXML.Load(outputXMLPath);
            XmlNode testSuite  = outputXML.SelectSingleNode("//TestSuite");
            int     passCount  = testSuite.SelectNodes("//TestCase/Result[contains(text(),'PASS')]")?.Count ?? 0;
            int     failCount  = testSuite.SelectNodes("//TestCase/Result[contains(text(),'FAIL')]")?.Count ?? 0;
            int     errorCount = testSuite.SelectNodes("//TestCase/Result[contains(text(),'ERROR')]")?.Count ?? 0;

            _workflowLogger.RecordEvent(DeviceWorkflowMarker.ActivityEnd);
            if (errorCount > 0)
            {
                return(new PluginExecutionResult(PluginResult.Error, $"GFriend Execution Ended with Pass:{passCount}, Fail:{failCount}, Error:{errorCount}"));
            }

            if (failCount > 0)
            {
                return(new PluginExecutionResult(PluginResult.Failed, $"GFriend Execution Ended with Pass:{passCount}, Fail:{failCount}, Error:{errorCount}"));
            }

            return(new PluginExecutionResult(PluginResult.Passed));
        }