1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
This file is part of WideImage. |
4
|
|
|
|
5
|
|
|
WideImage is free software; you can redistribute it and/or modify |
6
|
|
|
it under the terms of the GNU Lesser General Public License as published by |
7
|
|
|
the Free Software Foundation; either version 2.1 of the License, or |
8
|
|
|
(at your option) any later version. |
9
|
|
|
|
10
|
|
|
WideImage is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
GNU Lesser General Public License for more details. |
14
|
|
|
|
15
|
|
|
You should have received a copy of the GNU Lesser General Public License |
16
|
|
|
along with WideImage; if not, write to the Free Software |
17
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
18
|
|
|
|
19
|
|
|
* @package Tests |
20
|
|
|
**/ |
21
|
|
|
|
22
|
|
|
namespace Test\WideImage\Operation; |
23
|
|
|
|
24
|
|
|
use WideImage\WideImage; |
25
|
|
|
use WideImage\PaletteImage; |
26
|
|
|
use Test\WideImage_TestCase; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @package Tests |
30
|
|
|
*/ |
31
|
|
|
class MirrorTest extends WideImage_TestCase |
32
|
|
|
{ |
33
|
|
|
public function testMirror() |
34
|
|
|
{ |
35
|
|
|
$img = WideImage::load(IMG_PATH . '100x100-color-hole.gif'); |
36
|
|
|
|
37
|
|
|
$this->assertRGBEqual($img->getRGBAt(5, 5), 255, 255, 0); |
38
|
|
|
$this->assertRGBEqual($img->getRGBAt(95, 5), 0, 0, 255); |
39
|
|
|
$this->assertRGBEqual($img->getRGBAt(95, 95), 0, 255, 0); |
40
|
|
|
$this->assertRGBEqual($img->getRGBAt(5, 95), 255, 0, 0); |
41
|
|
|
|
42
|
|
|
$new = $img->mirror(); |
43
|
|
|
|
44
|
|
|
$this->assertTrue($new instanceof PaletteImage); |
45
|
|
|
|
46
|
|
|
$this->assertEquals(100, $new->getWidth()); |
47
|
|
|
$this->assertEquals(100, $new->getHeight()); |
48
|
|
|
|
49
|
|
|
$this->assertRGBEqual($new->getRGBAt(95, 5), 255, 255, 0); |
50
|
|
|
$this->assertRGBEqual($new->getRGBAt(5, 5), 0, 0, 255); |
51
|
|
|
$this->assertRGBEqual($new->getRGBAt(5, 95), 0, 255, 0); |
52
|
|
|
$this->assertRGBEqual($new->getRGBAt(95, 95), 255, 0, 0); |
53
|
|
|
|
54
|
|
|
$this->assertTrue($new->isTransparent()); |
55
|
|
|
$this->assertRGBEqual($new->getRGBAt(50, 50), $img->getTransparentColorRGB()); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|