lib/Weathermap/Tests/HTML_ImageMap_Area_CircleTest.php
<?php
// require_once 'PHPUnit/Framework.php';
namespace Weathermap\Tests;
//require_once dirname(__FILE__) . '/../lib/HTMLImagemap.php';
use Weathermap\Core\HTMLImagemapAreaCircle;
/**
* Test class for HTML_Imagemap_Area_Circle.
* Generated by PHPUnit on 2010-04-06 at 14:29:42.
*/
class HTMLImagemapAreaCircleTest extends \PHPUnit_Framework_TestCase
{
/**
* @var HTMLImagemapAreaCircle
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new HTMLImagemapAreaCircle(array(array(100, 100, 150, 100)), "testname", "testhref");
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* @todo Implement testAsHTML().
*/
public function testAsHTML()
{
// Remove the following lines when you implement this test.
$output = $this->object->asHTML();
$this->assertEquals('<area id="testname" href="testhref" shape="circle" coords="100,100,150,100" />', $output);
}
/**
* @todo Implement testHitTest().
*/
public function testHitTest()
{
$points = array(
array(100, 100, true),
array(51, 100, true),
array(149, 100, true),
array(100, 149, true),
array(100, 51, true),
array(49, 49, false),
array(49, 100, false),
array(100, 151, false),
array(149, 149, false)
);
foreach ($points as $point) {
$desc = sprintf("Hit %d,%d", $point[0], $point[1]);
$this->assertEquals($point[2], $this->object->hitTest($point[0], $point[1]), $desc);
}
}
}