public void TestSetEventVMWithCoordinates()
        {
            Mock <IDrawingToolkit> tkMock = new Mock <IDrawingToolkit> ();
            var timelineEvent             = new LMTimelineEvent {
                EventType = new EventType()
            };

            timelineEvent.EventType.TagFieldPosition = true;
            timelineEvent.AddDefaultPositions();
            var timelineEventVM = new LMTimelineEventVM {
                Model = timelineEvent
            };

            TimelineEventLocationView view = new TimelineEventLocationView {
                FieldPosition    = FieldPositionType.Field,
                BackgroundWidth  = 100,
                BackgroundHeight = 100,
            };

            view.SetViewModel(timelineEventVM);

            view.Draw(tkMock.Object, null);

            tkMock.Verify(tk => tk.DrawCircle(It.IsAny <Point> (), It.IsAny <double> ()), Times.Once());
        }
        public void TestEventDrawWhenPointChanges()
        {
            int redrawCount = 0;
            Mock <IDrawingToolkit> tkMock = new Mock <IDrawingToolkit> ();
            var timelineEvent             = new LMTimelineEvent {
                EventType = new EventType()
            };
            var timelineEventVM = new LMTimelineEventVM {
                Model = timelineEvent
            };
            TimelineEventLocationView view = new TimelineEventLocationView {
                FieldPosition    = FieldPositionType.Field,
                BackgroundWidth  = 100,
                BackgroundHeight = 100,
            };

            view.SetViewModel(timelineEventVM);
            view.RedrawEvent += (co, area) => redrawCount++;

            timelineEvent.EventType.TagFieldPosition = true;
            timelineEvent.AddDefaultPositions();

            view.Points = timelineEvent.FieldPosition.Points;
            view.Draw(tkMock.Object, null);

            Assert.Greater(redrawCount, 1);
            tkMock.Verify(tk => tk.DrawCircle(It.IsAny <Point> (), It.IsAny <double> ()), Times.Once());
        }
        public void HandleViewModelPropertyChanged_TimeChanged_RedrawNotTriggered()
        {
            int redrawCount = 0;
            Mock <IDrawingToolkit> tkMock = new Mock <IDrawingToolkit> ();
            var timelineEvent             = new LMTimelineEvent {
                EventType = new EventType()
            };
            var timelineEventVM = new LMTimelineEventVM {
                Model = timelineEvent
            };
            TimelineEventLocationView view = new TimelineEventLocationView {
                FieldPosition    = FieldPositionType.Field,
                BackgroundWidth  = 100,
                BackgroundHeight = 100,
            };

            view.SetViewModel(timelineEventVM);
            timelineEvent.EventType.TagFieldPosition = true;
            timelineEvent.AddDefaultPositions();
            view.RedrawEvent += (co, area) => redrawCount++;

            timelineEventVM.Start = new Time();

            Assert.AreEqual(0, redrawCount);
        }
Exemplo n.º 4
0
        public void AddTimelineEvent(LMTimelineEventVM timelineEventVM)
        {
            var po = new TimelineEventLocationView {
                BackgroundWidth  = Background.Width,
                BackgroundHeight = Background.Height,
                FieldPosition    = FieldPosition
            };

            po.SetViewModel(timelineEventVM);
            eventToView [timelineEventVM] = po;
            AddObject(po);
        }