Changeset 2270

Show
Ignore:
Timestamp:
03/16/08 08:30:15 (2 months ago)
Author:
wrobe..@pld-linux.org
Message:

- added test case for navigability changes of association end connected to

an actor

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/trunk/gaphor/diagram/classes/tests/test_association.py

    r2262 r2270  
    88from gaphor import UML 
    99from gaphor.diagram.items import AssociationItem, ClassItem, InterfaceItem, \ 
    10     UseCaseItem 
     10    UseCaseItem, ActorItem 
    1111from gaphor.diagram.interfaces import IConnect 
    1212from gaphas import View 
     
    134134 
    135135 
    136     def test_navigability_at_classifier(self): 
    137         """Test association end navigability connected to any classifier""" 
     136    def test_navigability_at_usecase(self): 
     137        """Test association end navigability connected to an usecase""" 
    138138        c1 = self.create(UseCaseItem, UML.UseCase) 
    139139        c2 = self.create(UseCaseItem, UML.UseCase) 
     
    164164        assert head.subject.owningAssociation is None 
    165165 
     166 
     167    def test_navigability_at_actor(self): 
     168        """Test association end navigability connected to an actor""" 
     169        c1 = self.create(ActorItem, UML.Actor) 
     170        c2 = self.create(ActorItem, UML.Actor) 
     171 
     172        a = self.create(AssociationItem) 
     173 
     174        adapter = component.queryMultiAdapter((c1, a), IConnect) 
     175        assert adapter 
     176        adapter.connect(a.head) 
     177        assert a.head.connected_to 
     178 
     179        adapter = component.queryMultiAdapter((c2, a), IConnect) 
     180        adapter.connect(a.tail) 
     181        assert a.tail.connected_to 
     182 
     183        head = a._head_end 
     184 
     185        head.navigability = True 
     186        assert head.subject.classifier == c2.subject 
     187        assert head.subject.owningAssociation is None 
     188 
     189        head.navigability = False 
     190        assert head.subject.classifier is None 
     191        assert head.subject.owningAssociation == a.subject 
     192 
     193        head.navigability = None 
     194        assert head.subject.classifier is None 
     195        assert head.subject.owningAssociation is None 
     196 
     197 
     198 
    166199# vim:sw=4:et:ai