public void ShouldReturnNegativeOneWhenLockingZeroOrOneElement() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var group1 = new List <TimelineElement>(); Assert.AreEqual(0, manager.LockGroups.Count); int groupId = manager.LockElements(group1); Assert.AreEqual(-1, groupId); group1.Add(element1); groupId = manager.LockElements(group1); Assert.AreEqual(-1, groupId); }
public void ShouldetTheTheProjectDurationWhenThereIsOneTrackAndOneShot() { Project project = new Project(); Track track = new Track(); project.Timeline.Add(track); TimelineElement timelineElement = new TimelineElement() { InPosition = TimeCode.FromSeconds(2000.0, SmpteFrameRate.Smpte25), OutPosition = TimeCode.FromSeconds(3000.0, SmpteFrameRate.Smpte25), Position = TimeCode.FromSeconds(10000.0, SmpteFrameRate.Smpte25) }; track.Shots.Add(timelineElement); project.SetProjectDuration(); var duration = timelineElement.OutPosition.TotalSeconds - timelineElement.InPosition.TotalSeconds + timelineElement.Position.TotalSeconds; Assert.AreEqual(project.Duration, duration); }
public void ShouldNotCreateWhenGroupingZeroOrOneElement() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var group1 = new List <TimelineElement>(); Assert.AreEqual(0, manager.LockGroups.Count); manager.LockElements(group1); Assert.AreEqual(0, manager.LockGroups.Count); group1.Add(element1); manager.LockElements(group1); Assert.AreEqual(0, manager.LockGroups.Count); }
public void ShouldShowTheCurrentMediaDataIfCurrentMediaIsValidWhileSettingIsVisiblePropertyToTrue() { var aggregateMediaModel = CreateTestableAggregateMediaModel(); var timelineElement = new TimelineElement { Asset = new VideoAsset(), InPosition = TimeCode.FromSeconds(0d, SmpteFrameRate.Smpte25), OutPosition = TimeCode.FromSeconds(5000d, SmpteFrameRate.Smpte25), Position = TimeCode.FromSeconds(0d, SmpteFrameRate.Smpte25) }; aggregateMediaModel.AddElement(timelineElement); // Set the current media. aggregateMediaModel.Position = TimeSpan.FromSeconds(1000); aggregateMediaModel.BaseMediaData[0].Hide(); Assert.IsTrue(((UIElement)aggregateMediaModel.BaseMediaData[0].Media).Opacity == 0.0); aggregateMediaModel.IsVisible = true; Assert.IsTrue(((UIElement)aggregateMediaModel.BaseMediaData[0].Media).Opacity == 1.0); }
public void ShouldCallToRemoveElementOnTimelineModel() { var track = new Track { TrackType = TrackType.Visual }; this.sequenceModel.Tracks.Add(track); var timelineElement = new TimelineElement(); RemoveElementCommand command = new RemoveElementCommand(this.sequenceModel, track, EditMode.Gap, timelineElement); Assert.IsFalse(this.sequenceModel.RemoveElementCalled); command.Execute(); Assert.IsTrue(this.sequenceModel.RemoveElementCalled); Assert.AreEqual(timelineElement, this.sequenceModel.RemoveElementArgument); }
public void ShouldAddTitleAssetElement() { var aggregateMediaModel = CreateTestableAggregateMediaModel(); var timelineElement = new TimelineElement { Asset = new TitleAsset { TitleTemplate = new TitleTemplate { XamlResource = Resources.Resources.TitleTemplateXAMLResource } } }; var mediaData = aggregateMediaModel.AddElement(timelineElement); Assert.IsNotNull(mediaData); Assert.IsInstanceOfType(mediaData, typeof(TitleMediaData)); Assert.AreEqual(1, aggregateMediaModel.BaseMediaData.Count); }
/// <summary> /// Saves the ink comment. /// </summary> private void SaveInkComment() { TimelineElement element = this.GetElementAtCurrentPosition(); if (element == null) { this.EditMode = false; this.SelectedCommentType = null; this.View.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.Resources.NoVisualAssetAssociated, Resources.Resources.InkComment)); } else { double markIn = this.sequenceRegistry.CurrentSequenceModel.CurrentPosition.TotalSeconds; double markOut = element.Position.TotalSeconds + element.Duration.TotalSeconds; StrokeCollection strokes = new StrokeCollection(); if (this.InkCommentStrokes != null) { foreach (Stroke stroke in this.InkCommentStrokes) { strokes.Add(stroke); } } this.CurrentComment = new InkComment { CommentType = this.CurrentComment == null ? CommentType.Ink : this.CurrentComment.CommentType, Text = this.Text ?? string.Empty, Creator = this.configurationService.GetUserName(), Created = DateTime.Now, Modified = DateTime.Now, MarkIn = markIn, MarkOut = markOut, InkCommentStrokes = strokes }; element.Comments.Add(this.CurrentComment); this.AddComment(this.CurrentComment); } }
/// <summary> /// Initializes a new instance of the <see cref="ImageMediaData"/> class. /// </summary> /// <param name="timelineElement">The timeline element.</param> public ImageMediaData(TimelineElement timelineElement) { this.timelineElement = timelineElement; this.In = TimeSpan.FromSeconds(timelineElement.InPosition.TotalSeconds); this.Out = TimeSpan.FromSeconds(timelineElement.OutPosition.TotalSeconds); timelineElement.PropertyChanged += (sender, e) => { if (e.PropertyName == "InPosition") { this.In = TimeSpan.FromSeconds(timelineElement.InPosition.TotalSeconds); } if (e.PropertyName == "OutPosition") { this.Out = TimeSpan.FromSeconds(timelineElement.OutPosition.TotalSeconds); } }; this.image = new Image { Source = new BitmapImage(timelineElement.Asset.Source), Opacity = 0 }; this.timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(UtilityHelper.PositionUpdateIntervalMillis) }; this.timer.Tick += (sender, e) => { this.timer.Stop(); if (this.Playing) { DateTime now = DateTime.Now; this.Position += TimeSpan.FromMilliseconds((now - this.processTime).TotalMilliseconds); this.processTime = now; this.timer.Start(); } }; }
/// <summary> /// Adds the shot comment. /// </summary> private void AddShotComment() { TimelineElement element = this.GetElementAtCurrentPosition(); if (element == null) { this.EditMode = false; this.View.ShowErrorMessage(String.Format(CultureInfo.InvariantCulture, Resources.Resources.NoVisualAssetAssociated, Resources.Resources.ShotComment)); this.SelectedCommentType = null; } else { this.CurrentComment = new Comment(Guid.Empty) { Creator = this.configurationService.GetUserName(), CommentType = CommentType.Shot }; this.Text = this.CurrentComment.Text; this.EditMode = true; } }
public void ShouldAddElementToLockGroupWhenAdded() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var element2 = new TimelineElement(); var element3 = new TimelineElement(); var elements = new List <TimelineElement> { element1, element2, element3 }; Assert.AreEqual(0, manager.LockGroups.Count); manager.LockElements(elements); Assert.AreEqual(1, manager.LockGroups.Count); Assert.AreEqual(3, manager.LockGroups[0].Count); Assert.IsTrue(manager.LockGroups[0].Contains(element1)); Assert.IsTrue(manager.LockGroups[0].Contains(element2)); Assert.IsTrue(manager.LockGroups[0].Contains(element3)); }
public void ShouldSetShowMetadataToTrueWhenShowMetadataEventIsPublished() { this.regionManager.Regions.Add(new MockRegion { Name = RegionNames.ClipMetadataRegion }); var presentationModel = this.CreateMetadataViewPresentationModel(); Asset asset = new VideoAsset { Title = "Test Video" }; presentationModel.ShowMetadataInformation = false; var payload = new TimelineElement { Asset = asset }; this.showMetadataEvent.SubscribeArgumentAction(payload); Assert.IsTrue(presentationModel.ShowMetadataInformation); }
public void ShouldReturnTheAssetAssociatedWithTheMediaDataUnderTheCurrentPosition() { var aggregateMediaModel = CreateTestableAggregateMediaModel(); var expectedAsset = new VideoAsset { Source = new Uri("http://test") }; var timelineElement1 = new TimelineElement { Asset = new ImageAsset(), InPosition = TimeCode.FromSeconds(0d, SmpteFrameRate.Smpte25), OutPosition = TimeCode.FromSeconds(5000d, SmpteFrameRate.Smpte25), Position = TimeCode.FromSeconds(0d, SmpteFrameRate.Smpte25) }; var timelineElement2 = new TimelineElement { Asset = expectedAsset, InPosition = TimeCode.FromSeconds(0d, SmpteFrameRate.Smpte25), OutPosition = TimeCode.FromSeconds(5000d, SmpteFrameRate.Smpte25), Position = TimeCode.FromSeconds(1000d, SmpteFrameRate.Smpte25) }; aggregateMediaModel.AddElement(timelineElement1); aggregateMediaModel.AddElement(timelineElement2); // Set the current media. aggregateMediaModel.Position = TimeSpan.FromSeconds(6000); Assert.AreEqual(expectedAsset, aggregateMediaModel.CurrentAsset); }
public void ShouldRaiseOnPropertyChangedEventWhenOutPositionIsUpdated() { var propertyChangedRaised = false; string propertyChangedEventArgsArgument = null; var timelineElement = new TimelineElement { OutPosition = TimeCode.FromSeconds(100d, SmpteFrameRate.Smpte30) }; timelineElement.PropertyChanged += (sender, e) => { propertyChangedRaised = true; propertyChangedEventArgsArgument = e.PropertyName; }; Assert.IsFalse(propertyChangedRaised); Assert.IsNull(propertyChangedEventArgsArgument); timelineElement.OutPosition = TimeCode.FromSeconds(200d, SmpteFrameRate.Smpte30); Assert.IsTrue(propertyChangedRaised); Assert.AreEqual("OutPosition", propertyChangedEventArgsArgument); }
private void AddOverlay(TimelineElement shot, CompositeManifestInfo compositeManifestInfo) { var overlayAsset = shot.Asset as OverlayAsset; if (overlayAsset != null) { var dict = new Dictionary <string, object>(); overlayAsset.Metadata.ForEach(mf => dict.Add(mf.Name, mf.Value)); const double Timescale = 10000000.0; compositeManifestInfo.AddOverlay( overlayAsset.Title, overlayAsset.PositionX, overlayAsset.PositionY, overlayAsset.Height, overlayAsset.Width, dict, overlayAsset.XamlResource, (ulong)(shot.Position.TotalSeconds * Timescale), (ulong)((shot.Position.TotalSeconds + shot.Duration.TotalSeconds) * Timescale)); } }
public void ShouldReturnSingleElementAfterUnlockingGroup() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var element2 = new TimelineElement(); var group1 = new List <TimelineElement> { element1, element2 }; manager.LockElements(group1); manager.UnlockElementLockGroup(element2); Assert.AreEqual(0, manager.LockGroups.Count); var elements = manager.GetGroupedElements(element1); Assert.AreEqual(1, elements.Count()); elements = manager.GetGroupedElements(element2); Assert.AreEqual(1, elements.Count()); }
/// <summary> /// Updates the frames. /// </summary> /// <param name="numberOfFrames">The number of frames.</param> /// <param name="currentWidth">Width of the current.</param> private void UpdateFrames(double numberOfFrames, double currentWidth) { this.FramesStackPanel.Children.Clear(); TimelineElement element = DataContext as TimelineElement; if (element != null) { int totalSecondsPerFrame = (int)PixelToSeconds(FrameWidth, element, currentWidth); int startSeconds = (int)element.InPosition.TotalSeconds; for (int i = 0; i < numberOfFrames; i++) { Image image = this.frameImages[i]; string uriString = this.thumbnailService.GetThumbnailSource(element.Asset, startSeconds, image.Width, image.Height); image.Source = new BitmapImage(new Uri(Uri.EscapeUriString(uriString), UriKind.RelativeOrAbsolute)); this.FramesStackPanel.Children.Add(image); startSeconds += totalSecondsPerFrame; } } }
/// <summary> /// Initializes a new instance of the <see cref="TitleMediaData"/> class. /// </summary> /// <param name="timelineElement">The timeline element.</param> public TitleMediaData(TimelineElement timelineElement) { this.timelineElement = timelineElement; this.titlePlayer = new TitlePlayer(timelineElement.Asset as TitleAsset) { Opacity = 0 }; this.In = TimeSpan.FromSeconds(0); this.Out = TimeSpan.FromSeconds(timelineElement.Duration.TotalSeconds); timelineElement.PropertyChanged += (sender, e) => { if (e.PropertyName == "InPosition") { this.In = TimeSpan.FromSeconds(0); } if (e.PropertyName == "OutPosition") { this.Out = TimeSpan.FromSeconds(timelineElement.Duration.TotalSeconds); } }; }
public void ShouldCallToPauseOnMediaWhenPause() { var aggregateMediaModel = CreateTestableAggregateMediaModel(); var timelineElement = new TimelineElement { Asset = new VideoAsset() }; var mockMediaData = new MockMediaData { MockedTimelineElement = timelineElement, In = TimeSpan.FromSeconds(0), Out = TimeSpan.FromSeconds(300) }; aggregateMediaModel.BaseMediaData.Add(mockMediaData); aggregateMediaModel.Position = TimeSpan.FromSeconds(150); Assert.IsFalse(mockMediaData.PauseCalled); aggregateMediaModel.Pause(); Assert.IsTrue(mockMediaData.PauseCalled); }
public void ShouldProvideLowestAvailableGroupIdWhenGroupingNewElements() { ILockGroupManager manager = this.CreateGroupLockManager(); var element1 = new TimelineElement(); var element2 = new TimelineElement(); var element3 = new TimelineElement(); var element4 = new TimelineElement(); var element5 = new TimelineElement(); var element6 = new TimelineElement(); var element7 = new TimelineElement(); var element8 = new TimelineElement(); var group1 = new List <TimelineElement> { element1, element2 }; var group2 = new List <TimelineElement> { element3, element4 }; var group3 = new List <TimelineElement> { element5, element6 }; var group4 = new List <TimelineElement> { element7, element8 }; manager.LockElements(group1); manager.LockElements(group2); manager.LockElements(group3); manager.UnlockElementLockGroup(element1); manager.LockElements(group4); Assert.AreEqual(0, manager.LockGroups.Last().Id); }
public TimelineElement FindFirstElementLinking(TimelineElement element, Track layer) { return(element); // TODO }
public bool IsElementLinkedTo(TimelineElement element, TimelineElement linkedElement) { return(this.IsElementLinkedToReturnValue); }
public void UnlinkElement(TimelineElement element) { throw new NotImplementedException(); }
public void UnlinkElements(TimelineElement elementA, TimelineElement elementB) { this.UnlinkElementsCalled = true; }
public bool LinkPreviousElement(TimelineElement element, TimelineElement previousElement) { this.LinkPreviousElementCalled = true; return(false); }
public bool LinkNextElement(TimelineElement element, TimelineElement nextElement) { this.LinkNextElementCalled = true; return(false); }
public void RemoveElement(TimelineElement element, Track layer) { this.RemoveElementCalled = true; this.RemoveElementArgument = element; this.InvokeElementRemoved(element); }
public void AddElement(TimelineElement element, Track layer) { this.AddElementCalled = true; this.AddElementArgument = element; this.AddElementArguments.Add(element); }
public void UpdatePlayByPlayMarkersPosition(TimelineElement element, TimeCode newPosition) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="AddElementCommand"/> class. /// </summary> /// <param name="timelineModel">The timeline model.</param> /// <param name="layer">The layer where the element is beign added.</param> /// <param name="element">The element beign added.</param> public AddElementCommand(ITimelineModel timelineModel, Track layer, TimelineElement element) { this.timelineModel = timelineModel; this.layer = layer; this.element = element; }
public TimelineElementLink GetElementLink(TimelineElement element) { return(new TimelineElementLink(element.Id)); // TODO }