Skip to content

Commit

Permalink
Do not run image tests on php8
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Dec 7, 2020
1 parent 1670eab commit d690f90
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions tests/lib/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OCP\IConfig;

class ImageTest extends \Test\TestCase {

public static function tearDownAfterClass(): void {
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
Expand All @@ -20,6 +21,10 @@ public static function tearDownAfterClass(): void {
}

public function testConstructDestruct() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertInstanceOf('\OC_Image', $img);
Expand Down Expand Up @@ -47,6 +52,10 @@ public function testConstructDestruct() {
}

public function testValid() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->valid());
Expand All @@ -61,6 +70,10 @@ public function testValid() {
}

public function testMimeType() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals('image/png', $img->mimeType());
Expand All @@ -78,6 +91,10 @@ public function testMimeType() {
}

public function testWidth() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals(128, $img->width());
Expand All @@ -95,6 +112,10 @@ public function testWidth() {
}

public function testHeight() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals(128, $img->height());
Expand All @@ -112,6 +133,10 @@ public function testHeight() {
}

public function testSave() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$img->resize(16);
Expand All @@ -126,6 +151,10 @@ public function testSave() {
}

public function testData() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.png'));
Expand Down Expand Up @@ -160,6 +189,10 @@ public function testData() {
}

public function testDataNoResource() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$this->assertNull($img->data());
}
Expand All @@ -168,6 +201,10 @@ public function testDataNoResource() {
* @depends testData
*/
public function testToString() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$expected = base64_encode($img->data());
Expand All @@ -185,6 +222,10 @@ public function testToString() {
}

public function testResize() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->resize(32));
Expand All @@ -205,6 +246,10 @@ public function testResize() {
}

public function testPreciseResize() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->preciseResize(128, 512));
Expand All @@ -225,6 +270,10 @@ public function testPreciseResize() {
}

public function testCenterCrop() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$img->centerCrop();
Expand All @@ -245,6 +294,10 @@ public function testCenterCrop() {
}

public function testCrop() {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->crop(0, 0, 50, 20));
Expand Down Expand Up @@ -280,6 +333,10 @@ public static function sampleProvider() {
* @param int[] $expected
*/
public function testFitIn($filename, $asked, $expected) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename);
$this->assertTrue($img->fitIn($asked[0], $asked[1]));
Expand All @@ -303,6 +360,10 @@ public static function sampleFilenamesProvider() {
* @param string $filename
*/
public function testScaleDownToFitWhenSmallerAlready($filename) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename);
$currentWidth = $img->width();
Expand Down Expand Up @@ -336,6 +397,10 @@ public static function largeSampleProvider() {
* @param int[] $expected
*/
public function testScaleDownWhenBigger($filename, $asked, $expected) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename);
//$this->assertTrue($img->scaleDownToFit($asked[0], $asked[1]));
Expand All @@ -356,6 +421,10 @@ public function convertDataProvider() {
* @dataProvider convertDataProvider
*/
public function testConvert($mimeType) {
if (PHP_MAJOR_VERSION > 7) {
$this->markTestSkipped('Only run on php7');
}

$img = new \OC_Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$tempFile = tempnam(sys_get_temp_dir(), 'img-test');
Expand Down

0 comments on commit d690f90

Please sign in to comment.