Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
class TestImgAlign extends GenericTest {
4
  function TestImgAlign1() {
5
    $tree = $this->runPipeline('
6
<span id="span" style="background: yellow;">
7
<span id="text">text</span>
8
<img id="img" style="background: red;" width="50" height="50">
9
<span>
10
');
11
 
12
    $span = $tree->get_element_by_id('span');
13
    $text = $tree->get_element_by_id('text');
14
    $img  = $tree->get_element_by_id('img');
15
 
16
    $this->assertTrue($span->get_bottom_margin() <= $text->get_bottom_margin(),
17
                      sprintf('Span bottom margin (%s) should be less than text bottom margin (%s)',
18
                              $span->get_bottom_margin(),
19
                              $text->get_bottom_margin()));
20
    $this->assertTrue($span->get_bottom_margin() <= $img->get_bottom_margin(),
21
                      sprintf('Span bottom margin (%s) should be less than image bottom margin (%s)',
22
                              $span->get_bottom_margin(),
23
                              $img->get_bottom_margin()));
24
    $this->assertTrue($span->get_top_margin() >= $text->get_top_margin(),
25
                      sprintf('Span top margin (%s) should be greater than text top margin (%s)',
26
                              $span->get_top_margin(),
27
                              $text->get_top_margin()));
28
    $this->assertTrue($span->get_top_margin() >= $img->get_top_margin(),
29
                      sprintf('Span top margin (%s) should be greater than image top margin (%s)',
30
                              $span->get_top_margin(),
31
                              $img->get_top_margin()));
32
    $this->assertTrue($text->get_bottom_margin() <= $img->get_bottom_margin(),
33
                      sprintf('Text bottom margin (%s) should be less than image bottom margin (%s)',
34
                              $text->get_bottom_margin(),
35
                              $img->get_bottom_margin()));
36
    $this->assertTrue($text->get_top_margin() < $img->get_top_margin(),
37
                      sprintf('Text top margin (%s) should be less than image top margin (%s)',
38
                              $text->get_top_margin(),
39
                              $img->get_top_margin()));
40
  }
41
 
42
  function TestImgAlign2() {
43
    $tree = $this->runPipeline('
44
<span id="span" style="background: yellow;">
45
<input id="text" value="Search" style="font-size: 12px;" type="submit">
46
<img id="img" style="background: red;" width="50" height="50">
47
<span>
48
');
49
 
50
    $span = $tree->get_element_by_id('span');
51
    $text = $tree->get_element_by_id('text');
52
    $img  = $tree->get_element_by_id('img');
53
 
54
    $this->assertTrue($span->get_bottom_margin() <= $text->get_bottom_margin(),
55
                      sprintf('Span bottom margin (%s) should be less than text bottom margin (%s)',
56
                              $span->get_bottom_margin(),
57
                              $text->get_bottom_margin()));
58
    $this->assertTrue($span->get_bottom_margin() <= $img->get_bottom_margin(),
59
                      sprintf('Span bottom margin (%s) should be less than image bottom margin (%s)',
60
                              $span->get_bottom_margin(),
61
                              $img->get_bottom_margin()));
62
    $this->assertTrue($span->get_top_margin() >= $text->get_top_margin(),
63
                      sprintf('Span top margin (%s) should be greater than text top margin (%s)',
64
                              $span->get_top_margin(),
65
                              $text->get_top_margin()));
66
    $this->assertTrue($span->get_top_margin() >= $img->get_top_margin(),
67
                      sprintf('Span top margin (%s) should be greater than image top margin (%s)',
68
                              $span->get_top_margin(),
69
                              $img->get_top_margin()));
70
    $this->assertTrue($text->get_bottom_margin() <= $img->get_bottom_margin(),
71
                      sprintf('Text bottom margin (%s) should be less than image bottom margin (%s)',
72
                              $text->get_bottom_margin(),
73
                              $img->get_bottom_margin()));
74
    $this->assertTrue($text->get_top_margin() < $img->get_top_margin(),
75
                      sprintf('Text top margin (%s) should be less than image top margin (%s)',
76
                              $text->get_top_margin(),
77
                              $img->get_top_margin()));
78
  }
79
}
80
 
81
?>