Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Unit test for HTML-like labels and ports
3
--FILE--
4
<?php
5
 
6
/**
7
 * Test 2: "HTML-like labels"
8
 *
9
 * Graph definition taken from GraphViz documentation
10
 *
11
 * @category Image
12
 * @package  Image_GraphViz
13
 * @author   Philippe Jausions <jausions@php.net>
14
 * @version  $Id: test2.phpt 247212 2007-11-28 00:25:10Z jausions $
15
 */
16
require_once 'Image/GraphViz.php';
17
 
18
$graph = new Image_GraphViz(true, null, 'structs', false);
19
 
20
$graph->addNode('struct1', array(
21
    'shape' => 'plaintext',
22
    'label' => '<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
23
   <TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR>
24
</TABLE>'));
25
 
26
$graph->addNode('struct2', array(
27
    'shape' => 'plaintext',
28
    'label' => '<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
29
   <TR><TD PORT="f0">one</TD><TD>two</TD></TR>
30
</TABLE>'));
31
 
32
$graph->addNode('struct3', array(
33
    'shape' => 'plaintext',
34
    'label' => '<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
35
   <TR>
36
      <TD ROWSPAN="3">hello<BR/>world</TD>
37
      <TD COLSPAN="3">b</TD>
38
      <TD ROWSPAN="3">g</TD>
39
      <TD ROWSPAN="3">h</TD>
40
   </TR>
41
   <TR>
42
      <TD>c</TD><TD PORT="here">d</TD><TD>e</TD>
43
   </TR>
44
   <TR>
45
      <TD COLSPAN="3">f</TD>
46
   </TR>
47
</TABLE>'));
48
 
49
$graph->addEdge(array('struct1' => 'struct2'), null, array('struct1' => 'f1',
50
                                                           'struct2' => 'f0'));
51
 
52
$graph->addEdge(array('struct1' => 'struct3'), null, array('struct1' => 'f2',
53
                                                           'struct3' => 'here'));
54
echo $graph->parse();
55
 
56
?>
57
--EXPECT--
58
digraph structs {
59
    struct1 [ shape=plaintext,label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
60
   <TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR>
61
</TABLE>> ];
62
    struct2 [ shape=plaintext,label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
63
   <TR><TD PORT="f0">one</TD><TD>two</TD></TR>
64
</TABLE>> ];
65
    struct3 [ shape=plaintext,label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
66
   <TR>
67
      <TD ROWSPAN="3">hello<BR/>world</TD>
68
      <TD COLSPAN="3">b</TD>
69
      <TD ROWSPAN="3">g</TD>
70
      <TD ROWSPAN="3">h</TD>
71
   </TR>
72
   <TR>
73
      <TD>c</TD><TD PORT="here">d</TD><TD>e</TD>
74
   </TR>
75
   <TR>
76
      <TD COLSPAN="3">f</TD>
77
   </TR>
78
</TABLE>> ];
79
    struct1:f1 -> struct2:f0;
80
    struct1:f2 -> struct3:here;
81
}