예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
        public void StartWrongArgTest()
        {
            var tracker = new HoverTracker();

            tracker.Start(null, null);
        }
예제 #6
0
        public void StartWrongArg2Test()
        {
            var tracker = new HoverTracker();

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