Esempio n. 1
0
        public void EndCalibrationTest()
        {
            AutoResetEvent done  = new AutoResetEvent(false);
            int            error = 0;

            tracker.EndCalibration(delegate(int err, int res) {
                error = err;
                done.Set();
            });
            done.WaitOne();
            //Ending Calibration while not calibrating should result in an error.
            Assert.AreNotEqual(0, error);

            tracker.StartCalibration(delegate(int err, int res)
            {
                done.Set();
            });
            done.WaitOne();

            tracker.EndCalibration(delegate(int err, int res)
            {
                error = err;
                done.Set();
            });
            done.WaitOne();
            //Now we should be able to end calibration
            Assert.AreEqual(0, error);


            //We should be able to end calibration after adding some points.
            tracker.StartCalibration(delegate(int err, int res)
            {
                done.Set();
            });
            done.WaitOne();

            tracker.AddPoint(0.125, 0.999999, delegate(int err, int res)
            {
                done.Set();
            });
            done.WaitOne();

            tracker.AddPoint(0.8, 0.999999, delegate(int err, int res)
            {
                done.Set();
            });
            done.WaitOne();

            tracker.AddPoint(0.125, 0.1, delegate(int err, int res)
            {
                done.Set();
            });
            done.WaitOne();

            tracker.EndCalibration(delegate(int err, int res)
            {
                error = err;
                done.Set();
            });
            done.WaitOne();
            //Now we should be able to end calibration
            Assert.AreEqual(0, error);
        }