Merge pull request #407 from letungit90/master
support crop with dynamic point
This commit is contained in:
commit
ef0ece8e61
2 changed files with 15 additions and 3 deletions
|
|
@ -16,11 +16,16 @@ class Point
|
||||||
private $x;
|
private $x;
|
||||||
private $y;
|
private $y;
|
||||||
|
|
||||||
public function __construct($x, $y)
|
public function __construct($x, $y, $dynamic = false)
|
||||||
{
|
{
|
||||||
|
if ($dynamic) {
|
||||||
|
$this->x = $x;
|
||||||
|
$this->y = $y;
|
||||||
|
} else {
|
||||||
$this->x = (int)$x;
|
$this->x = (int)$x;
|
||||||
$this->y = (int)$y;
|
$this->y = (int)$y;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return integer
|
* @return integer
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,11 @@ class PointTest extends TestCase
|
||||||
$this->assertEquals(4, $point->getX());
|
$this->assertEquals(4, $point->getX());
|
||||||
$this->assertEquals(25, $point->getY());
|
$this->assertEquals(25, $point->getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDynamicPointGetters()
|
||||||
|
{
|
||||||
|
$point = new Point("t*100", "t", true);
|
||||||
|
$this->assertEquals("t*100", $point->getX());
|
||||||
|
$this->assertEquals("t", $point->getY());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue