| 115 | } |
| 116 | |
| 117 | TEST(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 | |
| 153 | void TestDestruction(XnContext* pContext, void* pHandler1Cookie, void* pHandler2Cookie) |
| 154 | { |
nothing calls this directly
no test coverage detected