root/cleversvg/trunk/tests/csImageTest.php

Revision 336, 1.0 kB (checked in by nperriault, 10 months ago)

Clever Svg:

  • refs #40: more elements tests
  • Removed depth management, as svg handle it natively

Warning: breaks BC from 0.5.

Line 
1 <?php
2 require_once 'PHPUnit/Framework.php';
3 require_once dirname(__FILE__).'/../cleversvg.php';
4 require_once dirname(__FILE__).'/csBaseTestCase.class.php';
5
6 /**
7  * csImage PHPUnit tests
8  *
9  */
10 class csImageTest extends csBaseTestCase
11 {
12
13   public function testSetters()
14   {
15     $doc = new csDocument(320, 240, 'Blah');
16     $elem = new csImage();
17     $elem->setHeight(2);
18     $elem->setHref('test.png');
19     $elem->setTitle('MyTitle');
20     $elem->setWidth(5);
21     $elem->setX(6);
22     $elem->setY(7);
23     $doc->addElement($elem);
24     $this->assertAttrValueEquals($doc, '/svg:svg/svg:image/@height', 2);
25     $this->assertAttrValueEquals($doc, '/svg:svg/svg:image/@xlink:href', 'test.png');
26     $this->assertTextNodeEquals($doc, '/svg:svg/svg:image/svg:title', 'MyTitle');
27     $this->assertAttrValueEquals($doc, '/svg:svg/svg:image/@width', 5);
28     $this->assertAttrValueEquals($doc, '/svg:svg/svg:image/@x', 6);
29     $this->assertAttrValueEquals($doc, '/svg:svg/svg:image/@y', 7);
30   }
31
32 }
33
Note: See TracBrowser for help on using the browser.