MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / TEST

Function TEST

Testing/OpenNITester/ProductionGraphEvents_C.cpp:117–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117TEST(ContextTests_C, TestNodeCreationEvent)
118{
119 XnStatus nRetVal = XN_STATUS_OK;
120
121 XnContext* pContext = NULL;
122 nRetVal = xnInit(&pContext);
123 ASSERT_EQ(XN_STATUS_OK, nRetVal);
124
125 // take random pointers as cookies
126 void* pHandler1Cookie = (XnChar*)pContext + 1;
127 void* pHandler2Cookie = (XnChar*)pContext + 2;
128
129 XnCallbackHandle hHandler1 = NULL;
130 XnCallbackHandle hHandler2 = NULL;
131
132 // register first handler
133 nRetVal = xnRegisterToNodeCreation(pContext, OnNodeCreation1, pHandler1Cookie, &hHandler1);
134 ASSERT_EQ(XN_STATUS_OK, nRetVal);
135
136 TestCreation(pContext, pHandler1Cookie, NULL);
137
138 // register second one
139 nRetVal = xnRegisterToNodeCreation(pContext, OnNodeCreation2, pHandler2Cookie, &hHandler2);
140 ASSERT_EQ(XN_STATUS_OK, nRetVal);
141
142 TestCreation(pContext, pHandler1Cookie, pHandler2Cookie);
143
144 // unregister first
145 xnUnregisterFromNodeCreation(pContext, hHandler1);
146 TestCreation(pContext, NULL, pHandler2Cookie);
147
148 // unregister second
149 xnUnregisterFromNodeCreation(pContext, hHandler2);
150 TestCreation(pContext, NULL, NULL);
151}
152
153void TestDestruction(XnContext* pContext, void* pHandler1Cookie, void* pHandler2Cookie)
154{

Callers

nothing calls this directly

Calls 7

xnInitFunction · 0.85
xnRegisterToNodeCreationFunction · 0.85
TestCreationFunction · 0.70
TestDestructionFunction · 0.70

Tested by

no test coverage detected