Browse Source

Address comments from @rullzer:

 - implement isAvailable
 - run tests only if ImageMagick with HEIC support is available in the
   environment

Signed-off-by: Sebastian Steinmetz <me@sebastiansteinmetz.ch>
tags/v14.0.0RC1
Sebastian Steinmetz 5 years ago
parent
commit
5a996b5f87
2 changed files with 20 additions and 6 deletions
  1. 8
    0
      lib/private/Preview/HEIC.php
  2. 12
    6
      tests/lib/Preview/HEICTest.php

+ 8
- 0
lib/private/Preview/HEIC.php View File

@@ -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*") );
}

}

+ 12
- 6
tests/lib/Preview/HEICTest.php View File

@@ -31,12 +31,18 @@ namespace Test\Preview;
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;
}

}

Loading…
Cancel
Save