MCPcopy Create free account
hub / github.com/Kitware/VTK / testGetCommand

Method testGetCommand

Common/Core/Testing/Python/TestCommand.py:89–104  ·  view source on GitHub ↗

Test getting the vtkCommand object

(self)

Source from the content-addressed store, hash-verified

87 self.assertEqual(cb.caller, None)
88
89 def testGetCommand(self):
90 """Test getting the vtkCommand object
91 """
92 cb = callback()
93 o = vtkObject()
94 n = o.AddObserver(vtkCommand.ModifiedEvent, cb)
95 o.Modified()
96 self.assertEqual(cb.caller, o)
97 c = o.GetCommand(n)
98 self.assertEqual((c.IsA("vtkCommand") != 0), True)
99 # in the future, o.RemoveObserver(c) should also be made to work
100 o.RemoveObserver(n)
101 cb.caller = None
102 cb.event = None
103 o.Modified()
104 self.assertEqual(cb.caller, None)
105
106 def testCommandCircularRef(self):
107 """Test correct reference loop reporting for commands

Callers

nothing calls this directly

Calls 7

GetCommandMethod · 0.80
IsAMethod · 0.80
callbackClass · 0.70
vtkObjectClass · 0.50
AddObserverMethod · 0.45
ModifiedMethod · 0.45
RemoveObserverMethod · 0.45

Tested by

no test coverage detected