Skip to content

Commit

Permalink
Address comments from @rullzer:
Browse files Browse the repository at this point in the history
 - implement isAvailable
 - run tests only if ImageMagick with HEIC support is available in the
   environment
  • Loading branch information
steiny2k committed Aug 17, 2018
1 parent 8a7bc3f commit e29f453
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
8 changes: 8 additions & 0 deletions lib/private/Preview/HEIC.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ class HEIC extends Bitmap {
public function getMimeType() {
return '/image\/hei(f|c)/';
}

/**
* {@inheritDoc}
*/
public function isAvailable(\OCP\Files\FileInfo $file) {
return in_array("HEIC", \Imagick::queryFonts("HEI*") );
}

}
18 changes: 12 additions & 6 deletions tests/lib/Preview/HEICTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@
class HEICTest extends Provider {

public function setUp() {
parent::setUp();
if ( !in_array("HEIC", \Imagick::queryFormats("HEI*")) ) {
$this->markTestSkipped('ImageMagick is not HEIC aware. Skipping tests');
} else {
parent::setUp();

$fileName = 'testimage.heic';
$this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
$this->width = 1680;
$this->height = 1050;
$this->provider = new \OC\Preview\HEIC;
}

$fileName = 'testimage.heic';
$this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
$this->width = 1680;
$this->height = 1050;
$this->provider = new \OC\Preview\HEIC;
}

}

0 comments on commit e29f453

Please sign in to comment.