- ungroup activity nodes when subpartition is removed from its parent
partition
This commit is contained in:
parent
12c766d4f9
commit
21658eeeaf
@ -225,6 +225,15 @@ class ActivityPartitionsGroup(AbstractGroup):
|
||||
self.item.subject = None
|
||||
for s in sp.subpartition:
|
||||
sp.subpartition.remove(s)
|
||||
|
||||
# ungroup activity nodes
|
||||
canvas = self.item.canvas
|
||||
nodes = [n for n in canvas.get_children(self.item) if
|
||||
isinstance(n, (items.ActivityNodeItem, items.ActionItem, items.ObjectNodeItem, items.ForkNodeItem))]
|
||||
for n in nodes:
|
||||
canvas.reparent(n, None)
|
||||
sp.node.remove(n.subject)
|
||||
|
||||
sp.unlink()
|
||||
|
||||
|
||||
|
@ -251,6 +251,30 @@ class PartitionGroupTestCase(TestCase):
|
||||
self.assertEquals(0, len(self.kindof(UML.ActivityPartition)))
|
||||
|
||||
|
||||
def test_ungrouping_with_actions(self):
|
||||
"""Test subpartition with actions removal
|
||||
"""
|
||||
p1 = self.create(items.PartitionItem)
|
||||
p2 = self.create(items.PartitionItem)
|
||||
a1 = self.create(items.ActionItem, UML.Action)
|
||||
a2 = self.create(items.ActionItem, UML.Action)
|
||||
|
||||
self.group(p1, p2)
|
||||
|
||||
# group to p2, it is disallowed to p1
|
||||
self.group(p2, a1)
|
||||
self.group(p2, a2)
|
||||
|
||||
partition = p2.subject
|
||||
assert len(partition.node) == 2, partition.node
|
||||
assert 2 == len(p2.canvas.get_children(p2)), p2.canvas.get_children(p2)
|
||||
|
||||
self.ungroup(p1, p2)
|
||||
|
||||
self.assertEquals(0, len(partition.node))
|
||||
self.assertEquals(0, len(p2.canvas.get_children(p2)))
|
||||
|
||||
|
||||
def test_nested_subpartition_ungrouping(self):
|
||||
"""Test removal of subpartition with swimlanes
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user