Replacing string "neco" by "nepi"
[nepi.git] / test / util / plot.py
1 #!/usr/bin/env python
2
3 from nepi.design.box import Box 
4 from nepi.util.plot import Plotter
5
6 import subprocess
7 import unittest
8
9 class BoxPlotTestCase(unittest.TestCase):
10     def xtest_plot(self):
11         """ XXX: This test is interactive, it will open an evince instance,
12         so it should not run automatically """
13         node1 = Box(label="node1")
14         ping1 = Box(label="ping")
15         mobility1 = Box(label="mob1")
16         node2 = Box(label="node2")
17         mobility2 = Box(label="mob2")
18         iface1 = Box(label="iface1")
19         iface2 = Box(label="iface2")
20         channel = Box(label="chan")
21
22         node1.connect(ping1)
23         node1.connect(mobility1)
24         node1.connect(iface1)
25         channel.connect(iface1)
26         channel.connect(iface2)
27         node2.connect(iface2)
28         node2.connect(mobility2)
29
30         plotter = Plotter(node1)
31         fname = plotter.plot()
32         subprocess.call(["dot", "-Tps", fname, "-o", "%s.ps"%fname])
33         subprocess.call(["evince","%s.ps"%fname])
34        
35 if __name__ == '__main__':
36     unittest.main()
37