From a435de089da4dd37c3c183f633a49107c720dd95 Mon Sep 17 00:00:00 2001 From: Dalyn Cessac Date: Wed, 16 Mar 2011 11:06:40 -0500 Subject: Added phpvideotoolkit transcoder and updates to the preset ui --- .../ffmpeg-php/php-reader/tests/TestID3v2.php | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/tests/TestID3v2.php (limited to 'libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/tests/TestID3v2.php') diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/tests/TestID3v2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/tests/TestID3v2.php new file mode 100644 index 0000000..facb87d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/tests/TestID3v2.php @@ -0,0 +1,139 @@ + + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 107 $ + */ +final class TestID3v2 extends PHPUnit_Framework_TestCase +{ + function testTagCreate() + { + $id3 = new ID3v2(); + + $id3->tit2->text = "Title 1"; + $this->assertEquals("Title 1", $id3->tit2->text); + $id3->tope->text = "Artist 1"; + $this->assertEquals("Artist 1", $id3->tope->text); + $id3->talb->text = "Album 1"; + $this->assertEquals("Album 1", $id3->talb->text); + $id3->tdrc->text = "2008"; + $this->assertEquals("2008", $id3->tdrc->text); + $id3->comm->text = "Comment 1"; + $this->assertEquals("Comment 1", $id3->comm->text); + $id3->trck->text = "11/13"; + $this->assertEquals("11/13", $id3->trck->text); + $id3->tcon->text = "Classical"; + $this->assertEquals("Classical", $id3->tcon->text); + + $id3->write("id3v2.tag"); + } + + function testTagReadAfterCreate() + { + $id3 = new ID3v2("id3v2.tag"); + + $this->assertEquals("Title 1", $id3->tit2->text); + $this->assertEquals("Artist 1", $id3->tope->text); + $this->assertEquals("Album 1", $id3->talb->text); + $this->assertEquals("2008", $id3->tdrc->text); + $this->assertEquals("Comment 1", $id3->comm->text); + $this->assertEquals("11/13", $id3->trck->text); + $this->assertEquals("Classical", $id3->tcon->text); + } + + function testTagChange() + { + $id3 = new ID3v2("id3v2.tag"); + + $id3->tit2->text = "Title 2"; + $this->assertEquals("Title 2", $id3->tit2->text); + $id3->tope->text = "Artist 2"; + $this->assertEquals("Artist 2", $id3->tope->text); + $id3->talb->text = "Album 2"; + $this->assertEquals("Album 2", $id3->talb->text); + $id3->tdrc->text = "2020"; + $this->assertEquals("2020", $id3->tdrc->text); + $id3->comm->text = "Comment 2"; + $this->assertEquals("Comment 2", $id3->comm->text); + $id3->trck->text = "13/13"; + $this->assertEquals("13/13", $id3->trck->text); + $id3->tcon->text = "Trance"; + $this->assertEquals("Trance", $id3->tcon->text); + + $id3->write(); + } + + function testTagReadAfterChange() + { + $id3 = new ID3v2("id3v2.tag"); + + $this->assertEquals("Title 2", $id3->tit2->text); + $this->assertEquals("Artist 2", $id3->tope->text); + $this->assertEquals("Album 2", $id3->talb->text); + $this->assertEquals("2020", $id3->tdrc->text); + $this->assertEquals("Comment 2", $id3->comm->text); + $this->assertEquals("13/13", $id3->trck->text); + $this->assertEquals("Trance", $id3->tcon->text); + } + + function testUnsynchronisation() + { + $id3 = new ID3v2("id3v2.tag"); + $id3->tit2->text = "\xff\xf0"; + $id3->tcon->text = "\xff\xe0\xf0"; + $id3->write(); + + $this->assertEquals + ("TIT2\0\0\0\x08\0\x03\0\0\0\x03\x03\xff\x00\xf0", "" . $id3->tit2); + + $id3 = new ID3v2("id3v2.tag"); + $this->assertEquals("\xff\xf0", $id3->tit2->text); + $this->assertEquals("\xff\xe0\xf0", $id3->tcon->text); + } +} -- cgit v1.2.3