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
|
|
|
{
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
|
2007-02-14 20:38:51 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_Length();
|
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');
|
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
$this->assertDef('3PX', '3px');
|
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
$this->assertDef('3', false);
|
|
|
|
$this->assertDef('3miles', false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testNonNegative() {
|
|
|
|
|
2008-05-21 01:56:48 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_Length('0');
|
2006-08-13 23:08:38 +00:00
|
|
|
|
|
|
|
$this->assertDef('3cm');
|
|
|
|
$this->assertDef('-3mm', false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-05-21 01:56:48 +00:00
|
|
|
function testBounding() {
|
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_Length('-1in', '1in');
|
|
|
|
$this->assertDef('1cm');
|
|
|
|
$this->assertDef('-1cm');
|
|
|
|
$this->assertDef('0');
|
|
|
|
$this->assertDef('1em', false);
|
|
|
|
}
|
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
}
|
|
|
|
|