37 from python_qt_binding.QtWidgets
import QApplication
43 p = subprocess.Popen(sys.executable, stdin=subprocess.PIPE)
44 p.stdin.write(b
'from python_qt_binding.QtWidgets import QApplication\n')
45 p.stdin.write(b
'app = QApplication([])\n')
51 return p.returncode == 0
58 graph [bb="0,0,154,108", 62 subgraph cluster_foo { 63 graph [bb="1,1,100,101", 73 label=barbarbarbarbarbarbarbar, 77 foo -> bar [pos="e,77,36.104 77,71.697 77,63.983 77,54.712 77,46.112"]; 84 super(DotToQtGeneratorTest, self).
__init__(*args)
87 if DotToQtGeneratorTest._Q_APP
is None:
89 DotToQtGeneratorTest._Q_APP = QApplication([])
92 if DotToQtGeneratorTest._Q_APP
is None:
93 raise unittest.case.SkipTest
96 DotToQtGeneratorTest.DOT_CODE, 1)
97 self.assertEqual(3, len(nodes))
98 self.assertEqual(1, len(edges))
101 if DotToQtGeneratorTest._Q_APP
is None:
102 raise unittest.case.SkipTest
104 (nodes, edges) =
DotToQtGenerator().dotcode_to_qt_items(DotToQtGeneratorTest.DOT_CODE, 1)
107 for name, node
in nodes.items():
108 shape_rect = node._graphics_item.sceneBoundingRect()
109 label_rect = node._label.sceneBoundingRect()
113 "Label text for '%s' is wider than surrounding shape." % name)
117 "Label text for '%s' is higher than surrounding shape." % name)
120 self.assertEqual(
"foo",
get_unquoted({
'bar':
'foo'},
'bar'))
123 if DotToQtGeneratorTest._Q_APP
is None:
124 raise unittest.case.SkipTest
129 graph [bb="0,0,249,541", 137 subgraph "/Container" { 138 graph [bb="8,67,241,321", 150 subgraph "/Container/Subcontainer" { 151 graph [bb="84,142,233,287", 154 label="/Container/Subcontainer", 163 "/Container/Subcontainer/logstate1" [height=0.5, 169 "/Container/Subcontainer/finished" [color=blue, 176 "/Container/Subcontainer/logstate1" -> "/Container/Subcontainer/finished" [label=done, 178 pos="e,133,186.19 133,216.92 133,210.7 133,203.5 133,196.6", 181 "/Container/finished" [color=blue, 188 "/Container/Subcontainer/finished" -> "/Container/finished" [label=finished, 190 pos="e,96.623,110.5 122.33,150.44 116.39,141.19 108.85,129.5 102.19,119.15", 192 "/Container/logstate" [height=0.5, 198 "/Container/logstate" -> "/Container/finished" [label=done, 200 pos="e,74.304,110.45 53.482,149.8 57.712,140.5 63.287,128.93 69,119 69.051,118.91 69.102,118.82 69.153,118.74", 203 "/finished" [height=0.5, 206 "/Container/finished" -> "/finished" [label=finished, 208 pos="e,86,36.176 86,74.7 86,66.245 86,55.869 86,46.373", 210 "/start" -> "/Container/Subcontainer/logstate1" [ 212 pos="e,133,250.01 133,355.84 133,337.5 133,316.81 133,260.22", 214 "/start" -> "/Container/logstate" [ 216 pos="e,46,185.01 133,355.84 46,337.5 46,316.81 46,192.22", 218 "/start" [height=0.5, 224 (nodes, edges) = gen.dotcode_to_qt_items(dotcode, 1)
227 '"/Container/Subcontainer"',
'"/Container/finished"',
'"/start"',
'"/Container"',
228 '"/Container/Subcontainer/logstate1"',
'"/Container/Subcontainer/finished"',
229 '"/Container/logstate"',
'"/finished"']
231 '/Container/logstate_TO_/Container/finished_done',
232 '/Container/Subcontainer/finished_TO_/Container/finished_finished',
233 '/start_TO_/Container/Subcontainer/logstate1',
234 '/Container/finished_TO_/finished_finished',
235 '/start_TO_/Container/logstate',
236 '/Container/Subcontainer/logstate1_TO_/Container/Subcontainer/finished_done']
237 self.assertEqual(expected_nodes, nodes.keys())
238 self.assertEqual(expected_edges, edges.keys())
def test_simple_integration(self)
def get_unquoted(item, name)
def test_label_sizes(self)