2006-08-13 23:08:38 +00:00
|
|
|
<?php
|
|
|
|
|
2007-02-14 20:38:51 +00:00
|
|
|
class HTMLPurifier_AttrDef_CSS_LengthTest extends HTMLPurifier_AttrDefHarness
|
2006-08-13 23:08:38 +00:00
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function test()
|
|
|
|
{
|
2007-02-14 20:38:51 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_Length();
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
$this->assertDef('0');
|
|
|
|
$this->assertDef('0px');
|
|
|
|
$this->assertDef('4.5px');
|
|
|
|
$this->assertDef('-4.5px');
|
|
|
|
$this->assertDef('3ex');
|
|
|
|
$this->assertDef('3em');
|
|
|
|
$this->assertDef('3in');
|
|
|
|
$this->assertDef('3cm');
|
|
|
|
$this->assertDef('3mm');
|
|
|
|
$this->assertDef('3pt');
|
|
|
|
$this->assertDef('3pc');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
$this->assertDef('3PX', '3px');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
$this->assertDef('3', false);
|
|
|
|
$this->assertDef('3miles', false);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testNonNegative()
|
|
|
|
{
|
2008-05-21 01:56:48 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_Length('0');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
$this->assertDef('3cm');
|
|
|
|
$this->assertDef('-3mm', false);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testBounding()
|
|
|
|
{
|
2008-05-21 01:56:48 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_Length('-1in', '1in');
|
|
|
|
$this->assertDef('1cm');
|
|
|
|
$this->assertDef('-1cm');
|
|
|
|
$this->assertDef('0');
|
|
|
|
$this->assertDef('1em', false);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|