Skip to content

Commit 4241eaa

Browse files
committed
add test for composite
test we can call composite before we test the result ... so we can work with a libvips which does not have this feature
1 parent 6590295 commit 4241eaa

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/ConvenienceTest.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,22 @@ public function testVipsBandsplit()
4444

4545
public function testVipsComposite()
4646
{
47-
/* We can't run this test on travis ... we need some way to spot
48-
* composite's existence.
49-
*
5047
$overlay = $this->image->add(20)->bandjoin(128);
5148
$overlay = $overlay->cast(Vips\BandFormat::UCHAR);
52-
$comp = $this->image->composite($overlay, Vips\BlendMode::OVER);
5349

54-
$this->assertEquals($comp->getpoint(0, 0)[0], $this->pixel[0] + 10);
55-
*
50+
/* Added in 8.6.
5651
*/
52+
$have_composite = FALSE;
53+
try {
54+
$comp = $this->image->composite($overlay, Vips\BlendMode::OVER);
55+
$have_composite = TRUE;
56+
} catch (Exception $e) {
57+
}
58+
59+
if ($have_composite) {
60+
$comp = $this->image->composite($overlay, Vips\BlendMode::OVER);
61+
$this->assertEquals($comp->getpoint(0, 0)[0], $this->pixel[0] + 10);
62+
}
5763
}
5864

5965
public function testVipsAddConst()

0 commit comments

Comments
 (0)