Test Failed
Push — master ( 3feb07...e3c021 )
by Dan
10:26
created

UsherTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 6
dl 0
loc 18
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testLinearUsher() 0 15 1
1
<?php
2
3
namespace SixtyNine\Cloud\Tests\Usher;
4
5
use Imagine\Image\Point;
6
use SixtyNine\Cloud\Factory\FontsFactory;
7
use SixtyNine\Cloud\Factory\PlacerFactory;
8
use SixtyNine\Cloud\FontMetrics;
9
use SixtyNine\Cloud\Usher\Usher;
10
11
class UsherTest extends \PHPUnit_Framework_TestCase
12
{
13
    public function testLinearUsher()
14
    {
15
        $factory = FontsFactory::create(__DIR__ . '/../fixtures/fonts');
16
        $metrics = new FontMetrics($factory);
17
        $placer = PlacerFactory::getInstance()->getPlacer(PlacerFactory::PLACER_LINEAR_H, 800, 600, 5);
18
        $usher = new Usher(800, 600, $placer, $metrics);
19
        $place1 = $usher->getPlace('foobar', 'Arial.ttf', 12, 0);
20
        // Assert the first word is positioned at (0,0)
21
        $this->assertEquals(new Point(0, 0), $place1->getPosition());
22
23
        $place2 = $usher->getPlace('foobar', 'Arial.ttf', 12, 90);
24
        // Assert the second word is placed on the right of the first word
25
        $this->assertEquals(0, $place2->getY());
26
        $this->assertTrue($place1->getWidth() <= $place2->getX());
27
    }
28
}
29