-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathGainmapTest.php
More file actions
61 lines (48 loc) · 1.44 KB
/
GainmapTest.php
File metadata and controls
61 lines (48 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Jcupitt\Vips\Test;
use Generator;
use Jcupitt\Vips;
use PHPUnit\Framework\TestCase;
class GainmapTest extends TestCase
{
/**
* @var Vips\Image
*/
private $image;
/**
* @var Vips\Image
*/
private $no_gainmap_image;
protected function setUp(): void
{
parent::setUp();
if (Vips\FFI::vips()->vips_type_find('VipsOperation', 'uhdrload') == 0) {
$this->markTestSkipped('requires libvips built with Ultra HDR support');
}
$filename = __DIR__ . '/images/ultra-hdr.jpg';
$this->image = Vips\Image::newFromFile($filename);
$filename = __DIR__ . '/images/img_0076.jpg';
$this->no_gainmap_image = Vips\Image::newFromFile($filename);
}
protected function tearDown(): void
{
unset($this->image);
unset($this->no_gainmap_image);
}
public function testVipsGetGainmap()
{
$gainmap = $this->image->getGainmap();
$this->assertEquals($gainmap->width, 960);
$gainmap = $this->no_gainmap_image->getGainmap();
$this->assertEquals($gainmap, null);
}
public function testVipsSetGainmap()
{
$gainmap = $this->image->getGainmap();
$new_gainmap = $gainmap->crop(0, 0, 10, 10);
$image = $this->image->copy();
$image->set("gainmap", $new_gainmap);
$gainmap = $image->getGainmap();
$this->assertEquals($gainmap->width, 10);
}
}