Esempio n. 1
0
        public void StopWrongStateTest()
        {
            var tracker = new HoverTracker();

            Assert.IsFalse(tracker.Tracking);
            tracker.Stop();
            Assert.IsFalse(tracker.Tracking);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 7
0
        public void StartWrongArgTest()
        {
            var tracker = new HoverTracker();

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

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