- test combining flow (it should change from/to object flow when there are

any incoming or outgoing object flows)


git-svn-id: file:///Users/arjan/backup/gaphor/trunk/gaphor@597 a8418922-720d-0410-834f-a69b97ada669
This commit is contained in:
wrobell 2005-10-24 19:36:54 +00:00
parent e6f6e499cd
commit e7adf9b7c8

View File

@ -116,5 +116,66 @@ class TestActivityNodes(gaphortests.TestCase):
self.assert_(f1.subject not in dnode.subject.incoming)
def testCombinedObjectNodes(self):
"""
Test if combining flow in combined node is object flow when one of
incoming or outgoing flows is object flow.
"""
# test for outgoing flows
dnode = self.createDecisionNode()
f1 = self.createFlow()
f2 = self.createFlow()
f3 = self.createFlow()
f4 = self.createFlow()
a1 = self.createActionItem()
a2 = self.createActionItem()
a3 = self.createActionItem()
on = self.createObjectNode()
self.connectNodes(a1, dnode, f1)
self.connectNodes(a2, dnode, f2)
self.connectNodes(dnode, a3, f3)
self.connectNodes(dnode, on, f4) # f4 is object flow
n1, n2 = self.checkCombinedNode(dnode)
# check if combining flow is object flow
self.assertEquals(n1.outgoing[0].__class__, UML.ObjectFlow)
# again, but for incoming flows
dnode = self.createDecisionNode()
f1 = self.createFlow()
f2 = self.createFlow()
f3 = self.createFlow()
f4 = self.createFlow()
on = self.createObjectNode()
a2 = self.createActionItem()
a3 = self.createActionItem()
a4 = self.createActionItem()
self.connectNodes(on, dnode, f1) # f1 is object flow
self.connectNodes(a2, dnode, f2)
self.connectNodes(dnode, a3, f3)
self.connectNodes(dnode, a4, f4)
n1, n2 = self.checkCombinedNode(dnode)
# check if combining flow is object flow
self.assertEquals(n1.outgoing[0].__class__, UML.ObjectFlow)
f5 = self.createFlow()
a5 = self.createActionItem()
self.connectNodes(a5, dnode, f5)
self.disconnectNodes(f1)
assert dnode.combined, 'test problem'
# still combined node, combining flow should be control flow
n1, n2 = self.checkCombinedNode(dnode)
self.assertEquals(n1.outgoing[0].__class__, UML.ControlFlow)
if __name__ == '__main__':
unittest.main()