Release 2.0.1, merged in 1181 to HEAD.
[htmlpurifier.git] / tests / HTMLPurifier / AttrDef / HTML / PixelsTest.php
blob6fa899bfdc8a10c8234482e9ecdd268ad60e3491
1 <?php
3 require_once 'HTMLPurifier/AttrDefHarness.php';
4 require_once 'HTMLPurifier/AttrDef/HTML/Pixels.php';
6 class HTMLPurifier_AttrDef_HTML_PixelsTest extends HTMLPurifier_AttrDefHarness
9 function setup() {
10 $this->def = new HTMLPurifier_AttrDef_HTML_Pixels();
13 function test() {
15 $this->assertDef('1');
16 $this->assertDef('0');
18 $this->assertDef('2px', '2'); // rm px suffix
20 $this->assertDef('dfs', false); // totally invalid value
22 // conceivably we could repair this value, but we won't for now
23 $this->assertDef('9in', false);
25 // test trim
26 $this->assertDef(' 45 ', '45');
28 // no negatives
29 $this->assertDef('-2', '0');
31 // remove empty
32 $this->assertDef('', false);
34 // round down
35 $this->assertDef('4.9', '4');