Exemple #1
0
        public void StopWrongStateTest()
        {
            var tracker = new HoverTracker();

            Assert.IsFalse(tracker.Tracking);
            tracker.Stop();
            Assert.IsFalse(tracker.Tracking);
        }
Exemple #2
0
        public void ConstructorTest()
        {
            var tracker = new HoverTracker();

            // test default values
            Assert.IsFalse(tracker.Tracking);
            Assert.AreEqual(100, tracker.CheckInterval);
            Assert.IsNull(tracker.Control);
            Assert.IsNull(tracker.Popup);
        }
Exemple #3
0
        public void AutoStopOnControlDisposedTest()
        {
            var tracker = new HoverTracker();

            var ctrl = new Button();
            var wnd  = new Popup(new Button());

            tracker.Start(ctrl, wnd);
            Assert.IsTrue(tracker.Tracking);
            ctrl.Dispose();
            Thread.Sleep(200);
            Application.DoEvents(); // force timer event processing
            Assert.IsFalse(tracker.Tracking);
            Assert.IsNull(tracker.Control);
            Assert.IsNull(tracker.Popup);
        }
Exemple #4
0
        public void FireTrackingStoppedOnRestartTest()
        {
            var tracker = new HoverTracker();

            var ctrl         = new Button();
            var wnd          = new Popup(new Button());
            var eventCatcher = new EventCatcher();

            tracker.TrackingStopped += eventCatcher.OnTrackingStopped;

            tracker.Start(ctrl, wnd);
            Assert.AreEqual(0, eventCatcher.Fired);
            tracker.Start(ctrl, wnd);
            Assert.AreEqual(1, eventCatcher.Fired);
            Assert.IsTrue(tracker.Tracking);
        }
Exemple #5
0
        public void CommonTrackingTest()
        {
            var tracker = new HoverTracker();

            var ctrl = new Button();
            var wnd  = new Popup(new Button());

            Assert.IsFalse(tracker.Tracking);
            tracker.Start(ctrl, wnd);
            Assert.IsTrue(tracker.Tracking);
            Assert.AreEqual(ctrl, tracker.Control);
            Assert.AreEqual(wnd, tracker.Popup);
            tracker.Stop();
            Assert.IsFalse(tracker.Tracking);
            Assert.IsNull(tracker.Control);
            Assert.IsNull(tracker.Popup);
        }
Exemple #6
0
        public void FireTrackingStoppedOnStopTest()
        {
            var tracker = new HoverTracker();

            var ctrl         = new Button();
            var wnd          = new Popup(new Button());
            var eventCatcher = new EventCatcher();

            tracker.TrackingStopped += eventCatcher.OnTrackingStopped;

            tracker.Start(ctrl, wnd);
            Assert.AreEqual(0, eventCatcher.Fired);
            tracker.Stop();
            Assert.AreEqual(1, eventCatcher.Fired);
            Assert.IsNotNull(eventCatcher.Ev);
            Assert.AreEqual(ctrl, eventCatcher.Ev.Control);
            Assert.AreEqual(wnd, eventCatcher.Ev.Popup);
        }
Exemple #7
0
        public void StartWrongArgTest()
        {
            var tracker = new HoverTracker();

            tracker.Start(null, null);
        }
Exemple #8
0
        public void StartWrongArg2Test()
        {
            var tracker = new HoverTracker();

            tracker.Start(new Button(), null);
        }