aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinícius dos Santos Oliveira <vini.ipsmaker@expertisesolutions.com.br>2015-06-04 17:19:39 -0300
committerVinícius dos Santos Oliveira <vini.ipsmaker@expertisesolutions.com.br>2015-06-04 21:54:08 -0300
commitb299a3489e221d8b134c2e3711e4141a4875c9da (patch)
tree614b87c8a1c15500ee49d23bf50b67f11a9e27ab
parentupdated ecore_js to use v8::Isolate::GetCurrent() (diff)
downloadefl-b299a3489e221d8b134c2e3711e4141a4875c9da.tar.gz
Initial bindings for Ecore_Animator
-rw-r--r--src/Makefile_Ecore_Js.am6
-rw-r--r--src/bindings/ecore_js/ecore_js_animator.cc639
-rw-r--r--src/bindings/ecore_js/ecore_js_animator.hh122
-rw-r--r--src/tests/ecore_js/ecore_js_suite.cc100
-rwxr-xr-xsrc/tests/ecore_js/ecore_js_suite.js16
5 files changed, 881 insertions, 2 deletions
diff --git a/src/Makefile_Ecore_Js.am b/src/Makefile_Ecore_Js.am
index 7d3f831306..96d6afa196 100644
--- a/src/Makefile_Ecore_Js.am
+++ b/src/Makefile_Ecore_Js.am
@@ -26,7 +26,8 @@ bindings/ecore_js/ecore_js_mainloop.cc \
bindings/ecore_js/ecore_js_timer.cc \
bindings/ecore_js/ecore_js_event.cc \
bindings/ecore_js/ecore_js_job.cc \
-bindings/ecore_js/ecore_js_idle.cc
+bindings/ecore_js/ecore_js_idle.cc \
+bindings/ecore_js/ecore_js_animator.cc
ECORE_JS_TEST_CXXFLAGS = -I$(top_builddir)/src/lib/efl \
-DTESTS_WD=\"`pwd`\" \
@@ -48,7 +49,8 @@ bindings/ecore_js/ecore_js_mainloop.hh \
bindings/ecore_js/ecore_js_timer.hh \
bindings/ecore_js/ecore_js_event.hh \
bindings/ecore_js/ecore_js_job.hh \
-bindings/ecore_js/ecore_js_idle.hh
+bindings/ecore_js/ecore_js_idle.hh \
+bindings/ecore_js/ecore_js_animator.hh
### Unit tests
diff --git a/src/bindings/ecore_js/ecore_js_animator.cc b/src/bindings/ecore_js/ecore_js_animator.cc
new file mode 100644
index 0000000000..19ae5c30aa
--- /dev/null
+++ b/src/bindings/ecore_js/ecore_js_animator.cc
@@ -0,0 +1,639 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ecore_js_animator.hh>
+#include <Ecore.h>
+
+namespace efl { namespace ecore { namespace js {
+
+static Ecore_Animator* extract_animator(v8::Local<v8::Object> object)
+{
+ auto ptr = v8::External::Cast(*object->GetInternalField(0))->Value();
+ return reinterpret_cast<Ecore_Animator*>(ptr);
+}
+
+static v8::Local<v8::Object> wrap_animator(Ecore_Animator *animator,
+ v8::Isolate *isolate)
+{
+ using v8::Boolean;
+ using v8::String;
+ using v8::ObjectTemplate;
+ using v8::FunctionTemplate;
+
+ auto obj_tpl = compatibility_new<ObjectTemplate>(isolate);
+ obj_tpl->SetInternalFieldCount(1);
+ auto ret = obj_tpl->NewInstance();
+
+ auto del = [](compatibility_callback_info_type info)
+ -> compatibility_return_type {
+ if (info.Length() != 0)
+ return compatibility_return();
+
+ ecore_animator_del(extract_animator(info.This()));
+ };
+
+ auto freeze = [](compatibility_callback_info_type info)
+ -> compatibility_return_type {
+ if (info.Length() != 0)
+ return compatibility_return();
+
+ ecore_animator_freeze(extract_animator(info.This()));
+ };
+
+ auto thaw = [](compatibility_callback_info_type info)
+ -> compatibility_return_type {
+ if (info.Length() != 0)
+ return compatibility_return();
+
+ ecore_animator_thaw(extract_animator(info.This()));
+ };
+
+ ret->Set(compatibility_new<String>(isolate, "del"),
+ compatibility_new<FunctionTemplate>(isolate, del)->GetFunction());
+ ret->Set(compatibility_new<String>(isolate, "freeze"),
+ compatibility_new<FunctionTemplate>(isolate, freeze)
+ ->GetFunction());
+ ret->Set(compatibility_new<String>(isolate, "thaw"),
+ compatibility_new<FunctionTemplate>(isolate, thaw)->GetFunction());
+
+ ret->SetInternalField(0, compatibility_new<v8::External>(isolate,
+ animator));
+
+ return ret;
+}
+
+EAPI
+void register_pos_map_linear(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate, ECORE_POS_MAP_LINEAR));
+}
+
+EAPI
+void register_pos_map_accelerate(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate, ECORE_POS_MAP_ACCELERATE));
+}
+
+EAPI
+void register_pos_map_decelerate(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate, ECORE_POS_MAP_DECELERATE));
+}
+
+EAPI
+void register_pos_map_sinusoidal(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate, ECORE_POS_MAP_SINUSOIDAL));
+}
+
+EAPI
+void register_pos_map_accelerate_factor(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate,
+ ECORE_POS_MAP_ACCELERATE_FACTOR));
+}
+
+EAPI
+void register_pos_map_decelerate_factor(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate,
+ ECORE_POS_MAP_DECELERATE_FACTOR));
+}
+
+EAPI
+void register_pos_map_sinusoidal_factor(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate,
+ ECORE_POS_MAP_SINUSOIDAL_FACTOR));
+}
+
+EAPI
+void register_pos_map_divisor_interp(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate,
+ ECORE_POS_MAP_DIVISOR_INTERP));
+}
+
+EAPI
+void register_pos_map_bounce(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate, ECORE_POS_MAP_BOUNCE));
+}
+
+EAPI
+void register_pos_map_spring(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate, ECORE_POS_MAP_SPRING));
+}
+
+EAPI
+void register_pos_map_cubic_bezier(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate,
+ ECORE_POS_MAP_CUBIC_BEZIER));
+}
+
+EAPI
+void register_animator_source_timer(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate,
+ ECORE_ANIMATOR_SOURCE_TIMER));
+}
+
+EAPI
+void register_animator_source_custom(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+
+ global->Set(name,
+ compatibility_new<Integer>(isolate,
+ ECORE_ANIMATOR_SOURCE_CUSTOM));
+}
+
+EAPI
+void register_animator_frametime_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 1 || !args[0]->IsNumber())
+ return compatibility_return();
+
+ ecore_animator_frametime_set(args[0]->NumberValue());
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI
+void register_animator_frametime_get(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Number;
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 0)
+ return compatibility_return();
+
+ auto isolate = args.GetIsolate();
+ auto ret = ecore_animator_frametime_get();
+ return compatibility_return(compatibility_new<Number>(isolate, ret),
+ args);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI
+void register_animator_pos_map(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Number;
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 4 || !args[0]->IsNumber() || !args[1]->IsNumber()
+ || !args[2]->IsNumber() || !args[3]->IsNumber())
+ return compatibility_return();
+
+ Ecore_Pos_Map map;
+
+ switch ((int)(args[1]->NumberValue())) {
+ case ECORE_POS_MAP_LINEAR:
+ map = ECORE_POS_MAP_LINEAR;
+ break;
+ case ECORE_POS_MAP_ACCELERATE:
+ map = ECORE_POS_MAP_ACCELERATE;
+ break;
+ case ECORE_POS_MAP_DECELERATE:
+ map = ECORE_POS_MAP_DECELERATE;
+ break;
+ case ECORE_POS_MAP_SINUSOIDAL:
+ map = ECORE_POS_MAP_SINUSOIDAL;
+ break;
+ case ECORE_POS_MAP_ACCELERATE_FACTOR:
+ map = ECORE_POS_MAP_ACCELERATE_FACTOR;
+ break;
+ case ECORE_POS_MAP_DECELERATE_FACTOR:
+ map = ECORE_POS_MAP_DECELERATE_FACTOR;
+ break;
+ case ECORE_POS_MAP_SINUSOIDAL_FACTOR:
+ map = ECORE_POS_MAP_SINUSOIDAL_FACTOR;
+ break;
+ case ECORE_POS_MAP_DIVISOR_INTERP:
+ map = ECORE_POS_MAP_DIVISOR_INTERP;
+ break;
+ case ECORE_POS_MAP_BOUNCE:
+ map = ECORE_POS_MAP_BOUNCE;
+ break;
+ case ECORE_POS_MAP_SPRING:
+ map = ECORE_POS_MAP_SPRING;
+ break;
+ case ECORE_POS_MAP_CUBIC_BEZIER:
+ map = ECORE_POS_MAP_CUBIC_BEZIER;
+ break;
+ default:
+ return compatibility_return();
+ }
+
+ auto isolate = args.GetIsolate();
+ auto ret = ecore_animator_pos_map(args[0]->NumberValue(), map,
+ args[2]->NumberValue(),
+ args[3]->NumberValue());
+ return compatibility_return(compatibility_new<Number>(isolate, ret),
+ args);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI
+void register_animator_pos_map_n(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Number;
+ using v8::NumberObject;
+ using v8::FunctionTemplate;
+ using v8::Array;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 3 || !args[0]->IsNumber() || !args[1]->IsNumber()
+ || !args[2]->IsArray())
+ return compatibility_return();
+
+ Ecore_Pos_Map map;
+
+ switch ((int)(args[1]->NumberValue())) {
+ case ECORE_POS_MAP_LINEAR:
+ map = ECORE_POS_MAP_LINEAR;
+ break;
+ case ECORE_POS_MAP_ACCELERATE:
+ map = ECORE_POS_MAP_ACCELERATE;
+ break;
+ case ECORE_POS_MAP_DECELERATE:
+ map = ECORE_POS_MAP_DECELERATE;
+ break;
+ case ECORE_POS_MAP_SINUSOIDAL:
+ map = ECORE_POS_MAP_SINUSOIDAL;
+ break;
+ case ECORE_POS_MAP_ACCELERATE_FACTOR:
+ map = ECORE_POS_MAP_ACCELERATE_FACTOR;
+ break;
+ case ECORE_POS_MAP_DECELERATE_FACTOR:
+ map = ECORE_POS_MAP_DECELERATE_FACTOR;
+ break;
+ case ECORE_POS_MAP_SINUSOIDAL_FACTOR:
+ map = ECORE_POS_MAP_SINUSOIDAL_FACTOR;
+ break;
+ case ECORE_POS_MAP_DIVISOR_INTERP:
+ map = ECORE_POS_MAP_DIVISOR_INTERP;
+ break;
+ case ECORE_POS_MAP_BOUNCE:
+ map = ECORE_POS_MAP_BOUNCE;
+ break;
+ case ECORE_POS_MAP_SPRING:
+ map = ECORE_POS_MAP_SPRING;
+ break;
+ case ECORE_POS_MAP_CUBIC_BEZIER:
+ map = ECORE_POS_MAP_CUBIC_BEZIER;
+ break;
+ default:
+ return compatibility_return();
+ }
+
+ std::vector<double> v;
+ {
+ auto array = Array::Cast(*args[2]);
+ auto s = array->Length();
+ v.reserve(s);
+ for (decltype(s) i = 0;i != s;++i) {
+ auto e = array->Get(i);
+ if (!e->IsNumber())
+ return compatibility_return();
+
+ v.push_back(e->NumberValue());
+ }
+ }
+
+ auto isolate = args.GetIsolate();
+ auto ret = ecore_animator_pos_map_n(args[0]->NumberValue(), map,
+ v.size(), v.data());
+ return compatibility_return(compatibility_new<Number>(isolate, ret),
+ args);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI
+void register_animator_source_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 1 || !args[0]->IsNumber())
+ return compatibility_return();
+
+ Ecore_Animator_Source source;
+
+ switch ((int)(args[0]->NumberValue())) {
+ case ECORE_ANIMATOR_SOURCE_TIMER:
+ source = ECORE_ANIMATOR_SOURCE_TIMER;
+ break;
+ case ECORE_ANIMATOR_SOURCE_CUSTOM:
+ source = ECORE_ANIMATOR_SOURCE_CUSTOM;
+ break;
+ default:
+ return compatibility_return();
+ }
+
+ ecore_animator_source_set(source);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI
+void register_animator_source_get(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Integer;
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 0)
+ return compatibility_return();
+
+ auto isolate = args.GetIsolate();
+ auto ret = ecore_animator_source_get();
+ return compatibility_return(compatibility_new<Integer>(isolate, ret),
+ args);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+static
+compatibility_persistent<v8::Value> animator_custom_source_tick_begin_cb_data;
+static
+compatibility_persistent<v8::Value> animator_custom_source_tick_end_cb_data;
+
+EAPI void
+register_animator_custom_source_tick_begin_callback_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object>
+ global,
+ v8::Handle<v8::String>
+ name)
+{
+ using v8::FunctionCallbackInfo;
+ using v8::Value;
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args) {
+ if (args.Length() != 1 || !args[0]->IsFunction())
+ return compatibility_return();
+
+ animator_custom_source_tick_begin_cb_data
+ = compatibility_persistent<Value>(args.GetIsolate(), args[0]);
+ ecore_animator_custom_source_tick_begin_callback_set([](void*) {
+ using v8::Function;
+ using v8::Undefined;
+ using v8::Isolate;
+
+ auto isolate = Isolate::GetCurrent();
+ Function::Cast(*animator_custom_source_tick_begin_cb_data
+ .handle())->Call(Undefined(isolate), 0, NULL);
+ }, NULL);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI void
+register_animator_custom_source_tick_end_callback_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object>
+ global,
+ v8::Handle<v8::String>
+ name)
+{
+ using v8::FunctionCallbackInfo;
+ using v8::Value;
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args) {
+ if (args.Length() != 1 || !args[0]->IsFunction())
+ return compatibility_return();
+
+ animator_custom_source_tick_end_cb_data
+ = compatibility_persistent<Value>(args.GetIsolate(), args[0]);
+ ecore_animator_custom_source_tick_end_callback_set([](void*) {
+ using v8::Function;
+ using v8::Undefined;
+ using v8::Isolate;
+
+ auto isolate = Isolate::GetCurrent();
+ Function::Cast(*animator_custom_source_tick_end_cb_data
+ .handle())->Call(Undefined(isolate), 0, NULL);
+ }, NULL);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI void
+register_animator_custom_tick(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::FunctionCallbackInfo;
+ using v8::Value;
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args) {
+ if (args.Length() != 0)
+ return compatibility_return();
+
+ ecore_animator_custom_tick();
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI
+void register_animator_add(v8::Isolate *isolate, v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Local;
+ using v8::Value;
+ using v8::Undefined;
+ using v8::Function;
+ using v8::FunctionTemplate;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 1 || !args[0]->IsFunction())
+ return compatibility_return();
+
+ auto isolate = args.GetIsolate();
+ auto f = new compatibility_persistent<Value>(isolate, args[0]);
+
+ auto cb = [](void *data) -> Eina_Bool {
+ auto persistent
+ = reinterpret_cast<compatibility_persistent<Value>*>(data);
+ auto closure = Function::Cast(*persistent->handle());
+
+ auto ret = closure->Call(Undefined(v8::Isolate::GetCurrent()), 0,
+ NULL);
+ auto bret = ret->IsBoolean() && ret->BooleanValue();
+
+ if (!bret)
+ delete persistent;
+
+ return bret ? EINA_TRUE : EINA_FALSE;
+ };
+
+ auto ret = ecore_animator_add(cb, f);
+ return compatibility_return(wrap_animator(ret, isolate), args);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+EAPI
+void register_animator_timeline_add(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name)
+{
+ using v8::Handle;
+ using v8::Local;
+ using v8::Value;
+ using v8::Undefined;
+ using v8::Function;
+ using v8::FunctionTemplate;
+ using v8::Number;
+
+ auto f = [](compatibility_callback_info_type args)
+ -> compatibility_return_type {
+ if (args.Length() != 2 || !args[0]->IsNumber()
+ || !args[1]->IsFunction()) {
+ return compatibility_return();
+ }
+
+ compatibility_persistent<Value> *f
+ = new compatibility_persistent<Value>(args.GetIsolate(), args[1]);
+
+ auto cb = [](void *data, double pos) -> Eina_Bool {
+ auto persistent
+ = reinterpret_cast<compatibility_persistent<Value>*>(data);
+ auto closure = Function::Cast(*persistent->handle());
+ auto isolate = v8::Isolate::GetCurrent();
+
+ Handle<Value> args = compatibility_new<Number>(isolate, pos);
+
+ auto ret = closure->Call(Undefined(isolate), 1, &args);
+ auto bret = ret->IsBoolean() && ret->BooleanValue();
+
+ if (!bret)
+ delete persistent;
+
+ return bret ? EINA_TRUE : EINA_FALSE;
+ };
+
+ auto ret = ecore_animator_timeline_add(args[0]->NumberValue(), cb, f);
+ return compatibility_return(wrap_animator(ret, args.GetIsolate()),
+ args);
+ };
+
+ global->Set(name,
+ compatibility_new<FunctionTemplate>(isolate, f)->GetFunction());
+}
+
+} } } // namespace efl { namespace js {
diff --git a/src/bindings/ecore_js/ecore_js_animator.hh b/src/bindings/ecore_js/ecore_js_animator.hh
new file mode 100644
index 0000000000..6a8167f452
--- /dev/null
+++ b/src/bindings/ecore_js/ecore_js_animator.hh
@@ -0,0 +1,122 @@
+#ifndef ECORE_JS_ANIMATOR_HH
+#define ECORE_JS_ANIMATOR_HH
+
+#include <Eina.hh>
+#include EINA_STRINGIZE(V8_INCLUDE_HEADER)
+
+#include <eina_js_compatibility.hh>
+
+namespace efl { namespace ecore { namespace js {
+
+using ::efl::eina::js::compatibility_new;
+using ::efl::eina::js::compatibility_return_type;
+using ::efl::eina::js::compatibility_callback_info_type;
+using ::efl::eina::js::compatibility_return;
+using ::efl::eina::js::compatibility_get_pointer_internal_field;
+using ::efl::eina::js::compatibility_set_pointer_internal_field;
+using ::efl::eina::js::compatibility_persistent;
+
+void register_pos_map_linear(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_accelerate(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_decelerate(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_sinusoidal(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_accelerate_factor(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_decelerate_factor(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_sinusoidal_factor(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_divisor_interp(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_bounce(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_spring(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_pos_map_cubic_bezier(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_source_timer(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_source_custom(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_frametime_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_frametime_get(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_pos_map(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_pos_map_n(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_source_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_source_get(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void
+register_animator_custom_source_tick_begin_callback_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object>
+ global,
+ v8::Handle<v8::String>
+ name);
+
+void
+register_animator_custom_source_tick_end_callback_set(v8::Isolate *isolate,
+ v8::Handle<v8::Object>
+ global,
+ v8::Handle<v8::String>
+ name);
+
+void register_animator_custom_tick(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_add(v8::Isolate *isolate, v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+void register_animator_timeline_add(v8::Isolate *isolate,
+ v8::Handle<v8::Object> global,
+ v8::Handle<v8::String> name);
+
+} } } // namespace efl { namespace ecore { namespace js {
+
+#endif /* ECORE_JS_ANIMATOR_HH */
diff --git a/src/tests/ecore_js/ecore_js_suite.cc b/src/tests/ecore_js/ecore_js_suite.cc
index 2eb0c6c48f..ba143e7166 100644
--- a/src/tests/ecore_js/ecore_js_suite.cc
+++ b/src/tests/ecore_js/ecore_js_suite.cc
@@ -19,6 +19,7 @@
#include <ecore_js_event.hh>
#include <ecore_js_job.hh>
#include <ecore_js_idle.hh>
+#include <ecore_js_animator.hh>
const char* ToCString(const v8::String::Utf8Value& value) {
return *value ? *value : "<string conversion failed>";
@@ -268,6 +269,105 @@ void test_setup(v8::Handle<v8::Object> exports)
compatibility_new<String>(isolate,
"ecore_idle_exiter_add"));
+ // animator
+ register_pos_map_linear(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP_LINEAR"));
+ register_pos_map_accelerate(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP"
+ "_ACCELERATE"));
+ register_pos_map_decelerate(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP"
+ "_DECELERATE"));
+ register_pos_map_sinusoidal(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP"
+ "_SINUSOIDAL"));
+ register_pos_map_accelerate_factor(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP"
+ "_ACCELERATE"
+ "_FACTOR"));
+ register_pos_map_decelerate_factor(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP"
+ "_DECELERATE"
+ "_FACTOR"));
+ register_pos_map_sinusoidal_factor(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP"
+ "_SINUSOIDAL"
+ "_FACTOR"));
+ register_pos_map_divisor_interp(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP"
+ "_DIVISOR_INTERP"));
+ register_pos_map_bounce(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP_BOUNCE"));
+ register_pos_map_spring(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP_SPRING"));
+ register_pos_map_cubic_bezier(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_POS_MAP_CUBIC"
+ "_BEZIER"));
+ register_animator_source_timer(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_ANIMATOR"
+ "_SOURCE_TIMER"));
+ register_animator_source_custom(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ECORE_ANIMATOR"
+ "_SOURCE_CUSTOM"));
+ register_animator_frametime_set(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator"
+ "_frametime_set"));
+ register_animator_frametime_get(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator"
+ "_frametime_get"));
+ register_animator_pos_map(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator_pos"
+ "_map"));
+ register_animator_pos_map_n(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator_pos_map"
+ "_n"));
+ register_animator_source_set(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator_source"
+ "_set"));
+ register_animator_source_get(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator_source"
+ "_get"));
+ register_animator_custom_source_tick_begin_callback_set
+ (isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator_custom_source_tick_begin"
+ "_callback_set"));
+ register_animator_custom_source_tick_end_callback_set
+ (isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator_custom_source_tick_end"
+ "_callback_set"));
+ register_animator_custom_tick(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator"
+ "_custom_tick"));
+ register_animator_add(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator_add"));
+ register_animator_timeline_add(isolate, exports,
+ compatibility_new<String>(isolate,
+ "ecore_animator"
+ "_timeline_add"));
+
std::cerr << __LINE__ << std::endl;
}
diff --git a/src/tests/ecore_js/ecore_js_suite.js b/src/tests/ecore_js/ecore_js_suite.js
index 5baa2941cf..e471bf4854 100755
--- a/src/tests/ecore_js/ecore_js_suite.js
+++ b/src/tests/ecore_js/ecore_js_suite.js
@@ -256,6 +256,22 @@ assert(captured[2] === 3);
assert(captured[3] === 1);
assert(captured[4] === 5);
+// Ecore animator
+
+suite.ecore_animator_frametime_set(1);
+assert(suite.ecore_animator_frametime_get() === 1);
+suite.ecore_animator_frametime_set(1 / 50);
+assert(suite.ecore_animator_frametime_get() === (1 / 50));
+
+assert(suite.ecore_animator_pos_map(0.5, suite.ECORE_POS_MAP_LINEAR, 0, 0)
+ === 0.5);
+
+suite.ecore_animator_source_set(suite.ECORE_ANIMATOR_SOURCE_CUSTOM);
+assert(suite.ecore_animator_source_get()
+ === suite.ECORE_ANIMATOR_SOURCE_CUSTOM);
+suite.ecore_animator_source_set(suite.ECORE_ANIMATOR_SOURCE_TIMER);
+assert(suite.ecore_animator_source_get() === suite.ECORE_ANIMATOR_SOURCE_TIMER);
+
// Ecore shutdown
suite.ecore_shutdown();