summaryrefslogtreecommitdiffstats
path: root/tests/boundings_test.php
blob: f1ea775a3189cbca38c16cb421d7fb4ff5c9ad7e (plain)
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
62
63
64
65
66
67
68
69
70
<?php
/**
 * ezcGraphBoundingsTest 
 * 
 * @package Graph
 * @version //autogen//
 * @subpackage Tests
 * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
 * @license http://ez.no/licenses/new_bsd New BSD License
 */

/**
 * Tests for ezcGraph class.
 * 
 * @package ImageAnalysis
 * @subpackage Tests
 */
class ezcGraphBoundingsTest extends ezcTestCase
{
	public static function suite()
	{
		return new PHPUnit_Framework_TestSuite( "ezcGraphBoundingsTest" );
	}

    public function testCreateBoundings()
    {
        $boundings = new ezcGraphBoundings( 0, 1, 10, 11 );

        $this->assertEquals( $boundings->x0, 0 );
        $this->assertEquals( $boundings->y0, 1 );
        $this->assertEquals( $boundings->x1, 10 );
        $this->assertEquals( $boundings->y1, 11 );
    }

    public function testPseudoProperties()
    {
        $boundings = new ezcGraphBoundings( 0, 1, 10, 21 );

        $this->assertEquals( $boundings->width, 10 );
        $this->assertEquals( $boundings->height, 20 );
    }

    public function testCreateReverseBoundings()
    {
        $boundings = new ezcGraphBoundings( 10, 11, 0, 1 );

        $this->assertEquals( $boundings->x0, 0 );
        $this->assertEquals( $boundings->y0, 1 );
        $this->assertEquals( $boundings->x1, 10 );
        $this->assertEquals( $boundings->y1, 11 );
    }

    public function testUnknownBoundingsProperty()
    {
        $boundings = new ezcGraphBoundings( 10, 11, 0, 1 );

        try
        {
            $boundings->unknown;
        }
        catch ( ezcBasePropertyNotFoundException $e )
        {
            return true;
        }

        $this->fail( 'Expected ezcBasePropertyNotFoundException.' );
    }
}

?>
OpenPOWER on IntegriCloud