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

Function TEST

Testing/OpenNITester/ProductionGraphEvents_Cpp.cpp:120–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120TEST(ContextTests_Cpp, TestNodeCreationEvent)
121{
122 XnStatus nRetVal = XN_STATUS_OK;
123
124 Context context;
125 nRetVal = context.Init();
126 ASSERT_EQ(XN_STATUS_OK, nRetVal);
127
128 // take random pointers as cookies
129 void* pHandler1Cookie = &context + 1;
130 void* pHandler2Cookie = &context + 2;
131
132 XnCallbackHandle hHandler1 = NULL;
133 XnCallbackHandle hHandler2 = NULL;
134
135 // register first handler
136 nRetVal = context.RegisterToNodeCreation(OnNodeCreation1, pHandler1Cookie, hHandler1);
137 ASSERT_EQ(XN_STATUS_OK, nRetVal);
138
139 TestCreation(context, pHandler1Cookie, NULL);
140
141 // register second one
142 nRetVal = context.RegisterToNodeCreation(OnNodeCreation2, pHandler2Cookie, hHandler2);
143 ASSERT_EQ(XN_STATUS_OK, nRetVal);
144
145 TestCreation(context, pHandler1Cookie, pHandler2Cookie);
146
147 // unregister first
148 context.UnregisterFromNodeCreation(hHandler1);
149 TestCreation(context, NULL, pHandler2Cookie);
150
151 // unregister second
152 context.UnregisterFromNodeCreation(hHandler2);
153 TestCreation(context, NULL, NULL);
154}
155
156void TestDestruction(Context& context, void* pHandler1Cookie, void* pHandler2Cookie)
157{

Callers

nothing calls this directly

Calls 3

TestCreationFunction · 0.70
TestDestructionFunction · 0.70
InitMethod · 0.45

Tested by

no test coverage detected