Пример #1
0
        public void TestCalibrationProcessHandler()
        {
            try
            {
                try
                {
                    ActivateServer();

                    CalibrationProcessHandler handler = new CalibrationProcessHandler();

                    List <Point2D> calibPoints = CalibUtils.InitCalibrationPoints(3, 3, 1980, 1200, 30, 30, true);

                    Assert.IsTrue(GazeManager.Instance.CalibrationStart(9, handler));

                    Thread.Sleep(500);

                    foreach (Point2D p in calibPoints)
                    {
                        GazeManager.Instance.CalibrationPointStart((int)p.X, (int)p.Y);

                        Thread.Sleep(500);

                        GazeManager.Instance.CalibrationPointEnd();

                        Thread.Sleep(1000);
                    }

                    Thread.Sleep(2000);

                    Assert.IsTrue(handler.startWasCalled);
                    Assert.IsTrue(handler.progressWasCalled);
                    Assert.IsTrue(handler.processingWasCalled);
                    Assert.IsTrue(handler.resultWasCalled);

                    Assert.IsNotNull(handler.result);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception testing calibration: " + e.Message);
                }
            }
            finally
            {
                DeactivateServer();
            }
        }
Пример #2
0
        public static string GetCalibString(CalibrationResult result)
        {
            int rating = CalibUtils.GetCalibRating(result);

            switch (rating)
            {
            case 1:
                return("POOR");

            case 2:
                return("MODERATE");

            case 3:
                return("GOOD");

            case 4:
                return("PERFECT");

            default:
                return("na");
            }
        }