SetNextTrack() public method

public SetNextTrack ( SafeUri uri ) : void
uri Hyena.SafeUri
return void
示例#1
0
文件: Tests.cs 项目: rucker/banshee
        [Test] // https://bugzilla.gnome.org/show_bug.cgi?id=722731
        public void TestThatInvalidTracksShouldNotBecomeCurrentTrack()
        {
            var a_valid_track = "A_boy.ogg";
            var a_valid_uri   = new SafeUri(Paths.Combine(TestsDir, "data", a_valid_track));

            var a_track_that_doesnt_exit = "this_does_not_exist_in_the_data_folder.ogg";
            var an_invalid_track         = new SafeUri(Paths.Combine(TestsDir, "data", a_track_that_doesnt_exit));

            TrackInfo current_track = null;

            WaitUntil(PlayerEvent.Error, () => {
                service.Open(a_valid_uri);
                current_track = service.CurrentTrack;
                Assert.IsNotNull(current_track);
                Assert.IsTrue(current_track.Uri.AbsolutePath.EndsWith(a_valid_track));

                service.SetNextTrack(an_invalid_track);
                service.Play();
            });

            WaitUntil(PlayerEvent.StartOfStream, () => {
                service.Open(a_valid_uri);
                service.Play();
            });

            current_track = service.CurrentTrack;
            Assert.IsNotNull(current_track);
            var actual_filename = System.IO.Path.GetFileName(SafeUri.UriToFilename(current_track.Uri));

            Assert.AreEqual(a_valid_track, actual_filename);
        }