Example #1
0
        public void ShouldSetDurationToZeroIfThereIsNoElementsInTracks()
        {
            Project project = new Project();
            Track   track1  = new Track();
            Track   track2  = new Track();

            project.Timeline.Add(track1);
            project.Timeline.Add(track2);

            project.SetProjectDuration();

            Assert.IsTrue(project.Duration == 0);
        }
Example #2
0
        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);
        }
Example #3
0
        public void ShouldetTheTheProjectDurationWhenThereIsMoreThanOneTrackAndMoreThanOneShot()
        {
            Project project = new Project();
            Track   track1  = new Track();
            Track   track2  = new Track();

            project.Timeline.Add(track1);
            project.Timeline.Add(track2);
            TimelineElement timelineElement1 = new TimelineElement()
            {
                InPosition  = TimeCode.FromSeconds(2000.0, SmpteFrameRate.Smpte25),
                OutPosition = TimeCode.FromSeconds(3000.0, SmpteFrameRate.Smpte25),
                Position    = TimeCode.FromSeconds(10000.0, SmpteFrameRate.Smpte25)
            };

            TimelineElement timelineElement2 = new TimelineElement()
            {
                InPosition  = TimeCode.FromSeconds(2000.0, SmpteFrameRate.Smpte25),
                OutPosition = TimeCode.FromSeconds(3000.0, SmpteFrameRate.Smpte25),
                Position    = TimeCode.FromSeconds(12000.0, SmpteFrameRate.Smpte25)
            };

            TimelineElement timelineElement3 = new TimelineElement()
            {
                InPosition  = TimeCode.FromSeconds(2000.0, SmpteFrameRate.Smpte25),
                OutPosition = TimeCode.FromSeconds(3000.0, SmpteFrameRate.Smpte25),
                Position    = TimeCode.FromSeconds(14000.0, SmpteFrameRate.Smpte25)
            };

            TimelineElement timelineElement4 = new TimelineElement()
            {
                InPosition  = TimeCode.FromSeconds(2000.0, SmpteFrameRate.Smpte25),
                OutPosition = TimeCode.FromSeconds(3000.0, SmpteFrameRate.Smpte25),
                Position    = TimeCode.FromSeconds(10000.0, SmpteFrameRate.Smpte25)
            };

            TimelineElement timelineElement5 = new TimelineElement()
            {
                InPosition  = TimeCode.FromSeconds(4000.0, SmpteFrameRate.Smpte25),
                OutPosition = TimeCode.FromSeconds(6000.0, SmpteFrameRate.Smpte25),
                Position    = TimeCode.FromSeconds(12000.0, SmpteFrameRate.Smpte25)
            };

            TimelineElement timelineElement = new TimelineElement()
            {
                InPosition  = TimeCode.FromSeconds(2000.0, SmpteFrameRate.Smpte25),
                OutPosition = TimeCode.FromSeconds(4000.0, SmpteFrameRate.Smpte25),
                Position    = TimeCode.FromSeconds(20000.0, SmpteFrameRate.Smpte25)
            };

            track1.Shots.Add(timelineElement1);
            track1.Shots.Add(timelineElement2);
            track1.Shots.Add(timelineElement3);

            track2.Shots.Add(timelineElement4);
            track2.Shots.Add(timelineElement5);
            track2.Shots.Add(timelineElement);

            project.SetProjectDuration();

            var duration = timelineElement.OutPosition.TotalSeconds - timelineElement.InPosition.TotalSeconds +
                           timelineElement.Position.TotalSeconds;

            Assert.AreEqual(project.Duration, duration);
        }