Пример #1
0
        public void ShouldSetDurationToZeroIfThereIsNotTrackInProject()
        {
            Project project = new Project();

            project.SetProjectDuration();

            Assert.IsTrue(project.Duration == 0);
        }
Пример #2
0
        /// <summary>
        /// Fills the settings project properties.
        /// </summary>
        private void FillProjectProperties()
        {
            Project project = this.projectService.GetCurrentProject();

            project.AutoSaveInterval = this.SelectedAutoSaveTimeInterval;
            project.SmpteFrameRate   = this.GetSmpteFrameRateValue();
            project.StartTimeCode    = new TimeCode(this.SelectedStartTimeCode, project.SmpteFrameRate);
            project.RippleMode       = this.GetEditModeValue() == EditMode.Ripple;
        }
Пример #3
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);
        }
Пример #4
0
        /// <summary>
        /// Loads the settings based on the project values.
        /// </summary>
        /// <param name="project">The project that contains the settings values.</param>
        private void LoadSettings(Project project)
        {
            if (project != null)
            {
                this.SelectedEditMode             = project.RippleMode ? this.GetEditModeValue(EditMode.Ripple) : this.GetEditModeValue(EditMode.Gap);
                this.SelectedSmpteTimeCode        = this.GetSmpteFrameRateValue(project.SmpteFrameRate);
                this.SelectedStartTimeCode        = project.StartTimeCode.ToString();
                this.SelectedAutoSaveTimeInterval = (int)project.AutoSaveInterval;
                this.ProjectName = project.Name ?? project.Name;
                this.SetThumbnail(project.ProjectThumbnail);

                this.timer.Interval = new TimeSpan(0, this.selectedAutoSaveTimeInterval, 0);
                this.timer.Start();
            }
        }
Пример #5
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);
        }
Пример #6
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);
        }