| 118 | } |
| 119 | |
| 120 | TEST(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 | |
| 156 | void TestDestruction(Context& context, void* pHandler1Cookie, void* pHandler2Cookie) |
| 157 | { |
nothing calls this directly
no test coverage detected