Skip to content

Commit 5b409eb

Browse files
committed
add Config::version
1 parent ebd94b6 commit 5b409eb

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to `:vips` will be documented in this file.
77
- add Image::newInterpolator() [Kleis Auke Wolthuizen]
88
- implement array access interface [John Cupitt]
99
- add BlendMode and Image::composite [John Cupitt]
10+
- add Config::version() [John Cupitt]
1011

1112
### Deprecated
1213
- Nothing

src/Config.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ public static function concurrencySet($value)
139139
{
140140
vips_concurrency_set($value);
141141
}
142+
143+
/**
144+
* Gets the libvips version number as a atring of the form
145+
* MAJOR.MINOR.MICRO, for example "8.6.1".
146+
*
147+
* @return string
148+
*/
149+
public static function version()
150+
{
151+
return vips_version();
152+
}
142153
}
143154

144155
/*

tests/ConfigTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public function testVipsConcurrencySet()
2828
{
2929
Vips\Config::concurrencySet(12);
3030
}
31+
32+
public function testVipsVersion()
33+
{
34+
$version = Vips\Config::version();
35+
$this->assertEquals(preg_match("/\d+\.\d+\.\d+/", $version), 1);
36+
}
3137
}
3238

3339
/*

tests/ConvenienceTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function testVipsComposite()
4747
$overlay = $this->image->add(20)->bandjoin(128);
4848
$overlay = $overlay->cast(Vips\BandFormat::UCHAR);
4949
$comp = $this->image->composite($overlay, Vips\BlendMode::OVER);
50-
$comp = $this->image->composite($overlay, 99);
5150

5251
$this->assertEquals($comp->getpoint(0, 0)[0], $this->pixel[0] + 10);
5352
}

0 commit comments

Comments
 (0)