예제 #1
0
 /**
  * Test the JImage::toFile to make sure that a new image is properly written
  * to file, when performing this test using a lossy compression we are not able
  * to open and save the same image and then compare the checksums as the checksums
  * may have changed. Therefore we are limited to comparing the image properties.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function testToFileDefault()
 {
     // Write the file out to a JPG.
     $outFileDefault = JPATH_TESTS . '/tmp/out.default';
     $image = new JImageInspector($this->testFile);
     $image->toFile($outFileDefault);
     // Get the file properties for both input and output.
     $a = JImage::getImageFileProperties($this->testFile);
     $b = JImage::getImageFileProperties($outFileDefault);
     // Assert that properties that should be equal are equal.
     $this->assertTrue($a->width == $b->width);
     $this->assertTrue($a->height == $b->height);
     $this->assertTrue($a->attributes == $b->attributes);
     $this->assertTrue($a->bits == $b->bits);
     $this->assertTrue($a->mime == $b->mime);
     $this->assertTrue($a->type == $b->type);
     $this->assertTrue($a->channels == $b->channels);
     // Clean up after ourselves.
     unlink($outFileDefault);
 }