예제 #1
0
        public void TestComposers()
        {
            Riff.InfoTag tag = new Riff.InfoTag();

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsTrue(t.IsEmpty, "Initial (IsEmpty): " + m);
                Assert.AreEqual(0, t.Composers.Length, "Initial (Zero): " + m);
            });

            tag.Composers = val_mult;

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsFalse(t.IsEmpty, "Value Set (!IsEmpty): " + m);
                Assert.AreEqual(val_mult.Length, t.Composers.Length, "Value Set: " + m);
                for (int i = 0; i < val_mult.Length; i++)
                {
                    Assert.AreEqual(val_mult [i], t.Composers [i], "Value Set: " + m);
                }
            });

            tag.Composers = new string [0];

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsTrue(t.IsEmpty, "Value Cleared (IsEmpty): " + m);
                Assert.AreEqual(0, t.Composers.Length, "Value Cleared (Zero): " + m);
            });
        }
예제 #2
0
		public void TestAlbumArtists ()
		{
			Riff.InfoTag tag = new Riff.InfoTag ();
			
			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
				Assert.AreEqual (0, t.AlbumArtists.Length, "Initial (Zero): " + m);
			});
			
			tag.AlbumArtists = val_mult;
			
			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
				Assert.AreEqual (val_mult.Length, t.AlbumArtists.Length, "Value Set: " + m);
				for (int i = 0; i < val_mult.Length; i ++) {
					Assert.AreEqual (val_mult [i], t.AlbumArtists [i], "Value Set: " + m);
				}
			});
			
			tag.AlbumArtists = new string [0];
			
			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
				Assert.AreEqual (0, t.AlbumArtists.Length, "Value Cleared (Zero): " + m);
			});
		}
예제 #3
0
 private void TagTestWithSave(ref Riff.InfoTag tag,
                              TagTestFunc testFunc)
 {
     testFunc(tag, "Before Save");
     //Extras.DumpHex (tag.Render ().Data);
     tag = new Riff.InfoTag(tag.Render());
     testFunc(tag, "After Save");
 }
예제 #4
0
        public void TestClear()
        {
            Riff.InfoTag tag = new Riff.InfoTag();

            tag.Title          = "A";
            tag.Performers     = new string [] { "B" };
            tag.AlbumArtists   = new string [] { "C" };
            tag.Composers      = new string [] { "D" };
            tag.Album          = "E";
            tag.Comment        = "F";
            tag.Genres         = new string [] { "Blues" };
            tag.Year           = 123;
            tag.Track          = 234;
            tag.TrackCount     = 234;
            tag.Disc           = 234;
            tag.DiscCount      = 234;
            tag.Lyrics         = "G";
            tag.Grouping       = "H";
            tag.BeatsPerMinute = 234;
            tag.Conductor      = "I";
            tag.Copyright      = "J";
            tag.Pictures       = new Picture [] { new Picture(TestPath.Covers + "sample_a.png") };

            Assert.IsFalse(tag.IsEmpty, "Should be full.");
            tag.Clear();

            Assert.IsNull(tag.Title, "Title");
            Assert.AreEqual(0, tag.Performers.Length, "Performers");
            Assert.AreEqual(0, tag.AlbumArtists.Length, "AlbumArtists");
            Assert.AreEqual(0, tag.Composers.Length, "Composers");
            Assert.IsNull(tag.Album, "Album");
            Assert.IsNull(tag.Comment, "Comment");
            Assert.AreEqual(0, tag.Genres.Length, "Genres");
            Assert.AreEqual(0, tag.Year, "Year");
            Assert.AreEqual(0, tag.Track, "Track");
            Assert.AreEqual(0, tag.TrackCount, "TrackCount");
            Assert.AreEqual(0, tag.Disc, "Disc");
            Assert.AreEqual(0, tag.DiscCount, "DiscCount");
            Assert.IsNull(tag.Lyrics, "Lyrics");
            Assert.IsNull(tag.Comment, "Comment");
            Assert.AreEqual(0, tag.BeatsPerMinute, "BeatsPerMinute");
            Assert.IsNull(tag.Conductor, "Conductor");
            Assert.IsNull(tag.Copyright, "Copyright");
            Assert.AreEqual(0, tag.Pictures.Length, "Pictures");
            Assert.IsTrue(tag.IsEmpty, "Should be empty.");
        }
예제 #5
0
        public void TestConductor()
        {
            Riff.InfoTag tag = new Riff.InfoTag();

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsTrue(t.IsEmpty, "Initial (IsEmpty): " + m);
                Assert.IsNull(t.Conductor, "Initial (Null): " + m);
            });

            tag.Conductor = val_sing;

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsFalse(t.IsEmpty, "Value Set (!IsEmpty): " + m);
                Assert.AreEqual(val_sing, t.Conductor, "Value Set (!Null): " + m);
            });

            tag.Conductor = string.Empty;

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsTrue(t.IsEmpty, "Value Cleared (IsEmpty): " + m);
                Assert.IsNull(t.Conductor, "Value Cleared (Null): " + m);
            });
        }
예제 #6
0
        public void TestTrackCount()
        {
            Riff.InfoTag tag = new Riff.InfoTag();

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsTrue(t.IsEmpty, "Initial (IsEmpty): " + m);
                Assert.AreEqual(0, tag.TrackCount, "Initial (Zero): " + m);
            });

            tag.TrackCount = 199;

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsFalse(t.IsEmpty, "Value Set (!IsEmpty): " + m);
                Assert.AreEqual(199, tag.TrackCount, "Value Set: " + m);
            });

            tag.TrackCount = 0;

            TagTestWithSave(ref tag, delegate(Riff.InfoTag t, string m) {
                Assert.IsTrue(t.IsEmpty, "Value Cleared (IsEmpty): " + m);
                Assert.AreEqual(0, t.TrackCount, "Value Cleared (Zero): " + m);
            });
        }
예제 #7
0
		public void TestTitle ()
		{
			Riff.InfoTag tag = new Riff.InfoTag ();
			
			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
				Assert.IsNull (t.Title, "Initial (Null): " + m);
			});
			
			tag.Title = val_sing;
			
			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
				Assert.AreEqual (val_sing, t.Title, "Value Set (!Null): " + m);
			});
			
			tag.Title = string.Empty;
			
			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
				Assert.IsNull (t.Title, "Value Cleared (Null): " + m);
			});

		}
예제 #8
0
		private void TagTestWithSave (ref Riff.InfoTag tag,
		                              TagTestFunc testFunc)
		{
			testFunc (tag, "Before Save");
			//Extras.DumpHex (tag.Render ().Data);
			tag = new Riff.InfoTag (tag.Render ());
			testFunc (tag, "After Save");
		}
예제 #9
0
		public void TestClear ()
		{
			Riff.InfoTag tag = new Riff.InfoTag ();
			
			tag.Title = "A";
			tag.Performers = new string [] {"B"};
			tag.AlbumArtists = new string [] {"C"};
			tag.Composers = new string [] {"D"};
			tag.Album = "E";
			tag.Comment = "F";
			tag.Genres = new string [] {"Blues"};
			tag.Year = 123;
			tag.Track = 234;
			tag.TrackCount = 234;
			tag.Disc = 234;
			tag.DiscCount = 234;
			tag.Lyrics = "G";
			tag.Grouping = "H";
			tag.BeatsPerMinute = 234;
			tag.Conductor = "I";
			tag.Copyright = "J";
			tag.Pictures = new Picture [] {new Picture ("../examples/covers/sample_a.png")};
			
			Assert.IsFalse (tag.IsEmpty, "Should be full.");
			tag.Clear ();
			
			Assert.IsNull (tag.Title, "Title");
			Assert.AreEqual (0, tag.Performers.Length, "Performers");
			Assert.AreEqual (0, tag.AlbumArtists.Length, "AlbumArtists");
			Assert.AreEqual (0, tag.Composers.Length, "Composers");
			Assert.IsNull (tag.Album, "Album");
			Assert.IsNull (tag.Comment, "Comment");
			Assert.AreEqual (0, tag.Genres.Length, "Genres");
			Assert.AreEqual (0, tag.Year, "Year");
			Assert.AreEqual (0, tag.Track, "Track");
			Assert.AreEqual (0, tag.TrackCount, "TrackCount");
			Assert.AreEqual (0, tag.Disc, "Disc");
			Assert.AreEqual (0, tag.DiscCount, "DiscCount");
			Assert.IsNull (tag.Lyrics, "Lyrics");
			Assert.IsNull (tag.Comment, "Comment");
			Assert.AreEqual (0, tag.BeatsPerMinute, "BeatsPerMinute");
			Assert.IsNull (tag.Conductor, "Conductor");
			Assert.IsNull (tag.Copyright, "Copyright");
			Assert.AreEqual (0, tag.Pictures.Length, "Pictures");
			Assert.IsTrue (tag.IsEmpty, "Should be empty.");
		}
예제 #10
0
		public void TestTrackCount ()
		{
			Riff.InfoTag tag = new Riff.InfoTag ();

			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
				Assert.AreEqual (0, tag.TrackCount, "Initial (Zero): " + m);
			});
			
			tag.TrackCount = 199;
			
			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
				Assert.AreEqual (199, tag.TrackCount, "Value Set: " + m);
			});
			
			tag.TrackCount = 0;

			TagTestWithSave (ref tag, delegate (Riff.InfoTag t, string m) {
				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
				Assert.AreEqual (0, t.TrackCount, "Value Cleared (Zero): " + m);
			});
		}