|
|
@@ -2,25 +2,15 @@
|
|
|
|
|
|
#include <cr.h>
|
|
|
#include <gtest/gtest.h>
|
|
|
+#include <entt/core/type_info.hpp>
|
|
|
#include <entt/signal/emitter.hpp>
|
|
|
-#include "proxy.h"
|
|
|
#include "types.h"
|
|
|
|
|
|
-proxy::proxy(test_emitter &ref)
|
|
|
- : emitter{&ref}
|
|
|
-{}
|
|
|
-
|
|
|
-void proxy::publish(message msg) {
|
|
|
- emitter->publish<message>(msg);
|
|
|
-}
|
|
|
-
|
|
|
-void proxy::publish(event ev) {
|
|
|
- emitter->publish<event>(ev);
|
|
|
-}
|
|
|
+template<typename Type>
|
|
|
+struct entt::type_index<Type> {};
|
|
|
|
|
|
TEST(Lib, Emitter) {
|
|
|
test_emitter emitter;
|
|
|
- proxy handler{emitter};
|
|
|
int value{};
|
|
|
|
|
|
ASSERT_EQ(value, 0);
|
|
|
@@ -28,11 +18,12 @@ TEST(Lib, Emitter) {
|
|
|
emitter.once<message>([&](message msg, test_emitter &) { value = msg.payload; });
|
|
|
|
|
|
cr_plugin ctx;
|
|
|
- ctx.userdata = &handler;
|
|
|
+ ctx.userdata = &emitter;
|
|
|
cr_plugin_load(ctx, PLUGIN);
|
|
|
cr_plugin_update(ctx);
|
|
|
|
|
|
ASSERT_EQ(value, 42);
|
|
|
|
|
|
+ emitter = {};
|
|
|
cr_plugin_close(ctx);
|
|
|
}
|