public Sequence CreateTimeline() { var timeline = new Sequence(); timeline.Tracks.Add(new Track { Number = 1, TrackType = TrackType.Visual, Volume = 1 }); int?maxNumberOfAudioTracks = this.configurationService.GetParameterValueAsInt("MaxNumberOfAudioTracks").GetValueOrDefault(1); for (int i = 1; i <= maxNumberOfAudioTracks.Value; i++) { var track = new Track { Number = i + 1, TrackType = TrackType.Audio, IsMuted = true, Volume = 1 }; timeline.Tracks.Add(track); } timeline.Tracks.Add(new Track { TrackType = TrackType.Overlay }); return(timeline); }
public void ShouldCallAddElementOnTimelineModelWhenAssetIsAudioAsset() { var track = new Track { TrackType = TrackType.Audio }; this.timelineModel.Tracks.Add(track); var position = TimeCode.FromAbsoluteTime(5, SmpteFrameRate.Smpte30); var element = new TimelineElement { Position = position, Asset = new AudioAsset { Duration = 2, Title = "Test Audio #1" } }; var command = new AddElementCommand(this.timelineModel, track, element); Assert.IsFalse(this.timelineModel.AddElementCalled); command.Execute(); Assert.IsTrue(this.timelineModel.AddElementCalled); Assert.AreEqual(element, this.timelineModel.AddElementArgument); }
public void ShouldCallRemoveElementOnTimelineModelWhenUnExecute() { var track = new Track { TrackType = TrackType.Visual }; this.timelineModel.Tracks.Add(track); var position = TimeCode.FromAbsoluteTime(10, SmpteFrameRate.Smpte30); var element = new TimelineElement { Position = position, Asset = new VideoAsset { Duration = TimeCode.FromAbsoluteTime(30, SmpteFrameRate.Smpte30), FrameRate = SmpteFrameRate.Smpte30, Title = "Test Video #1" } }; var command = new AddElementCommand(this.timelineModel, track, element); command.Execute(); var addedElement = this.timelineModel.AddElementArgument; Assert.IsFalse(this.timelineModel.RemoveElementCalled); command.UnExecute(); Assert.IsTrue(this.timelineModel.RemoveElementCalled); Assert.AreEqual(addedElement, this.timelineModel.RemoveElementArgument); }
public void ShouldCallAddElementOnTimelineModelWhenAssetIsImageAsset() { var track = new Track { TrackType = TrackType.Visual }; this.sequenceModel.Tracks.Add(track); var position = TimeCode.FromAbsoluteTime(20, SmpteFrameRate.Smpte30); var element = new TimelineElement { Position = position, Asset = new ImageAsset { Title = "Test Image #1" } }; var command = new AddElementCommand(this.sequenceModel, track, element); Assert.IsFalse(this.sequenceModel.AddElementCalled); command.Execute(); Assert.IsTrue(this.sequenceModel.AddElementCalled); Assert.AreEqual(element, this.sequenceModel.AddElementArgument); }
public void ShouldCallToMoveElementsOnTimelineModelInRippleModeWhenExecuteCommand() { var track = new Track { TrackType = TrackType.Visual }; this.timelineModel.Tracks.Add(track); var previousElement = new TimelineElement { Position = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), InPosition = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), OutPosition = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate) }; var currentElement = new TimelineElement { Position = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate), InPosition = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), OutPosition = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate) }; var nextElement = new TimelineElement { Position = TimeCode.FromAbsoluteTime(40, this.timelineModel.Duration.FrameRate), InPosition = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), OutPosition = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate) }; this.timelineModel.GetElementAtPositionReturnFunction = () => { if (this.timelineModel.GetElementAtPositionPositionArgument == currentElement.Position) { return(previousElement); } else if (currentElement.Position + currentElement.Duration == this.timelineModel.GetElementAtPositionPositionArgument) { return(nextElement); } else { return(null); } }; RemoveElementCommand command = new RemoveElementCommand(this.timelineModel, track, EditMode.Ripple, currentElement); Assert.IsFalse(this.timelineModel.MoveElementCalled); command.Execute(); Assert.IsTrue(this.timelineModel.MoveElementCalled); Assert.AreEqual(nextElement, this.timelineModel.MoveElementElementArgument); }
public void ShouldCallToRemoveElementOnTimelineModel() { var track = new Track { TrackType = TrackType.Visual }; this.timelineModel.Tracks.Add(track); var timelineElement = new TimelineElement(); RemoveElementCommand command = new RemoveElementCommand(this.timelineModel, track, EditMode.Gap, timelineElement); Assert.IsFalse(this.timelineModel.RemoveElementCalled); command.Execute(); Assert.IsTrue(this.timelineModel.RemoveElementCalled); Assert.AreEqual(timelineElement, this.timelineModel.RemoveElementArgument); }