'jpeg_exif.jpg', 'noexif_jpeg' => 'jpeg_noexif.jpg', 'exif_tiff' => 'tiff_exif.tiff', 'noexif_tiff' => 'tiff_noexif.tiff', 'animated_gif' => 'gif_animated.gif', 'noanimated_gif' => 'gif_nonanimated.gif', 'noanimated_png' => 'png_nonanimated.png', ); public static function suite() { return new ezcTestSuite( "ezcImageAnalysisAnalyzerTest" ); } /** * setUp * * @access public */ public function setUp() { $this->basePath = dirname( __FILE__ ) . '/data/'; } /** * tearDown * * @access public */ public function tearDown() { } public function testGetMimeJpegExif() { $file = $this->basePath . $this->testFiles['exif_jpeg']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 'image/jpeg', $analyzer->mime, 'MIME-Type was not determined correctly for JPEG.' ); } public function testGetMimeJpegNoexif() { $file = $this->basePath . $this->testFiles['noexif_jpeg']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 'image/jpeg', $analyzer->mime, 'MIME-Type was not determined correctly for JPEG.' ); } public function testGetMimeTiffExif() { $file = $this->basePath . $this->testFiles['exif_tiff']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 'image/tiff', $analyzer->mime, 'MIME-Type was not determined correctly for TIFF.' ); } public function testGetMimeTiffNoexif() { $file = $this->basePath . $this->testFiles['noexif_tiff']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 'image/tiff', $analyzer->mime, 'MIME-Type was not determined correctly for TIFF.' ); } public function testGetMimeGifNonanimated() { $file = $this->basePath . $this->testFiles['noanimated_gif']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 'image/gif', $analyzer->mime, 'MIME-Type was not determined correctly for GIF.' ); } public function testGetMimeGifAnimated() { $file = $this->basePath . $this->testFiles['animated_gif']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 'image/gif', $analyzer->mime, 'MIME-Type was not determined correctly for GIF.' ); } public function testGetMimePngNonanimated() { $file = $this->basePath . $this->testFiles['noanimated_png']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 'image/png', $analyzer->mime, 'MIME-Type was not determined correctly for PNG.' ); } public function testJpegExifReportsDetails() { $file = $this->basePath . $this->testFiles['exif_jpeg']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 399, $analyzer->width, ' not extracted correctly for JPEG.' ); $this->assertSame( 600, $analyzer->height, ' not extracted correctly for JPEG.' ); $this->assertSame( true, $analyzer->isColor, ' not extracted correctly for JPEG.' ); $this->assertSame( ' ', $analyzer->comment, ' not extracted correctly for JPEG.' ); $this->assertSame( 76383, $analyzer->size, ' not extracted correctly for JPEG.' ); $this->assertSame( false, $analyzer->isAnimated, ' not extracted correctly for JPEG.' ); $this->assertSame( true, $analyzer->hasThumbnail, ' not extracted correctly for JPEG.' ); } public function testJpegNoexifReportsDetails() { $file = $this->basePath . $this->testFiles['noexif_jpeg']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 399, $analyzer->width, ' not extracted correctly for JPEG.' ); $this->assertSame( 600, $analyzer->height, ' not extracted correctly for JPEG.' ); $this->assertSame( true, $analyzer->isColor, ' not extracted correctly for JPEG.' ); $this->assertSame( null, $analyzer->comment, ' not extracted correctly for JPEG.' ); $this->assertSame( 68802, $analyzer->size, ' not extracted correctly for JPEG.' ); $this->assertSame( false, $analyzer->isAnimated, ' not extracted correctly for JPEG.' ); $this->assertSame( false, $analyzer->hasThumbnail, ' not extracted correctly for JPEG.' ); } public function testTiffExifReportsDetails() { $file = $this->basePath . $this->testFiles['exif_tiff']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 399, $analyzer->width, ' not extracted correctly for TIFF.' ); $this->assertSame( 600, $analyzer->height, ' not extracted correctly for TIFF.' ); $this->assertSame( true, $analyzer->isColor, ' not extracted correctly for TIFF.' ); $this->assertSame( null, $analyzer->comment, ' not extracted correctly for TIFF.' ); $this->assertSame( 108125, $analyzer->size, ' not extracted correctly for TIFF.' ); $this->assertSame( false, $analyzer->isAnimated, ' not extracted correctly for TIFF.' ); $this->assertSame( false, $analyzer->hasThumbnail, ' not extracted correctly for TIFF.' ); } public function testTiffNoexifReportsDetails() { $file = $this->basePath . $this->testFiles['noexif_tiff']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 399, $analyzer->width, ' not extracted correctly for TIFF.' ); $this->assertSame( 600, $analyzer->height, ' not extracted correctly for TIFF.' ); $this->assertSame( true, $analyzer->isColor, ' not extracted correctly for TIFF.' ); $this->assertSame( null, $analyzer->comment, ' not extracted correctly for TIFF.' ); $this->assertSame( 108043, $analyzer->size, ' not extracted correctly for TIFF.' ); $this->assertSame( false, $analyzer->isAnimated, ' not extracted correctly for TIFF.' ); $this->assertSame( false, $analyzer->hasThumbnail, ' not extracted correctly for TIFF.' ); } public function testPngReportsDetails() { $file = $this->basePath . $this->testFiles['noanimated_png']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( 160, $analyzer->width, ' not extracted correctly for PNG.' ); $this->assertSame( 120, $analyzer->height, ' not extracted correctly for PNG.' ); $this->assertSame( 5420, $analyzer->size, ' not extracted correctly for PNG.' ); } public function testAnimatedGifReportsAnimated() { $file = $this->basePath . $this->testFiles['animated_gif']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( true, $analyzer->isAnimated, ' not extracted correctly for GIF.' ); } public function testNoexifJpegReportsNotAnimated() { $file = $this->basePath . $this->testFiles['noexif_jpeg']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( false, $analyzer->isAnimated, ' no extracted correctly for JPEG.' ); } public function testNonanimatedGifReportsNotAnimated() { $file = $this->basePath . $this->testFiles['noanimated_gif']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( false, $analyzer->isAnimated, ' not extracted correctly for GIF.' ); } public function testExifJpegReportsNotAnimated() { $file = $this->basePath . $this->testFiles['exif_jpeg']; $analyzer = new ezcImageAnalyzer( $file ); $this->assertSame( false, $analyzer->isAnimated, ' not extracted correctly for JPEG.' ); } } ?>