aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/.gitignore1
-rw-r--r--src/tests/ecore/ecore_test_ecore.c34
-rw-r--r--src/tests/ecore/ecore_test_ecore_x.c6
-rw-r--r--src/tests/efl_js/benchmark_js_suite.cc7
-rwxr-xr-xsrc/tests/efl_js/benchmark_js_suite.js205
-rw-r--r--src/tests/efl_js/benchmark_object.eo24
-rw-r--r--src/tests/efl_js/benchmark_object_impl.cc110
-rw-r--r--src/tests/efl_js/ecore_js_suite.cc7
-rwxr-xr-xsrc/tests/efl_js/ecore_js_suite.js438
-rw-r--r--src/tests/efl_js/eina_js_containers_suite.cc7
-rwxr-xr-xsrc/tests/efl_js/eina_js_containers_suite.js552
-rw-r--r--src/tests/efl_js/eina_js_suite.cc7
-rwxr-xr-xsrc/tests/efl_js/eina_js_suite.js415
-rw-r--r--src/tests/efl_js/eio_js_suite.cc7
-rwxr-xr-xsrc/tests/efl_js/eio_js_suite.js89
-rw-r--r--src/tests/efl_js/eldbus_js_suite.cc7
-rwxr-xr-xsrc/tests/efl_js/eldbus_js_suite.js114
-rw-r--r--src/tests/efl_js/ethumb_js_suite.cc7
-rwxr-xr-xsrc/tests/efl_js/ethumb_js_suite.js93
-rw-r--r--src/tests/efl_js/suite_runner.hh147
-rw-r--r--src/tests/efl_js/testproj/hello.project9
-rw-r--r--src/tests/efl_js/testproj/hello.txt1
-rw-r--r--src/tests/efl_js/testproj/main.js5
-rw-r--r--src/tests/efl_js/timer.js33
-rw-r--r--src/tests/eolian_js/constructor_method_class.eo59
-rw-r--r--src/tests/eolian_js/eolian_js_suite.cc61
-rwxr-xr-xsrc/tests/eolian_js/eolian_js_suite.js796
-rw-r--r--src/tests/eolian_js/eolian_js_test_constructor_method_impl.c147
-rw-r--r--src/tests/eolian_js/eolian_js_test_eolian_js_binding.cc44
-rw-r--r--src/tests/eolian_js/eolian_js_test_evas_box.cc151
-rw-r--r--src/tests/eolian_js/eolian_js_test_test_object_impl.c620
-rw-r--r--src/tests/eolian_js/test_object.eo305
32 files changed, 4506 insertions, 2 deletions
diff --git a/src/tests/.gitignore b/src/tests/.gitignore
index e69225df2e..741adfc01a 100644
--- a/src/tests/.gitignore
+++ b/src/tests/.gitignore
@@ -2,4 +2,5 @@ check-results.xml
*_suite
*_suite.log
*_suite.trs
+*.node
*/cxx_compile_test
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index a5331b49aa..968a7ec553 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -267,6 +267,39 @@ START_TEST(ecore_test_ecore_main_loop_fd_handler)
}
END_TEST
+START_TEST(ecore_test_ecore_main_loop_fd_handler_activate_modify)
+{
+ Eina_Bool did = EINA_FALSE;
+ Ecore_Fd_Handler *fd_handler;
+ int comm[2];
+ int ret;
+
+ ret = ecore_init();
+ fail_if(ret < 1);
+
+ ret = pipe(comm);
+ fail_if(ret != 0);
+
+ fd_handler = ecore_main_fd_handler_add
+ (comm[0], ECORE_FD_ERROR, _fd_handler_cb, &did, NULL, NULL);
+ fail_if(fd_handler == NULL);
+
+ ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_READ);
+
+ ret = write(comm[1], "e", 1);
+ fail_if(ret != 1);
+
+ ecore_main_loop_begin();
+
+ close(comm[0]);
+ close(comm[1]);
+
+ fail_if(did != EINA_TRUE);
+
+ ret = ecore_shutdown();
+}
+END_TEST
+
static Eina_Bool
_event_handler_cb(void *data, int type, void *event)
{
@@ -705,6 +738,7 @@ void ecore_test_ecore(TCase *tc)
tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
+ tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify);
tcase_add_test(tc, ecore_test_ecore_main_loop_event);
tcase_add_test(tc, ecore_test_ecore_main_loop_timer_inner);
tcase_add_test(tc, ecore_test_ecore_main_loop_event_recursive);
diff --git a/src/tests/ecore/ecore_test_ecore_x.c b/src/tests/ecore/ecore_test_ecore_x.c
index 18471fa962..8baa9a560f 100644
--- a/src/tests/ecore/ecore_test_ecore_x.c
+++ b/src/tests/ecore/ecore_test_ecore_x.c
@@ -2,10 +2,10 @@
# include <config.h>
#endif
-#include <Ecore_X.h>
-
#include "ecore_suite.h"
+#include <Eina.h>
+
/* FIXME: Currently disable these tests. They are useless ATM and they just
* make buildbot complain. Once we add useful tests here we'll also bother
* with getting X on the server. */
@@ -14,6 +14,8 @@
/* TODO: change to HAVE_ECORE_X when xcb implementation is done */
#ifdef HAVE_ECORE_X_XLIB
+#include <Ecore_X.h>
+
START_TEST(ecore_test_ecore_x_init)
{
int ret;
diff --git a/src/tests/efl_js/benchmark_js_suite.cc b/src/tests/efl_js/benchmark_js_suite.cc
new file mode 100644
index 0000000000..c7583f2b3e
--- /dev/null
+++ b/src/tests/efl_js/benchmark_js_suite.cc
@@ -0,0 +1,7 @@
+
+#include "suite_runner.hh"
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/ecore_js_suite.js", nullptr);
+}
diff --git a/src/tests/efl_js/benchmark_js_suite.js b/src/tests/efl_js/benchmark_js_suite.js
new file mode 100755
index 0000000000..f9437ff130
--- /dev/null
+++ b/src/tests/efl_js/benchmark_js_suite.js
@@ -0,0 +1,205 @@
+#!/usr/bin/env node
+
+// Preamble
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ print_error = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ print_info = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ print_error = print
+ print_info = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suite_success = true;
+// Global test summary
+suite_ok = 0;
+suite_fail = []; // Will store the name of the failures
+
+// Basic test function //
+function start_test(test_name, test_func) {
+ print("[ RUN ] eina_js_suite: " + test_name);
+ var test_result = true;
+ try {
+ test_func();
+ } catch (e) {
+ suite_success = false;
+ test_result = false;
+ print_error("Error: ", e, e.stack);
+ }
+ print("[ " + (test_result ? "PASS" : "FAIL") + " ] eina_js_suite: " + test_name);
+ if (test_result)
+ suite_ok += 1;
+ else
+ suite_fail.push(test_name);
+}
+// end Preamble
+if (typeof process != "undefined")
+{
+ benchmark = require('benchmark_object');
+ assert(benchmark != null, "could not load benchmark_object.node");
+ Benchmark_Object = benchmark.Benchmark_Object;
+ benchmark_emptyarg = benchmark.benchmark_emptyarg;
+ benchmark_onearg = benchmark.benchmark_onearg;
+ benchmark_twoarg = benchmark.benchmark_twoarg;
+ benchmark_tenarg = benchmark.benchmark_tenarg;
+ benchmark_onecomplexarg = benchmark.benchmark_onecomplexarg;
+ benchmark_tencomplexarg = benchmark.benchmark_tencomplexarg;
+}
+else
+{
+ Benchmark_Object = suite.Benchmark_Object;
+}
+
+start_test("empty function", function(){
+ object = new Benchmark_Object(null);
+
+ for(i = 0; i != 10; i++)
+ {
+ object.emptyarg();
+ }
+
+ time = process.hrtime();
+ for(i = 0; i != 20000; i++)
+ {
+ object.emptyarg();
+ }
+ time = process.hrtime(time);
+ console.log('JS empty function %d', time[0]*1000000000 + time[1]);
+ benchmark_emptyarg();
+});
+
+start_test("onearg function", function(){
+ object = new Benchmark_Object(null);
+ for(i = 0; i != 10; i++)
+ {
+ object.onearg(1);
+ }
+
+ time = process.hrtime();
+ for(i = 0; i != 20000; i++)
+ {
+ object.onearg(1);
+ }
+ time = process.hrtime(time);
+ console.log('JS onearg function %d', time[0]*1000000000 + time[1]);
+
+ benchmark_onearg();
+});
+
+start_test("twoarg function", function(){
+ object = new Benchmark_Object(null);
+ for(i = 0; i != 10; i++)
+ {
+ object.twoarg(1, 2);
+ }
+
+ time = process.hrtime();
+ for(i = 0; i != 20000; i++)
+ {
+ object.twoarg(1, 2);
+ }
+ time = process.hrtime(time);
+ console.log('JS twoarg function %d', time[0]*1000000000 + time[1]);
+
+ benchmark_twoarg();
+});
+
+start_test("tenarg function", function(){
+ object = new Benchmark_Object(null);
+ for(i = 0; i != 10; i++)
+ {
+ object.tenarg(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ }
+
+ time = process.hrtime();
+ for(i = 0; i != 20000; i++)
+ {
+ object.tenarg(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ }
+ time = process.hrtime(time);
+ console.log('JS tenarg function %d', time[0]*1000000000 + time[1]);
+ benchmark_tenarg();
+});
+
+start_test("onecomplexarg function", function(){
+ object = new Benchmark_Object(null);
+ list = new efl.List('int')
+ for(i = 0; i != 10; i++)
+ {
+ object.onecomplexarg(list);
+ }
+
+ time = process.hrtime();
+ for(i = 0; i != 20000; i++)
+ {
+ object.onecomplexarg(list);
+ }
+ time = process.hrtime(time);
+ console.log('JS onecomplexarg function %d', time[0]*1000000000 + time[1]);
+ benchmark_onecomplexarg();
+});
+
+start_test("tencomplexarg function", function(){
+ object = new Benchmark_Object(null);
+ list = new efl.List('int')
+ for(i = 0; i != 10; i++)
+ {
+ object.tencomplexarg(list, list, list, list, list, list, list, list, list, list);
+ }
+
+ time = process.hrtime();
+ for(i = 0; i != 20000; i++)
+ {
+ object.tencomplexarg(list, list, list, list, list, list, list, list, list, list);
+ }
+ time = process.hrtime(time);
+ console.log('JS tencomplexarg function %d', time[0]*1000000000 + time[1]);
+ benchmark_tencomplexarg();
+});
+
+// footer
+
+if (!suite_success) {
+ print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
+ print ("[ Total successful: %s ]", suite_ok);
+ print ("[ Total failures: %s ]", suite_fail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suite_fail.length; i++) {
+ print ("[ %s]", suite_fail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suite_ok);
+}
+
+exit();
diff --git a/src/tests/efl_js/benchmark_object.eo b/src/tests/efl_js/benchmark_object.eo
new file mode 100644
index 0000000000..34dd142039
--- /dev/null
+++ b/src/tests/efl_js/benchmark_object.eo
@@ -0,0 +1,24 @@
+class Benchmark_Object (Eo.Base)
+{
+ legacy_prefix: null;
+ data: null;
+ methods {
+ emptyarg {
+ }
+ onearg {
+ params { one: int; }
+ }
+ twoarg {
+ params { one: int; two: int; }
+ }
+ tenarg {
+ params { one: int; two: int; three: int; four: int; five: int; six: int; seven: int; eight: int; nine: int; ten: int; }
+ }
+ onecomplexarg {
+ params { one: list<int>*; }
+ }
+ tencomplexarg {
+ params { one: list<int>*; two: list<int>*; three: list<int>*; four: list<int>*; five: list<int>*; six: list<int>*; seven: list<int>*; eight: list<int>*; nine: list<int>*; ten: list<int>*; }
+ }
+ }
+}
diff --git a/src/tests/efl_js/benchmark_object_impl.cc b/src/tests/efl_js/benchmark_object_impl.cc
new file mode 100644
index 0000000000..538c31b2ce
--- /dev/null
+++ b/src/tests/efl_js/benchmark_object_impl.cc
@@ -0,0 +1,110 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <Eo.h>
+#include <Ecore.h>
+
+#include <stdlib.h>
+
+extern "C" {
+#include "benchmark_object.eo.h"
+
+void _benchmark_object_emptyarg(Eo*, void*)
+{
+}
+void _benchmark_object_onearg(Eo*, void*, int)
+{
+}
+void _benchmark_object_twoarg(Eo*, void*, int, int)
+{
+}
+void _benchmark_object_tenarg(Eo*, void*, int, int, int, int, int, int, int, int, int, int)
+{
+}
+void _benchmark_object_onecomplexarg(Eo*, void*, Eina_List*)
+{
+}
+void _benchmark_object_tencomplexarg(Eo*, void*, Eina_List*, Eina_List*, Eina_List*, Eina_List*, Eina_List*, Eina_List*, Eina_List*, Eina_List*, Eina_List*, Eina_List*)
+{
+}
+
+#include "benchmark_object.eo.c"
+}
+
+#include "benchmark_object.eo.js.cc"
+
+#ifdef HAVE_NODEJS
+namespace {
+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_new;
+
+#define JS_BENCHMARK_ARGS0(v)
+#define JS_BENCHMARK_ARGS1(v) v
+#define JS_BENCHMARK_ARGS2(v) v,v
+#define JS_BENCHMARK_ARGS10(v) v,v,v,v,v,v,v,v,v,v
+#define JS_BENCHMARK_FUNC(name, number, v) \
+ compatibility_return_type js_benchmark_object_##name##arg(compatibility_callback_info_type) \
+ { \
+ Eina_Counter* counter = eina_counter_new("counter"); \
+ Eo* object = eo_add(BENCHMARK_OBJECT_CLASS, NULL); \
+ Eina_List* l = NULL; \
+ (void)l; \
+ /* Warm */ \
+ for(int i = 0; i != 10; i++) \
+ { \
+ eo_do(object, benchmark_object_##name##arg(JS_BENCHMARK_ARGS##number(v))); \
+ } \
+ /* Real loop */ \
+ eina_counter_start(counter); \
+ for(int i = 0; i != 20000; i++) \
+ { \
+ eo_do(object, benchmark_object_##name##arg(JS_BENCHMARK_ARGS##number(v))); \
+ } \
+ eina_counter_stop(counter, 20000); \
+ fprintf(stderr, "%s", eina_counter_dump(counter)); \
+ eo_del(object); \
+ return compatibility_return(); \
+ }
+
+JS_BENCHMARK_FUNC(empty, 0, 1)
+JS_BENCHMARK_FUNC(one, 1, 1)
+JS_BENCHMARK_FUNC(two, 2, 1)
+JS_BENCHMARK_FUNC(ten, 10, 1)
+JS_BENCHMARK_FUNC(onecomplex, 1, l)
+JS_BENCHMARK_FUNC(tencomplex, 10, l)
+
+
+void benchmark_object_module_init(v8::Handle<v8::Object> exports)
+{
+ fprintf(stderr, "test suite eolian_js_module_init\n"); fflush(stderr);
+ try
+ {
+ eina_init();
+ eo_init();
+ register_benchmark_object(exports, v8::Isolate::GetCurrent());
+#define JS_BENCHMARK_EXPORT(name) \
+ exports->Set(compatibility_new<v8::String>(nullptr, "benchmark_" #name "arg") \
+ , compatibility_new<v8::FunctionTemplate>(nullptr, &js_benchmark_object_##name##arg)->GetFunction());
+ JS_BENCHMARK_EXPORT(empty)
+ JS_BENCHMARK_EXPORT(one)
+ JS_BENCHMARK_EXPORT(two)
+ JS_BENCHMARK_EXPORT(ten)
+ JS_BENCHMARK_EXPORT(onecomplex)
+ JS_BENCHMARK_EXPORT(tencomplex)
+ }
+ catch(...)
+ {
+ std::cerr << "Error" << std::endl;
+ std::abort();
+ }
+}
+
+}
+
+#include <eina_js_node.hh>
+
+NODE_MODULE(benchmark_object, ::benchmark_object_module_init)
+#endif
diff --git a/src/tests/efl_js/ecore_js_suite.cc b/src/tests/efl_js/ecore_js_suite.cc
new file mode 100644
index 0000000000..c7583f2b3e
--- /dev/null
+++ b/src/tests/efl_js/ecore_js_suite.cc
@@ -0,0 +1,7 @@
+
+#include "suite_runner.hh"
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/ecore_js_suite.js", nullptr);
+}
diff --git a/src/tests/efl_js/ecore_js_suite.js b/src/tests/efl_js/ecore_js_suite.js
new file mode 100755
index 0000000000..47d0b6f193
--- /dev/null
+++ b/src/tests/efl_js/ecore_js_suite.js
@@ -0,0 +1,438 @@
+#!/usr/bin/env node
+
+// Preamble
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+ console.log("teste1");
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ print_error = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ print_info = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ print_error = print
+ print_info = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suite_success = true;
+// Global test summary
+suite_ok = 0;
+suite_fail = []; // Will store the name of the failures
+
+// Basic test function //
+function start_test(test_name, test_func) {
+ print("[ RUN ] ecore_js_suite: " + test_name);
+ var test_result = true;
+ try {
+ test_func();
+ } catch (e) {
+ suite_success = false;
+ test_result = false;
+ print_error("Error: ", e, e.stack);
+ }
+ print("[ " + (test_result ? "PASS" : "FAIL") + " ] ecore_js_suite: " + test_name);
+ if (test_result)
+ suite_ok += 1;
+ else
+ suite_fail.push(test_name);
+}
+// end Preamble
+
+// ecore preamble
+function abs(n) {
+ if (n < 0)
+ return n * -1;
+ return n;
+}
+var TOLERANCE = 0.0001;
+// end ecore preamble
+
+start_test("timers", function () {
+ var p = 2.5;
+ efl.ecore_timer_precision_set(p);
+ assert(abs(efl.ecore_timer_precision_get() - p) < TOLERANCE);
+
+ p = 0.5;
+ efl.ecore_timer_precision_set(p);
+ assert(abs(efl.ecore_timer_precision_get() - p) < TOLERANCE);
+
+ var dump = efl.ecore_timer_dump();
+ assert(typeof(dump) === 'string');
+ print_info("### BEGINING of Timer dump: ###");
+ print_info(dump);
+ print_info("### END of Timer dump ###");
+
+ var ncalls = 0;
+
+ captured = false;
+ efl.ecore_timer_add(1, function() {
+ print_info('ecore_timer_add handler');
+ ++ncalls;
+ if (ncalls != 4)
+ return true;
+
+ captured = true;
+ efl.ecore_job_add(efl.ecore_mainloop_quit);
+ return false;
+ });
+
+ efl.ecore_mainloop_begin();
+ assert(captured);
+
+ ncalls = 0;
+ captured = false;
+
+ efl.ecore_timer_loop_add(1, function() {
+ ++ncalls;
+ if (ncalls != 4)
+ return true;
+
+ captured = true;
+ efl.ecore_job_add(efl.ecore_mainloop_quit);
+ return false;
+ });
+
+ efl.ecore_mainloop_begin();
+ assert(captured);
+
+ captured = false;
+
+ var timer = efl.ecore_timer_add(1, function() {
+ captured = true;
+ return false;
+ });
+
+ assert(timer.freeze_get() === false);
+
+ timer.freeze();
+
+ assert(timer.freeze_get() === true);
+
+ timer.thaw();
+
+ assert(timer.freeze_get() === false);
+
+ timer.del();
+
+ efl.ecore_timer_add(2, function() {
+ efl.ecore_job_add(efl.ecore_mainloop_quit);
+ return false;
+ });
+
+ efl.ecore_mainloop_begin();
+ assert(captured === false);
+});
+
+// Ecore event
+start_test("ecore event", function () {
+ var myevent = efl.ecore_event_type_new();
+
+ captured = [0, 0, 0]
+
+ var handler1 = efl.ecore_event_handler_add(myevent, function(event) {
+ assert(efl.ecore_event_current_type_get() === myevent);
+ assert(event === myevent);
+ captured[0] += 1;
+ return efl.ECORE_CALLBACK_PASS_ON;
+ });
+
+ var handler2 = efl.ecore_event_handler_add(myevent, function(event) {
+ assert(efl.ecore_event_current_type_get() === myevent);
+ assert(event === myevent);
+ captured[1] += 1;
+ return efl.ECORE_CALLBACK_DONE;
+ });
+
+ var handler3 = efl.ecore_event_handler_add(myevent, function(event) {
+ assert(efl.ecore_event_current_type_get() === myevent);
+ assert(event === myevent);
+ captured[2] += 1;
+ return efl.ECORE_CALLBACK_DONE;
+ });
+
+ efl.ecore_timer_add(1, function() {
+ efl.ecore_event_add(myevent);
+ assert(captured[0] === 0 && captured[1] === 0 && captured[2] === 0);
+ efl.ecore_timer_add(1, function() {
+ assert(captured[0] === 1 && captured[1] === 1 && captured[2] === 0);
+ handler1.del();
+ efl.ecore_event_add(myevent);
+ efl.ecore_event_add(myevent);
+ efl.ecore_event_add(myevent).del();
+ efl.ecore_timer_add(1, function() {
+ assert(captured[0] === 1 && captured[1] === 3 && captured[2] === 0);
+ efl.ecore_mainloop_quit();
+ });
+ });
+ });
+
+ efl.ecore_mainloop_begin();
+
+ efl.ecore_event_add(myevent);
+ efl.ecore_event_add(myevent);
+ efl.ecore_event_add(myevent);
+
+ var filter = efl.ecore_event_filter_add(function() {
+ return {count: 0};
+ }, function(loop_data, event) {
+ assert(event === myevent);
+ var c = loop_data.count;
+ ++loop_data.count;
+ return c != 0;
+ }, function(loop_data) {});
+
+ efl.ecore_timer_add(1, efl.ecore_mainloop_quit);
+ efl.ecore_mainloop_begin();
+ assert(captured[1] === 5);
+ filter.del();
+
+ efl.ecore_event_add(myevent);
+ efl.ecore_event_add(myevent);
+ efl.ecore_event_add(myevent);
+
+ efl.ecore_timer_add(1, efl.ecore_mainloop_quit);
+ efl.ecore_mainloop_begin();
+ assert(captured[1] === 8);
+
+ handler2.del();
+ handler3.del();
+});
+
+ // Ecore job
+start_test("ecore jobs", function () {
+ captured = false;
+
+ efl.ecore_job_add(function() {
+ captured = true;
+ efl.ecore_mainloop_quit();
+ });
+
+ assert(captured === false);
+ efl.ecore_mainloop_begin();
+ assert(captured === true);
+
+ captured = false;
+ var job = efl.ecore_job_add(function() {
+ captured = true;
+ });
+ efl.ecore_job_add(efl.ecore_mainloop_quit);
+ job.del();
+ efl.ecore_mainloop_begin();
+ assert(captured === false);
+});
+
+start_test("ecore idle", function () {
+ // Ecore idle
+ var counter = 1;
+ captured = [0, 0, 0, 0, 0];
+
+ efl.ecore_idler_add(function() {
+ print_info('ecore idle handler 1');
+ captured[0] = counter;
+ counter += 1;
+ efl.ecore_job_add(function() { print_info('ecore job handler 1'); });
+ return efl.ECORE_CALLBACK_DONE;
+ });
+
+ print_info('ecore idle 1');
+
+ efl.ecore_idle_enterer_add(function() {
+ print_info('ecore idle handler 2');
+ captured[1] = counter;
+ counter += 1;
+ return efl.ECORE_CALLBACK_DONE;
+ });
+
+ print_info('ecore idle 2');
+
+ efl.ecore_idle_enterer_add(function() {
+ print_info('ecore idle handler 3');
+ captured[2] = counter;
+ counter += 1;
+ return efl.ECORE_CALLBACK_DONE;
+ });
+
+ print_info('ecore idle 3');
+
+ efl.ecore_idle_enterer_before_add(function() {
+ print_info('ecore idle handler 4');
+ captured[3] = counter;
+ counter += 1;
+ return efl.ECORE_CALLBACK_DONE;
+ });
+
+ print_info('ecore idle 4');
+
+ efl.ecore_idle_exiter_add(function() {
+ print_info('ecore idle handler 5');
+ captured[4] = counter;
+ counter += 1;
+ efl.ecore_mainloop_quit();
+ return efl.ECORE_CALLBACK_DONE;
+ });
+
+ print_info('ecore idle 5');
+
+ efl.ecore_mainloop_begin();
+
+ print_info('ecore idle 6');
+
+ assert(captured[0] === 4, "ecore_idler_add test");
+ assert(captured[1] === 2, "ecore_idle_enterer_add test");
+ assert(captured[2] === 3, "ecore_idle_enterer_add test two");
+ assert(captured[3] === 1, "ecore_idle_enterer_before_add test");
+ assert(captured[4] === 5, "ecore_idle_exiter_add test");
+});
+
+// Ecore animator
+start_test("ecore animator", function () {
+ efl.ecore_animator_frametime_set(1);
+ assert(efl.ecore_animator_frametime_get() === 1);
+ efl.ecore_animator_frametime_set(1 / 50);
+ assert(efl.ecore_animator_frametime_get() === (1 / 50));
+
+ assert(efl.ecore_animator_pos_map(0.5, efl.ECORE_POS_MAP_LINEAR, 0, 0)
+ === 0.5);
+
+ efl.ecore_animator_source_set(efl.ECORE_ANIMATOR_SOURCE_CUSTOM);
+ assert(efl.ecore_animator_source_get()
+ === efl.ECORE_ANIMATOR_SOURCE_CUSTOM);
+ efl.ecore_animator_source_set(efl.ECORE_ANIMATOR_SOURCE_TIMER);
+ assert(efl.ecore_animator_source_get() === efl.ECORE_ANIMATOR_SOURCE_TIMER);
+});
+ // Ecore poller
+start_test("ecore poller", function () {
+ efl.ecore_poller_poll_interval_set(efl.ECORE_POLLER_CORE, 42);
+ assert(efl.ecore_poller_poll_interval_get(efl.ECORE_POLLER_CORE) === 42);
+ efl.ecore_poller_poll_interval_set(efl.ECORE_POLLER_CORE, 2);
+ assert(efl.ecore_poller_poll_interval_get(efl.ECORE_POLLER_CORE) === 2);
+});
+
+start_test("ecore throttle", function () {
+ // Ecore throttle
+
+ efl.ecore_throttle_adjust(3);
+ assert(efl.ecore_throttle_get() === 3);
+ efl.ecore_throttle_adjust(-3);
+ assert(efl.ecore_throttle_get() === 0);
+});
+
+// Ecore file
+start_test("ecore file", function () {
+ assert(typeof(efl.ECORE_FILE_EVENT_NONE) === 'number');
+ assert(typeof(efl.ECORE_FILE_EVENT_CREATED_FILE) === 'number');
+ assert(typeof(efl.ECORE_FILE_EVENT_CREATED_DIRECTORY) === 'number');
+ assert(typeof(efl.ECORE_FILE_EVENT_DELETED_FILE) === 'number');
+ assert(typeof(efl.ECORE_FILE_EVENT_DELETED_DIRECTORY) === 'number');
+ assert(typeof(efl.ECORE_FILE_EVENT_DELETED_SELF) === 'number');
+ assert(typeof(efl.ECORE_FILE_EVENT_MODIFIED) === 'number');
+ assert(typeof(efl.ECORE_FILE_EVENT_CLOSED) === 'number');
+ assert(typeof(efl.ECORE_FILE_PROGRESS_CONTINUE) === 'number');
+ assert(typeof(efl.ECORE_FILE_PROGRESS_ABORT) === 'number');
+
+ var buf = efl.environment_tmp() + '/.ecore_js_test.tmp.XXXXXXXXXXXX';
+ print('buf ', buf)
+ var name = efl.mkstemp(buf);
+
+ print('name of file ', name);
+ assert(efl.ecore_file_remove(name) === true, 'Cannot remove temporary file');
+
+ assert(typeof(efl.ecore_file_recursive_rm(name)) === 'boolean', 'fb0');
+ assert(efl.ecore_file_exists('/') === true, "Root (/) doesn't exist?");
+ assert(efl.ecore_file_is_dir('/') === true, 'fb1');
+ assert((efl.ecore_file_mod_time('/') instanceof Date) === true, 'fb2');
+ assert(typeof(efl.ecore_file_size('/')) === 'number', 'fb3');
+ assert(efl.ecore_file_mkdir(name) === true, 'fb4');
+ assert(efl.ecore_file_mkdir(name) === false, 'fb5');
+ assert(efl.ecore_file_rmdir(name) === true, 'fb6');
+ assert(efl.ecore_file_mkdirs([name]) === 1, 'fb7');
+ assert(efl.ecore_file_mksubdirs(name, ['0', '1']) === 2, 'fb8');
+ assert(efl.ecore_file_symlink('0', name + '/2') === true, 'fb9');
+ assert(efl.ecore_file_readlink(name + '/2') === '0', 'fb23');
+ assert(efl.ecore_file_unlink(name + '/2') === true, 'fb10');
+ assert(efl.ecore_file_remove(name + '/1') === true, 'fb11');
+ assert(efl.ecore_file_recursive_rm(name) === true, 'fb12');
+ assert(efl.ecore_file_mkpath(name + '/0/1') === true, 'fb13');
+ assert(efl.ecore_file_mkpaths([name + '/0/1', name + '/1/2']) === 2, 'fb14');
+ assert(efl.ecore_file_cp(name + '/0/1', name + '/2') === true, 'fb15');
+ assert(efl.ecore_file_mv(name + '/1/2', name + '/2/0') === false, 'fb16');
+ assert(typeof(efl.ecore_file_realpath(name)) === 'string', 'fb17');
+ print('file_get ', efl.ecore_file_file_get(name));
+ assert(efl.ecore_file_file_get(name) === name.substr(name.lastIndexOf('/')+1
+ , name.length - 1 - name.lastIndexOf('/')), 'fb18');
+ assert(efl.ecore_file_dir_get(name + '/2') === name, 'fb19');
+ assert(efl.ecore_file_can_read(name) === true, 'fb20');
+ assert(efl.ecore_file_can_write(name) === true, 'fb21');
+ assert(efl.ecore_file_can_exec(name) === true, 'fb22');
+ var ls = efl.ecore_file_ls(name);
+ assert(ls.length === 3, 'fb23');
+ assert(ls[0] === '0', 'fb24');
+ assert(ls[1] === '1', 'fb25');
+ assert(ls[2] === '2', 'fb26');
+ assert(typeof(efl.ecore_file_app_exe_get('auidadsfas')) === 'string', 'fb27');
+ assert(efl.ecore_file_escape_name('/\\') === '/\\\\', 'fb28');
+ assert(efl.ecore_file_strip_ext('test.abc') === 'test', 'fb29');
+ assert(efl.ecore_file_dir_is_empty(name) === 0, 'fb30');
+ assert(efl.ecore_file_download_protocol_available('file://') === true, 'fb31');
+ print('exists ', name, '? ', efl.ecore_file_path_dir_exists(name));
+ assert(efl.ecore_file_path_dir_exists(name) === true, 'fb32');
+ assert(efl.ecore_file_app_installed(' dsuyabu UBYOS') === false, 'fb33');
+ assert(Array.isArray(efl.ecore_file_app_list()) === true, 'fb34');
+ efl.ecore_file_monitor_add(name, function() { print('empty monitor called'); }).del();
+ function cb(em, e, path) {
+ print('cb called');
+ assert(em.path_get() === name, 'fb38');
+ assert(e === efl.ECORE_FILE_EVENT_CREATED_DIRECTORY, 'fb36');
+ assert(path === name + '/909', 'fb37');
+ em.del();
+ efl.ecore_mainloop_quit();
+ };
+ var monitor_job = efl.ecore_file_monitor_add(name, cb);
+ assert(efl.ecore_file_mkdir(name + '/909') === true, 'fb35');
+
+ efl.ecore_mainloop_begin();
+});
+
+// footer
+
+if (!suite_success) {
+ print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
+ print ("[ Total successful: %s ]", suite_ok);
+ print ("[ Total failures: %s ]", suite_fail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suite_fail.length; i++) {
+ print ("[ %s]", suite_fail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suite_ok);
+}
+
+exit();
diff --git a/src/tests/efl_js/eina_js_containers_suite.cc b/src/tests/efl_js/eina_js_containers_suite.cc
new file mode 100644
index 0000000000..5455b9438a
--- /dev/null
+++ b/src/tests/efl_js/eina_js_containers_suite.cc
@@ -0,0 +1,7 @@
+
+#include "suite_runner.hh"
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/eina_js_containers_suite.js", nullptr);
+}
diff --git a/src/tests/efl_js/eina_js_containers_suite.js b/src/tests/efl_js/eina_js_containers_suite.js
new file mode 100755
index 0000000000..f4f6bf314e
--- /dev/null
+++ b/src/tests/efl_js/eina_js_containers_suite.js
@@ -0,0 +1,552 @@
+#!/usr/bin/env node
+
+// Preamble
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+ console.log("teste1");
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ print_error = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ print_info = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ print_error = print
+ print_info = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suite_success = true;
+// Global test summary
+suite_ok = 0;
+suite_fail = []; // Will store the name of the failures
+
+// Basic test function //
+function start_test(test_name, test_func) {
+ print("[ RUN ] eina_js_suite: " + test_name);
+ var test_result = true;
+ try {
+ test_func();
+ } catch (e) {
+ suite_success = false;
+ test_result = false;
+ print_error("Error: ", e, e.stack);
+ }
+ print("[ " + (test_result ? "PASS" : "FAIL") + " ] eina_js_suite: " + test_name);
+ if (test_result)
+ suite_ok += 1;
+ else
+ suite_fail.push(test_name);
+}
+// end Preamble
+
+start_test("container_test default list should have size zero", function(){
+ var container = new efl.List;
+ assert (container.length == 0);
+});
+
+start_test("container test default Array should have size zero", function(){
+ var container = new efl.Array;
+ assert (container.length == 0);
+});
+
+start_test("container_test empty list access should return undefined", function(){
+ var empty_l = new efl.List;
+ assert (typeof empty_l[0] === "undefined");
+ assert (typeof empty_l[1] === "undefined");
+});
+
+start_test("container_test empty Array access should return undefined", function(){
+ var empty_l = new efl.Array;
+ assert (typeof empty_l[0] === "undefined");
+ assert (typeof empty_l[1] === "undefined");
+});
+
+start_test("container_test empty list indexOf should return -1", function(){
+ var empty_l = new efl.List;
+ assert(empty_l.indexOf(0) == -1);
+ assert(empty_l.indexOf(42) == -1);
+});
+
+start_test("container_test empty Array indexOf should return -1", function(){
+ var empty_l = new efl.Array;
+ assert(empty_l.indexOf(0) == -1);
+ assert(empty_l.indexOf(42) == -1);
+});
+
+start_test("container_test List indexOf should not break with wrong type", function(){
+ container_indexof_wrong_type(efl.List);
+});
+
+start_test("container_test Array indexOf should not break with wrong type", function(){
+ container_indexof_wrong_type(efl.Array);
+});
+
+function container_indexof_wrong_type(T) {
+ var x = new T("int");
+ var raised = false;
+ try {
+ x.indexOf("float")
+ } catch (err) {
+ raised = true;
+ }
+
+ assert(!raised, "container index of should not break with wrong types");
+}
+
+start_test("container_test list[0] = x on empty list", function(){
+ var empty_l = new efl.List;
+ assert(empty_l.length == 0);
+ empty_l[0] = 42;
+ assert(empty_l.length == 1);
+ assert(empty_l[0] == 42);
+});
+
+start_test("container_test array[0] = x on empty Array", function(){
+ var empty_l = new efl.Array;
+ assert(empty_l.length == 0);
+ empty_l[0] = 42;
+ assert(empty_l.length == 1);
+ assert(empty_l[0] == 42);
+});
+
+start_test("container_test out of bounds x[i] setter should resize list", function(){
+ container_out_of_bound_setter(efl.List);
+});
+
+start_test("container_test out of bounds x[i] setter should resize Array", function(){
+ container_out_of_bound_setter(efl.Array);
+});
+
+function container_out_of_bound_setter(T1) {
+ var empty_l = new T1;
+ assert(empty_l.length == 0);
+ empty_l[9] = 1;
+ assert(empty_l.length == 10);
+ for (var i = 0; i < 9; i++) {
+ assert(empty_l[i] == 0);
+ };
+ assert(empty_l[9] == 1);
+}
+
+start_test("container_test push items should increase list length", function(){
+ container_push_length(efl.List);
+});
+
+start_test("container_test push items should increase Array length", function(){
+ container_push_length(efl.Array);
+});
+
+function container_push_length(T1) {
+ var l1 = new T1;
+ print_info("l1 ", l1.toString());
+ l1.push(1);
+ assert (l1.length == 1);
+ l1.push(2);
+ assert (l1.length == 2);
+ l1.push(3);
+ assert (l1.length == 3);
+}
+
+start_test("container_test list simple push and access valid items", function(){
+ container_push_access_valid(efl.List);
+});
+
+start_test("container_test Array simple push and access valid items", function(){
+ container_push_access_valid(efl.Array);
+});
+
+function container_push_access_valid(T1) {
+ var l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ assert (l1[0] == 1);
+ assert (l1[1] == 2);
+}
+
+start_test("container_test list simple push and access items out of bounds", function(){
+ container_push_out_of_bounds(efl.List);
+});
+
+start_test("container_test Array simple push and access items out of bounds", function(){
+ container_push_out_of_bounds(efl.Array);
+});
+
+function container_push_out_of_bounds(T1) {
+ var l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ assert (typeof l1[3] === "undefined");
+ assert (typeof l1[42] === "undefined");
+}
+
+start_test("container_test list push and pop", function() {
+ container_push_pop(efl.List);
+});
+
+start_test("container_test Array push and pop", function() {
+ container_push_pop(efl.Array);
+});
+
+function container_push_pop(T1) {
+ var l1 = new T1;
+
+ assert(typeof l1.pop() === "undefined", "pop on empty container should return undefined");
+
+ l1.push(1);
+ l1.push(2);
+ assert(l1.length == 2);
+ assert(l1.pop() == 2, "Pop should return last element");
+ assert(l1.length == 1, "Pop should decrease list length");
+ assert(l1.pop() == 1, "Pop should return last element even if it's the only element");
+ assert(l1.length == 0, "Pop on single element list should leave it empty");
+}
+
+start_test("container_test list simple push and indexOf valid elements", function(){
+ container_push_indexof_valid(efl.List)
+});
+
+start_test("container_test Array simple push and indexOf valid elements", function(){
+ container_push_indexof_valid(efl.Array)
+});
+
+function container_push_indexof_valid(T1) {
+ var l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ assert(l1.indexOf(1) == 0);
+ assert(l1.indexOf(2) == 1);
+}
+
+start_test("container_test list simple push and indexOf elements out of bounds", function(){
+ container_push_indexof_out_of_bounds(efl.List);
+});
+
+start_test("container_test list simple push and indexOf elements out of bounds", function(){
+ container_push_indexof_out_of_bounds(efl.Array);
+});
+
+function container_push_indexof_out_of_bounds(T1) {
+ var l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ assert(l1.indexOf(3) == -1);
+ assert(l1.indexOf(44) == -1);
+}
+
+start_test("container_test list concat filled + empty shouldn't change length", function(){
+ container_filled_concat_empty_length(efl.List);
+});
+
+start_test("container_test array concat filled + empty shouldn't change length", function(){
+ container_filled_concat_empty_length(efl.Array);
+});
+
+function container_filled_concat_empty_length(T1) {
+ var empty_l = new T1;
+ var l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ l1.push(3);
+ var cle = l1.concat(empty_l);
+ assert (cle.length == 3);
+}
+
+start_test("container_test list concat empty + filled shouldn't change length", function(){
+ container_empty_concat_filled_length(efl.List);
+});
+
+start_test("container_test array concat empty + filled shouldn't change length", function(){
+ container_empty_concat_filled_length(efl.Array);
+});
+
+function container_empty_concat_filled_length(T1) {
+ var empty_l = new T1;
+ var l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ l1.push(3);
+ var cel = empty_l.concat(l1);
+ assert (cel.length == 3);
+}
+
+start_test("container_test concat two valid lists", function(){
+ container_concat_two_valid_containers(efl.List, efl.List);
+});
+
+start_test("container_test concat two valid arrays", function(){
+ container_concat_two_valid_containers(efl.Array, efl.Array);
+});
+
+function container_concat_two_valid_containers(T1, T2) {
+ l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ l1.push(3);
+ l2 = new T2;
+ l2.push(1);
+ l2.push(2);
+ l2.push(3);
+ var c = l1.concat(l2);
+
+ assert (c.length == (l1.length + l2.length));
+ assert (c[0] == l1[0]);
+ assert (c[1] == l1[1]);
+ assert (c[2] == l1[2]);
+ assert (c[3] == l2[0]);
+ assert (c[4] == l2[1]);
+ assert (c[5] == l2[2]);
+ assert (c.indexOf(c[0]) == 0);
+ assert (c.indexOf(c[1]) == 1);
+ assert (c.indexOf(c[2]) == 2);
+ assert (c.indexOf(c[3]) == 0);
+ assert (c.indexOf(c[4]) == 1);
+ assert (c.indexOf(c[5]) == 2);
+ assert (c.lastIndexOf(c[0]) == 3);
+ assert (c.lastIndexOf(c[1]) == 4);
+ assert (c.lastIndexOf(c[2]) == 5);
+ assert (c.lastIndexOf(c[3]) == 3);
+ assert (c.lastIndexOf(c[4]) == 4);
+ assert (c.lastIndexOf(c[5]) == 5);
+}
+
+start_test("container_test concat different types", function() {
+ container_concat_diff_types(efl.Array, efl.List);
+ container_concat_diff_types(efl.List, efl.Array);
+});
+
+function container_concat_diff_types(T1, T2) {
+ var l1 = new T1;
+ var l2 = new T2;
+ var raised = false;
+
+ try {
+ l1.concat(l2);
+ assert(false, "Should raise exception after concatenating two different types.")
+ } catch (err) {
+ raised = true;
+ assert(err.name == "TypeError", "Exception should be TypeError.");
+ }
+
+ assert(raised, "Exception was not raised after concatenating different types.");
+}
+
+start_test("container_test toString list", function(){
+ container_to_string(efl.List);
+});
+
+start_test("container_test toString array", function(){
+ container_to_string(efl.Array);
+});
+
+function container_to_string(T) {
+ var x = new T("int");
+
+ assert("" == x.toString(), "toString empty container");
+
+ x.push(1);
+ assert("1" == x.toString(), "toString single element");
+
+ x.push(2);
+ assert("1,2" == x.toString(), "toString two elements");
+
+ x.push(100);
+ assert("1,2,100" == x.toString(), "toString three elements");
+}
+
+start_test("container_test join list", function(){
+ container_join(efl.List);
+});
+
+start_test("container_test join Array", function(){
+ container_join(efl.Array);
+});
+
+function container_join(T) {
+ var x = new T("int");
+ var ref = new Array;
+
+ assert(ref.join() == x.join(), "default join on empty containers");
+ assert(ref.join(':') == x.join(':'), "arg join on empty containers");
+
+ x.push(42);
+ ref.push(42);
+
+ assert(ref.join() == x.join(), "default join on single-element containers");
+ assert(ref.join(':') == x.join(':'), "arg join on single-element containers");
+
+ x.push(314);
+ ref.push(314);
+
+ assert(ref.join() == x.join(), "default join on multiple-element containers");
+ assert(ref.join(':') == x.join(':'), "arg join on multiple-element containers");
+}
+
+start_test("container_test join wrong arguments", function(){
+
+});
+
+function container_join_wrong_type(T1, T2) {
+ var l1 = new T1("int");
+ var raised = false;
+
+ try {
+ l1.join({});
+ assert(false, "Should raise exception after trying to join with wrong argument type.");
+ } catch (err) {
+ raised = true;
+ assert(err.name == "TypeError", "Exception should be TypeError.");
+ }
+
+ assert(raised, "Exception was not raised after join with wrong argument type.");
+}
+
+start_test("container_test slice list simple", function () {
+ container_slice_simple(efl.List);
+});
+
+start_test("container_test slice Array simple", function () {
+ container_slice_simple(efl.Array);
+});
+
+function container_slice_simple(T1) {
+ l1 = new T1;
+ l1.push(1);
+ l1.push(2);
+ l1.push(3);
+
+ var s1 = l1.slice(1, 3);
+ assert (s1.length == 2);
+ assert (s1[0] == l1[1]);
+ assert (s1[1] == l1[2]);
+}
+
+start_test("container_test slice list single argument", function() {
+ container_slice_single_arg(efl.List);
+});
+
+start_test("container_test slice Array single argument", function() {
+ container_slice_single_arg(efl.Array);
+});
+
+function container_slice_single_arg(T1) {
+ l1 = new T1;
+ l1.push(0);
+ l1.push(1);
+ l1.push(2);
+ l1.push(3);
+ l1.push(4);
+
+ var s1 = l1.slice(1);
+ assert(s1.length == (l1.length - 1));
+ assert(s1[0] == l1[1]);
+ assert(s1[1] == l1[2]);
+ assert(s1[2] == l1[3]);
+ assert(s1[3] == l1[4]);
+}
+
+start_test("container_test slice list no arguments", function() {
+ container_slice_no_args(efl.List);
+});
+
+start_test("container_test slice Array no arguments", function() {
+ container_slice_no_args(efl.Array);
+});
+
+function container_slice_no_args(T1) {
+ l1 = new T1;
+ l1.push(0);
+ l1.push(1);
+ l1.push(2);
+ l1.push(3);
+ l1.push(4);
+
+ var s1 = l1.slice();
+ assert(s1.length == l1.length);
+ assert(s1[0] == l1[0]);
+ assert(s1[1] == l1[1]);
+ assert(s1[2] == l1[2]);
+ assert(s1[3] == l1[3]);
+ assert(s1[4] == l1[4]);
+}
+
+start_test("container test list of strings", function(){
+ container_test_generic(new efl.List("string"), ["The", "quick", "brown", "fox"]);
+});
+
+start_test("container test array of strings", function(){
+ container_test_generic(new efl.Array("string"), ["The", "quick", "brown", "fox"]);
+});
+
+start_test("container test list of floats", function(){
+ container_test_generic(new efl.List("float"), [3.42, 3.14, 1.22, 0.0]);
+});
+
+start_test("container test Array of floats", function(){
+ container_test_generic(new efl.Array("float"), [3.42, 3.14, 1.22, 0.0]);
+});
+
+start_test("container test list of bools", function(){
+ container_test_generic(new efl.List("bool"), [true, false, false, false]);
+});
+
+start_test("container test array of bools", function(){
+ container_test_generic(new efl.Array("bool"), [true, false, false, false]);
+});
+
+function container_test_generic(list, js_ref_list) {
+ assert(list.length == 0);
+ list.push(js_ref_list[0]);
+ list.push(js_ref_list[1]);
+ list.push(js_ref_list[2]);
+ list.push(js_ref_list[3]);
+
+ assert(list.indexOf(js_ref_list[0]) == 0, "First pushed element has index 0");
+ assert(list.indexOf(js_ref_list[1]) == 1, "Second pushed element has index 1");
+ assert(list.lastIndexOf(js_ref_list[0]) == 0, "First element is unique, so its lastIndexOf should be 0");
+
+ assert(list.toString() == js_ref_list.toString(), "toString must be equal to JS.")
+ assert(list.pop() == js_ref_list[3], "Pop should return the last list element");
+}
+
+// footer
+
+if (!suite_success) {
+ print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
+ print ("[ Total successful: %s ]", suite_ok);
+ print ("[ Total failures: %s ]", suite_fail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suite_fail.length; i++) {
+ print ("[ %s]", suite_fail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suite_ok);
+}
+
+exit();
diff --git a/src/tests/efl_js/eina_js_suite.cc b/src/tests/efl_js/eina_js_suite.cc
new file mode 100644
index 0000000000..68345b5068
--- /dev/null
+++ b/src/tests/efl_js/eina_js_suite.cc
@@ -0,0 +1,7 @@
+
+#include "suite_runner.hh"
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/eina_js_suite.js", nullptr);
+}
diff --git a/src/tests/efl_js/eina_js_suite.js b/src/tests/efl_js/eina_js_suite.js
new file mode 100755
index 0000000000..87cebafba9
--- /dev/null
+++ b/src/tests/efl_js/eina_js_suite.js
@@ -0,0 +1,415 @@
+#!/usr/bin/env node
+
+// Preamble
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+ console.log("teste1");
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ print_error = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ print_info = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ print_error = print
+ print_info = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suite_success = true;
+// Global test summary
+suite_ok = 0;
+suite_fail = []; // Will store the name of the failures
+
+// Basic test function //
+function start_test(test_name, test_func) {
+ print("[ RUN ] eina_js_suite: " + test_name);
+ var test_result = true;
+ try {
+ test_func();
+ } catch (e) {
+ suite_success = false;
+ test_result = false;
+ print_error("Error: ", e, e.stack);
+ }
+ print("[ " + (test_result ? "PASS" : "FAIL") + " ] eina_js_suite: " + test_name);
+ if (test_result)
+ suite_ok += 1;
+ else
+ suite_fail.push(test_name);
+}
+
+function array_equal(a, b) {
+ if (a === b) return true;
+ if (a == null || b == null) return false;
+ if (a.length != b.length) return false;
+
+ for (var i = 0; i < a.length; ++i) {
+ if (a[i] !== b[i]
+ && (Object.prototype.toString.call(a[i]) === '[object Array]'
+ && Object.prototype.toString.call(b[i] === '[object Array]')
+ && !array_equal(a[i], b[i])))
+ return false;
+ }
+ return true;
+}
+// end Preamble
+
+// eina Preamble
+// Functions to get the line in NodeJS and V8
+Object.defineProperty(global, '__stack', {
+get: function() {
+ var orig = Error.prepareStackTrace;
+ Error.prepareStackTrace = function(_, stack) {
+ return stack;
+ };
+ var err = new Error;
+ Error.captureStackTrace(err, arguments.callee);
+ var stack = err.stack;
+ Error.prepareStackTrace = orig;
+ return stack;
+ }
+});
+
+Object.defineProperty(global, '__line', {
+get: function() {
+ return __stack[1].getLineNumber();
+ }
+});
+
+Object.defineProperty(global, '__function', {
+get: function() {
+ return __stack[1].getFunctionName();
+ }
+});
+// end eina Preamble
+
+// error tests
+
+start_test("error test clear_eina_error should not throw error", function () {
+ var captured = false;
+ print_info("#1");
+ try {
+ print_info("#2");
+ efl.clear_eina_error();
+ print_info("#3");
+ } catch(e) {
+ print_info("#4");
+ print_error("Exception ", e.toString());
+ print_info("#5");
+ captured = true;
+ }
+ print_info("#6");
+ assert(captured === false, 'captured must be false');
+ print_info("#7");
+});
+
+start_test("error test setting eina error", function() {
+ captured = false;
+ try {
+ print_info("#1");
+ efl.set_eina_error();
+ print_info("#2");
+ } catch(e) {
+ print_info("#3");
+ print_error("Exception ", e.toString());
+ print_info("#4");
+ assert(e.code === 'Eina_Error', 'exception code is different from Eina_Error');
+ print_info("#5");
+ assert(e.value === 'foobar', 'exception value is different from foobar');
+ print_info("#6");
+ captured = true;
+ print_info("#7");
+ }
+ print_info("#8");
+ assert(captured === true, 'captured was expected to be true.');
+
+ print_info("Finished error setting test");
+});
+
+// accessor tests
+start_test("accessor test", function () {
+ assert(efl.acc.get(0) === 42, 'accessor #1');
+ assert(efl.acc.get(1) === 24, 'accessor #2');
+});
+
+// iterator tests
+start_test("iterator tests", function () {
+ assert(efl.it.next().value === 42, 'iterator #1');
+ assert(efl.it.next().value === 24, 'iterator #2');
+});
+
+// value tests
+start_test("value tests int get test", function () {
+ print_info("x");
+
+ var my_value = new efl.value(1);
+ print_info("x");
+ var wrapped = my_value.get();
+ print_info("x");
+ assert(typeof(wrapped) === 'number', 'typeof wrapped is not number');
+ print_info("x");
+ assert(wrapped === 1, 'wrapped should be 1');
+ print_info("x");
+});
+
+start_test("value tests int set test", function(){
+ var my_value = new efl.value(1);
+ var wrapped = my_value.get();
+ my_value.set(2);
+ print_info("x");
+ assert(wrapped === 1, 'Setting a value should not change a previous wrapped result');
+ print_info("x");
+ wrapped = my_value.get();
+ print_info("x");
+ assert(typeof(wrapped) === 'number', 'wrapped value after setting to number should be a number');
+ print_info("x");
+ assert(wrapped === 2, 'wrapped is different from value set');
+ print_info("x");
+});
+
+start_test("value tests int set to bool", function(){
+ var my_value = new efl.value(2);
+ var wrapped = my_value.get();
+ my_value.set(true);
+ print_info("x");
+ assert(wrapped === 2, 'Setting a value should not change a previous wrapped result');
+ print_info("x");
+ wrapped = my_value.get();
+ print_info("x");
+ // boolean is represented as integer in the efl::eina::value layer
+ print_info("x");
+ assert(typeof(wrapped) === 'number', 'value.get from bool value should be a number');
+ print_info("x");
+ assert(wrapped === 1, 'value.get from a true boolean should be 1');
+ print_info("x");
+});
+
+start_test("value tests set value to complex object", function() {
+ var my_value = new efl.value(1);
+ print_info("x");
+ var captured = false;
+ print_info("x");
+ try {
+ print_info("x");
+ my_value.set({type: 'complex object'});
+ print_info("x");
+ } catch(e) {
+ print_info("x");
+ assert(e.code === 'std::bad_cast', 'Trying to set a complex object to a value should raise std::bad_cast');
+ print_info("x");
+ captured = true;
+ print_info("x");
+ }
+ print_info("x");
+ assert(captured === true, 'Trying to set a complex object should raise an exception');
+ print_info("x");
+});
+
+start_test("value tests create value from complex object", function() {
+ print_info("x");
+ var captured = false;
+ print_info("x");
+ try {
+ print_info("x");
+ my_value = new efl.value({type: 'complex object'});
+ print_info("x");
+ } catch(e) {
+ print_info("e.code ", e.code, ' ', typeof e);
+ assert(e.code === 'std::bad_cast', 'Trying to create a value from a complex object should raise std::bad_cast');
+ print_info("x");
+ captured = true;
+ print_info("x");
+ }
+ assert(captured === true, 'Trying to create a value from a complex object should raise an exception');
+});
+// log
+
+start_test("log tests basic", function () {
+ function f1(){ efl.logPrint(efl.LOG_DOMAIN_GLOBAL, efl.LOG_LEVEL_DBG, 'I changed again'); }; f1();
+ efl.logPrint(efl.LOG_DOMAIN_GLOBAL, efl.LOG_LEVEL_CRITICAL, 'Cool to Hate');
+ function f2(){ efl.logPrint(efl.LOG_DOMAIN_GLOBAL, efl.LOG_LEVEL_WARN, 'One Fine Day'); }; f2();
+ function f3(){ efl.logPrint(efl.mydomain, efl.LOG_LEVEL_INFO, 'Never Gonna Find Me'); }; f3();
+});
+
+start_test("log tests domains", function() {
+ var mydomain2 = efl.registerLogDomain('mydomain2', '');
+ efl.setLogDomainRegisteredLevel(mydomain2, efl.LOG_LEVEL_DBG);
+ assert(efl.getLogDomainRegisteredLevel(mydomain2) === efl.LOG_LEVEL_DBG, 'Level set is not LEVEL_DBG');
+ efl.logPrint(mydomain2, efl.LOG_LEVEL_ERR, "The Kids Aren't Alright");
+
+ efl.unregisterLogDomain(mydomain2);
+});
+
+start_test("log tests properties", function() {
+ efl.setLogColorDisable(true);
+ assert(efl.getLogColorDisable() === true, 'getLogColorDisable is false after setting to true');
+ efl.setLogColorDisable(false);
+ assert(efl.getLogColorDisable() === false, 'getLogColorDisable is true after setting to false');
+
+ efl.setLogFileDisable(true);
+ assert(efl.getLogFileDisable() === true, 'getLogFileDisable is false after setting to true');
+ efl.setLogFileDisable(false);
+ assert(efl.getLogFileDisable() === false, 'getLogFileDisable is true after setting to false');
+
+ efl.setLogFunctionDisable(true);
+ assert(efl.getLogFunctionDisable() === true, 'getLogFunctionDisable is false after setting to true');
+ efl.setLogFunctionDisable(false);
+ assert(efl.getLogFunctionDisable() === false, 'getLogFunctionDisable is true after setting to false');
+
+ efl.setLogAbortOnCritical(true);
+ assert(efl.getLogAbortOnCritical() === true, 'getLogAbortOnCritical is false after setting to true');
+ efl.setLogAbortOnCritical(false);
+ assert(efl.getLogAbortOnCritical() === false, 'getLogAbortOnCritical is true after setting to false');
+
+});
+
+start_test("log tests print callback", function() {
+ var entered = false;
+ var line_number = 0;
+
+ // Setup
+ var mydomain = efl.registerLogDomain('mydomain', 'deadbeef');
+ efl.setLogDomainRegisteredLevel(mydomain, efl.LOG_LEVEL_WARN);
+
+ efl.setLogPrintCb(function(domain, color, level, file, func, line, msg) {
+ assert(domain === 'mydomain', 'log print callback incorrect domain');
+ assert(color === 'deadbeef', 'log print callback incorrect color');
+ assert(level === efl.LOG_LEVEL_WARN, 'log print callback incorrect level');
+ assert(function(){ var components = file.split('/'); return components[components.length - 1]; }() === 'eina_js_suite.js'
+ , 'log print callback incorrect file');
+ assert(func === 'f4', 'log print callback incorrect func');
+ assert(line === line_number, 'log print callback incorrect line');
+ assert(msg === 'What Happened To You', 'log print callback incorrect message');
+ entered = true;
+ });
+
+ function f4() {
+ line_number = __line + 1;
+ efl.logPrint(mydomain, efl.LOG_LEVEL_WARN, 'What Happened To You');
+ };
+ f4();
+ assert(entered === true, 'log_print callback was not called');
+
+});
+
+start_test("log tests levels", function(){
+ efl.setLogLevel(efl.LOG_LEVEL_DBG);
+ assert(efl.getLogLevel() === efl.LOG_LEVEL_DBG, 'log level was not DBG');
+ assert(efl.checkLogLevel(efl.LOG_LEVEL_INFO) === true, 'log level INFO was not accepted when DBG level set');
+ efl.setLogLevel(efl.LOG_LEVEL_CRITICAL);
+ assert(efl.getLogLevel() === efl.LOG_LEVEL_CRITICAL, 'log level was not CRITICAL');
+ assert(efl.checkLogLevel(efl.LOG_LEVEL_INFO) === false, 'log level INFO was accepted when CRITICAL level set');
+
+ assert(efl.getLogAbortOnCritical() === false, 'log abort on critical get should not be true');
+ efl.setLogAbortOnCritical(true);
+ assert(efl.getLogAbortOnCritical() === true, 'log abort on critical should be true');
+
+ efl.setLogAbortOnCriticalLevel(efl.LOG_LEVEL_CRITICAL);
+ assert(efl.getLogAbortOnCriticalLevel() == efl.LOG_LEVEL_CRITICAL, 'log critical trigger level is not CRITICAL');
+ efl.setLogAbortOnCriticalLevel(efl.LOG_LEVEL_ERR);
+ assert(efl.getLogAbortOnCriticalLevel() == efl.LOG_LEVEL_ERR, 'log critical trigger level is not ERR');
+
+ efl.setLogDomainLevel('mydomain', efl.LOG_LEVEL_WARN);
+ assert(efl.getLogDomainLevel('mydomain') === efl.LOG_LEVEL_WARN, 'log level for mydomain is not WARN');
+ efl.setLogDomainLevel('mydomain', efl.LOG_LEVEL_INFO);
+ assert(efl.getLogDomainLevel('mydomain') === efl.LOG_LEVEL_INFO, 'log level for mydomain is not INFO');
+
+ assert(typeof(efl.LOG_STATE_START) === 'number', 'type of LOG_STATE_START is not number');
+ assert(typeof(efl.LOG_STATE_STOP) === 'number', 'type of LOG_STATE_STOP is not number');
+ assert(typeof(efl.logTiming) === 'function', 'type of log_timing is not function');
+});
+
+start_test("log helper functions", function(){
+ var messages = [
+ [efl.LOG_LEVEL_CRITICAL, "critical"],
+ [efl.LOG_LEVEL_ERR, "error"],
+ [efl.LOG_LEVEL_WARN, "warning"],
+ [efl.LOG_LEVEL_INFO, "info"],
+ [efl.LOG_LEVEL_DBG, "debug"]
+ ];
+ var caught_messages = [];
+
+ efl.setLogLevel(efl.LOG_LEVEL_WARN);
+ efl.setLogAbortOnCritical(false);
+
+ efl.setLogPrintCb(function(domain, color, level, file, func, line, msg) {
+ caught_messages.push([level, msg]);
+ });
+
+ efl.logCritical(messages[0][1]);
+ efl.logError(messages[1][1]);
+ efl.logWarning(messages[2][1]);
+ efl.logInfo(messages[3][1]);
+ efl.logDebug(messages[4][1]);
+
+ assert(array_equal(messages.slice(0, 3), caught_messages), "Must received only the messages above the desired level.");
+});
+
+start_test("log helper wrong type", function(){
+ var raised = false;
+ try {
+ efl.log_info(442);
+ } catch (err) {
+ raised = true;
+ assert(err.name == "TypeError", "Raised exception must be TypeError.");
+ }
+ assert(raised, "Passing anything other than a string must raise TypeError.");
+});
+
+start_test("log color constants", function(){
+ assert(typeof efl.COLOR_LIGHTRED == "string", "efl.COLOR_LIGHTRED must be a string.");
+ assert(typeof efl.COLOR_RED == "string", "efl.COLOR_RED must be a string.");
+ assert(typeof efl.COLOR_LIGHTBLUE == "string", "efl.COLOR_LIGHTBLUE must be a string.");
+ assert(typeof efl.COLOR_BLUE == "string", "efl.COLOR_BLUE must be a string.");
+ assert(typeof efl.COLOR_GREEN == "string", "efl.COLOR_GREEN must be a string.");
+ assert(typeof efl.COLOR_YELLOW == "string", "efl.COLOR_YELLOW must be a string.");
+ assert(typeof efl.COLOR_ORANGE == "string", "efl.COLOR_ORANGE must be a string.");
+ assert(typeof efl.COLOR_WHITE == "string", "efl.COLOR_WHITE must be a string.");
+ assert(typeof efl.COLOR_LIGHTCYAN == "string", "efl.COLOR_LIGHTCYAN must be a string.");
+ assert(typeof efl.COLOR_CYAN == "string", "efl.COLOR_CYAN must be a string.");
+ assert(typeof efl.COLOR_RESET == "string", "efl.COLOR_RESET must be a string.");
+ assert(typeof efl.COLOR_HIGH == "string", "efl.COLOR_HIGH must be a string.");
+});
+
+// footer
+
+if (!suite_success) {
+ print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
+ print ("[ Total successful: %s ]", suite_ok);
+ print ("[ Total failures: %s ]", suite_fail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suite_fail.length; i++) {
+ print ("[ %s]", suite_fail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suite_ok);
+}
+
+exit();
diff --git a/src/tests/efl_js/eio_js_suite.cc b/src/tests/efl_js/eio_js_suite.cc
new file mode 100644
index 0000000000..ba2df9d767
--- /dev/null
+++ b/src/tests/efl_js/eio_js_suite.cc
@@ -0,0 +1,7 @@
+
+#include "suite_runner.hh"
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/eio_js_suite.js", nullptr);
+}
diff --git a/src/tests/efl_js/eio_js_suite.js b/src/tests/efl_js/eio_js_suite.js
new file mode 100755
index 0000000000..01eb09c171
--- /dev/null
+++ b/src/tests/efl_js/eio_js_suite.js
@@ -0,0 +1,89 @@
+#!/usr/bin/env node
+
+// Preamble
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+ console.log("teste1");
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ print_error = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ print_info = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ print_error = print
+ print_info = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suite_success = true;
+// Global test summary
+suite_ok = 0;
+suite_fail = []; // Will store the name of the failures
+
+// Basic test function //
+function start_test(test_name, test_func) {
+ print("[ RUN ] eio_js_suite: " + test_name);
+ var test_result = true;
+ try {
+ test_func();
+ } catch (e) {
+ suite_success = false;
+ test_result = false;
+ print_error("Error: ", e, e.stack);
+ }
+ print("[ " + (test_result ? "PASS" : "FAIL") + " ] eio_js_suite: " + test_name);
+ if (test_result)
+ suite_ok += 1;
+ else
+ suite_fail.push(test_name);
+}
+// end Preamble
+
+// Eio tests
+start_test('test constants', function () {
+ assert(typeof(efl.EIO_FILE_COPY) === 'number');
+});
+// TODO: more tests
+
+// footer
+
+if (!suite_success) {
+ print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
+ print ("[ Total successful: %s ]", suite_ok);
+ print ("[ Total failures: %s ]", suite_fail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suite_fail.length; i++) {
+ print ("[ %s]", suite_fail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suite_ok);
+}
+
+exit();
diff --git a/src/tests/efl_js/eldbus_js_suite.cc b/src/tests/efl_js/eldbus_js_suite.cc
new file mode 100644
index 0000000000..791c0c6c3c
--- /dev/null
+++ b/src/tests/efl_js/eldbus_js_suite.cc
@@ -0,0 +1,7 @@
+
+#include "suite_runner.hh"
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/eldbus_js_suite.js", nullptr);
+}
diff --git a/src/tests/efl_js/eldbus_js_suite.js b/src/tests/efl_js/eldbus_js_suite.js
new file mode 100755
index 0000000000..30869072c4
--- /dev/null
+++ b/src/tests/efl_js/eldbus_js_suite.js
@@ -0,0 +1,114 @@
+#!/usr/bin/env node
+
+// Preamble
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+ console.log("teste1");
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ print_error = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ print_info = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ print_error = print
+ print_info = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suite_success = true;
+// Global test summary
+suite_ok = 0;
+suite_fail = []; // Will store the name of the failures
+
+// Basic test function //
+function start_test(test_name, test_func) {
+ print("[ RUN ] eldbus_js_suite: " + test_name);
+ var test_result = true;
+ try {
+ test_func();
+ } catch (e) {
+ suite_success = false;
+ test_result = false;
+ print_error("Error: ", e, e.stack);
+ }
+ print("[ " + (test_result ? "PASS" : "FAIL") + " ] eldbus_js_suite: " + test_name);
+ if (test_result)
+ suite_ok += 1;
+ else
+ suite_fail.push(test_name);
+}
+// end Preamble
+
+// Eldbus core tests
+start_test('test constants', function () {
+ assert(typeof(efl.ELDBUS_FDO_BUS) === 'string');
+ assert(typeof(efl.ELDBUS_FDO_PATH) === 'string');
+ assert(typeof(efl.ELDBUS_FDO_INTERFACE) === 'string');
+ assert(typeof(efl.ELDBUS_FDO_INTERFACE_PROPERTIES) === 'string');
+ assert(typeof(efl.ELDBUS_FDO_INTERFACE_INTROSPECTABLE) === 'string');
+ assert(typeof(efl.ELDBUS_FDO_INTEFACE_PEER) === 'string');
+ assert(typeof(efl.ELDBUS_ERROR_PENDING_CANCELED) === 'string');
+ assert(typeof(efl.ELDBUS_ERROR_PENDING_TIMEOUT) === 'string');
+});
+
+// Eldbus connection tests
+start_test('test connection constants', function () {
+ assert(typeof(efl.ELDBUS_TIMEOUT_INFINITE) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_TYPE_UNKNOWN) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_TYPE_SESSION) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_TYPE_SYSTEM) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_TYPE_STARTER) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_TYPE_ADDRESS) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_TYPE_LAST) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_EVENT_DEL) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_EVENT_DISCONNECTED) === 'number');
+ assert(typeof(efl.ELDBUS_CONNECTION_EVENT_LAST) === 'number');
+});
+// Eldbus connection
+
+// TODO...
+
+// finished tests
+
+// footer
+
+if (!suite_success) {
+ print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
+ print ("[ Total successful: %s ]", suite_ok);
+ print ("[ Total failures: %s ]", suite_fail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suite_fail.length; i++) {
+ print ("[ %s]", suite_fail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suite_ok);
+}
+
+exit();
diff --git a/src/tests/efl_js/ethumb_js_suite.cc b/src/tests/efl_js/ethumb_js_suite.cc
new file mode 100644
index 0000000000..5d0149f2ff
--- /dev/null
+++ b/src/tests/efl_js/ethumb_js_suite.cc
@@ -0,0 +1,7 @@
+
+#include "suite_runner.hh"
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/ethumb_js_suite.js", nullptr);
+}
diff --git a/src/tests/efl_js/ethumb_js_suite.js b/src/tests/efl_js/ethumb_js_suite.js
new file mode 100755
index 0000000000..5dd78fc493
--- /dev/null
+++ b/src/tests/efl_js/ethumb_js_suite.js
@@ -0,0 +1,93 @@
+#!/usr/bin/env node
+
+// Preamble
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+ console.log("teste1");
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ print_error = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ print_info = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ print_error = print
+ print_info = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suite_success = true;
+// Global test summary
+suite_ok = 0;
+suite_fail = []; // Will store the name of the failures
+
+// Basic test function //
+function start_test(test_name, test_func) {
+ print("[ RUN ] ethumb_js_suite: " + test_name);
+ var test_result = true;
+ try {
+ test_func();
+ } catch (e) {
+ suite_success = false;
+ test_result = false;
+ print_error("Error: ", e, e.stack);
+ }
+ print("[ " + (test_result ? "PASS" : "FAIL") + " ] ethumb_js_suite: " + test_name);
+ if (test_result)
+ suite_ok += 1;
+ else
+ suite_fail.push(test_name);
+}
+// end Preamble
+
+efl.ethumb_client_init();
+
+// Ethumb tests
+
+start_test('dummy test', function () {
+ assert(true);
+});
+
+efl.ethumb_client_shutdown();
+
+// footer
+
+if (!suite_success) {
+ print ("[ Total tests run: %s ]", suite_ok + suite_fail.length);
+ print ("[ Total successful: %s ]", suite_ok);
+ print ("[ Total failures: %s ]", suite_fail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suite_fail.length; i++) {
+ print ("[ %s]", suite_fail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suite_ok);
+}
+
+exit();
diff --git a/src/tests/efl_js/suite_runner.hh b/src/tests/efl_js/suite_runner.hh
new file mode 100644
index 0000000000..9686ba5e90
--- /dev/null
+++ b/src/tests/efl_js/suite_runner.hh
@@ -0,0 +1,147 @@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <Eina.hh>
+
+#include <cassert>
+#include <cstdlib>
+#include <fstream>
+
+#include <Eina_Js.hh>
+#include <Efl_Js.hh>
+
+const char* ToCString(const v8::String::Utf8Value& value) {
+ return *value ? *value : "<string conversion failed>";
+}
+
+// Executes a string within the current v8 context.
+void ExecuteString(v8::Isolate* isolate,
+ v8::Handle<v8::String> source,
+ v8::Handle<v8::Value> name)
+{
+ efl::eina::js::compatibility_handle_scope handle_scope(isolate);
+ v8::TryCatch try_catch;
+ v8::ScriptOrigin origin(name);
+ v8::Handle<v8::Script> script = v8::Script::Compile(source, &origin);
+ if (script.IsEmpty()) {
+ std::cerr << "Compilation failed" << std::endl;
+ std::exit(-1);
+ }
+ else
+ {
+ std::cerr << "Compilation succesful" << std::endl;
+ v8::Handle<v8::Value> result = script->Run();
+ if (result.IsEmpty()) {
+ std::cout << "Failed with exception thrown" << std::endl;
+ if(try_catch.HasCaught())
+ {
+ if(!try_catch.Message().IsEmpty() && !try_catch.Message()->Get().IsEmpty())
+ std::cerr << "Exception " << ToCString(v8::String::Utf8Value(try_catch.Message()->Get()))
+ << std::endl;
+ else
+ std::cerr << "Exception without message" << std::endl;
+ }
+ std::exit(-1);
+ }
+ }
+}
+
+efl::eina::js::compatibility_return_type Print(efl::eina::js::compatibility_callback_info_type args)
+{
+ bool first = true;
+ for (int i = 0; i < args.Length(); i++) {
+ efl::eina::js::compatibility_handle_scope handle_scope(args.GetIsolate());
+ if (first) {
+ first = false;
+ } else {
+ printf(" ");
+ }
+ v8::String::Utf8Value str(args[i]);
+ const char* cstr = ToCString(str);
+ printf("%s", cstr);
+ }
+ printf("\n");
+ fflush(stdout);
+ return efl::eina::js::compatibility_return();
+}
+
+std::vector<char> read_script(const char* file)
+{
+ std::vector<char> script;
+ std::ifstream script_file(file);
+ script_file.seekg(0, std::ios::end);
+ std::size_t script_size = script_file.tellg();
+ script_file.seekg(0, std::ios::beg);
+ script.resize(script_size+1);
+ script_file.rdbuf()->sgetn(&script[0], script_size);
+ auto line_break = std::find(script.begin(), script.end(), '\n');
+ assert(line_break != script.end());
+ ++line_break;
+ std::fill(script.begin(), line_break, ' ');
+
+ std::cerr << "program:" << std::endl;
+ std::copy(script.begin(), script.end(), std::ostream_iterator<char>(std::cerr));
+ std::cerr << "end of program" << std::endl;
+
+ return script;
+}
+
+int run_script(const char* file, void(*init)(v8::Handle<v8::Object>))
+{
+ efl::eina::js::compatibility_initialize();
+ v8::Isolate* isolate = efl::eina::js::compatibility_isolate_new();
+ assert(isolate != 0);
+
+ v8::Isolate::Scope isolate_scope(isolate);
+
+ efl::eina::js::compatibility_handle_scope handle_scope(isolate);
+ v8::Handle<v8::Context> context
+ = efl::eina::js::compatibility_new<v8::Context>
+ (isolate, nullptr
+ , efl::eina::js::compatibility_new<v8::ObjectTemplate>(isolate));
+ if (context.IsEmpty()) {
+ fprintf(stderr, "Error creating context\n");
+ return 1;
+ }
+ context->Enter();
+ {
+ // Enter the execution environment before evaluating any code.
+ v8::Context::Scope context_scope(context);
+ v8::Local<v8::Object> global = context->Global();
+
+ global->Set(efl::eina::js::compatibility_new<v8::String>(isolate, "print")
+ , efl::eina::js::compatibility_new<v8::FunctionTemplate>(isolate, & ::Print)
+ ->GetFunction());
+
+ std::cerr << __LINE__ << std::endl;
+ v8::Handle<v8::Object> exports = efl::eina::js::compatibility_new<v8::Object>(isolate);
+ global->Set(efl::eina::js::compatibility_new<v8::String>(isolate, "efl"), exports);
+
+ efl_js::init(exports);
+
+ if(init)
+ {
+ v8::Handle<v8::Object> exports = efl::eina::js::compatibility_new<v8::Object>(isolate);
+ global->Set(efl::eina::js::compatibility_new<v8::String>(isolate, "suite"), exports);
+ init(exports);
+ }
+ std::cerr << __LINE__ << std::endl;
+
+ {
+ efl::eina::js::compatibility_handle_scope handle_scope(v8::Isolate::GetCurrent());
+ std::cerr << __LINE__ << std::endl;
+ std::vector<char> script = read_script(file);
+ v8::Local<v8::String> name(efl::eina::js::compatibility_new<v8::String>
+ (nullptr, file));
+ ExecuteString(v8::Isolate::GetCurrent(),
+ efl::eina::js::compatibility_new<v8::String>
+ (v8::Isolate::GetCurrent(), &script[0]), name);
+ std::cerr << __LINE__ << std::endl;
+ }
+ }
+ context->Exit();
+
+ return 0;
+}
diff --git a/src/tests/efl_js/testproj/hello.project b/src/tests/efl_js/testproj/hello.project
new file mode 100644
index 0000000000..6d094fcf1d
--- /dev/null
+++ b/src/tests/efl_js/testproj/hello.project
@@ -0,0 +1,9 @@
+{
+ "Name": "test-project",
+ "Entry": "main.js",
+ "Version": "0.42",
+ "Sources": [
+ ["main.js", "."],
+ ["hello.txt", "."]
+ ]
+} \ No newline at end of file
diff --git a/src/tests/efl_js/testproj/hello.txt b/src/tests/efl_js/testproj/hello.txt
new file mode 100644
index 0000000000..8fe2a4b5ad
--- /dev/null
+++ b/src/tests/efl_js/testproj/hello.txt
@@ -0,0 +1 @@
+The quick brown fox jumps over the lazy dog. \ No newline at end of file
diff --git a/src/tests/efl_js/testproj/main.js b/src/tests/efl_js/testproj/main.js
new file mode 100644
index 0000000000..e9cf00a97d
--- /dev/null
+++ b/src/tests/efl_js/testproj/main.js
@@ -0,0 +1,5 @@
+var fs = require('fs');
+
+text = fs.readFileSync('hello.txt', {encoding: 'utf8'});
+
+console.log(text); \ No newline at end of file
diff --git a/src/tests/efl_js/timer.js b/src/tests/efl_js/timer.js
new file mode 100644
index 0000000000..95c3011080
--- /dev/null
+++ b/src/tests/efl_js/timer.js
@@ -0,0 +1,33 @@
+
+var efl = require('efl');
+
+var loop = new efl.Ecore_Mainloop(null);
+
+var secondsToWait = parseFloat(process.argv[2]);
+
+if (isNaN(secondsToWait))
+ {
+ secondsToWait = 2;
+ }
+
+console.log('Waiting ' + secondsToWait + ' seconds...');
+
+if (false)
+ {
+ var timer = new efl.Timer(null, secondsToWait,
+ function(){
+ console.log("Timer cb called;");
+ loop.quit();
+ }, null);
+ }
+else
+ {
+ setTimeout(function(){
+ console.log("Js callback called;");
+ loop.quit();
+ }, secondsToWait*1000);
+ }
+
+loop.begin();
+
+process.exit(0); \ No newline at end of file
diff --git a/src/tests/eolian_js/constructor_method_class.eo b/src/tests/eolian_js/constructor_method_class.eo
new file mode 100644
index 0000000000..f307a18fc5
--- /dev/null
+++ b/src/tests/eolian_js/constructor_method_class.eo
@@ -0,0 +1,59 @@
+class Constructor_Method_Class (Eo.Base)
+{
+ legacy_prefix: null;
+ data: Constructor_Method_Class_Data;
+ methods {
+ @property fail {
+ get {
+ }
+ values {
+ is_fail: bool;
+ }
+ }
+ constructor1 {
+ params { @in one: int; }
+ }
+ constructor2 {
+ params { @in two: double; }
+ }
+ method1 {
+ params { @in one: int; }
+ }
+ method2 {
+ params { @in one: int; }
+ return: int;
+ }
+ method3 {
+ params { @in one: int; @in two: double; }
+ }
+ method4 {
+ params { @in one: int; @in two: double; }
+ return: int;
+ }
+ outmethod1 {
+ params { @out one: int; }
+ }
+ outmethod2 {
+ params { @out one: int; }
+ return: int;
+ }
+ outmethod3 {
+ params { @out one: int; @out two: double; }
+ }
+ classoutmethod1 {
+ params { @in one: int; @in two: double; }
+ return: free(own(Constructor_Method_Class *), eo_unref) @warn_unused;
+ }
+ classoutmethod2 {
+ params { @in one: int; @in two: double; @out out_class: own(Constructor_Method_Class *); }
+ }
+ }
+ implements {
+ Eo.Base.constructor;
+ Eo.Base.finalize;
+ }
+ constructors {
+ .constructor1;
+ .constructor2;
+ }
+}
diff --git a/src/tests/eolian_js/eolian_js_suite.cc b/src/tests/eolian_js/eolian_js_suite.cc
new file mode 100644
index 0000000000..cea5d19d33
--- /dev/null
+++ b/src/tests/eolian_js/eolian_js_suite.cc
@@ -0,0 +1,61 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <Eina.hh>
+#include <Eina_Js.hh>
+
+#include <check.h>
+
+#include <cassert>
+#include <cstdio>
+#include <cstdlib>
+
+#ifndef HAVE_NODEJS
+#include "suite_runner.hh"
+void eolian_js_test_register_eolian_js_binding(v8::Handle<v8::Object> exports);
+
+int main(int, char*[])
+{
+ return run_script(TESTS_SRC_DIR "/eolian_js_suite.js", &eolian_js_test_register_eolian_js_binding);
+}
+#else
+#ifdef HAVE_NODE_NODE_H
+#include <node/node.h>
+#elif defined(HAVE_NODEJS_DEPS_NODE_NODE_H)
+#include <nodejs/deps/node/node.h>
+#elif defined(HAVE_NODEJS_DEPS_NODE_INCLUDE_NODE_H)
+#include <nodejs/deps/node/include/node.h>
+#elif defined(HAVE_NODEJS_SRC_NODE_H)
+#include <nodejs/src/node.h>
+#elif defined(HAVE_NODE_H)
+#include <node.h>
+#else
+#error We must have at least one node header to include
+#endif
+void eolian_js_test_register_eolian_js_binding(v8::Handle<v8::Object> exports);
+
+namespace {
+
+void eolian_js_module_init(v8::Handle<v8::Object> exports)
+{
+ fprintf(stderr, "test suite eolian_js_module_init\n"); fflush(stderr);
+ try
+ {
+ eina_init();
+ eo_init();
+ eolian_js_test_register_eolian_js_binding(exports);
+ std::cerr << "registered" << std::endl;
+ }
+ catch(...)
+ {
+ std::cerr << "Error" << std::endl;
+ std::abort();
+ }
+}
+
+}
+
+NODE_MODULE(eolian_js_suite_mod, ::eolian_js_module_init)
+
+#endif
diff --git a/src/tests/eolian_js/eolian_js_suite.js b/src/tests/eolian_js/eolian_js_suite.js
new file mode 100755
index 0000000000..146127323e
--- /dev/null
+++ b/src/tests/eolian_js/eolian_js_suite.js
@@ -0,0 +1,796 @@
+#!/usr/bin/env node
+
+// Preamble //
+function assert(condition, message) {
+ if (!condition) {
+ print("Assertion failed ", message);
+ throw new Error(message || "Assertion failed");
+ }
+}
+
+if(typeof process !== 'undefined')
+{
+ console.log('running from nodejs');
+ console.log('path', process.env.NODE_PATH);
+ console.log("teste1");
+
+ efl = require('efl');
+ assert(efl != null, "could not load efl node module");
+
+ // Setup output aliases
+ print = console.log;
+ printError = function() {
+ if (process.argv.indexOf("--supress-errors") == -1)
+ console.error.apply(null, arguments);
+ };
+ printInfo = function() {
+ if (process.argv.indexOf("--verbose") != -1)
+ console.info.apply(null, arguments);
+ };
+ exit = efl.ecore_mainloop_quit;
+}
+else
+{
+ assert = function(test, message) { if (test !== true) throw message; };
+ print('running from libv8')
+ //FIXME Add levels to v8 tests
+ printError = print
+ printInfo = print
+ exit = function() {}
+}
+
+// Global flag for suite success //
+suiteSuccess = true;
+// Global test summary
+suiteOk = 0;
+suiteFail = []; // Will store the name of the failures
+
+// Basic test function //
+function startTest(testName, testFunc) {
+ print("[ RUN ] eolian_js_suite: " + testName);
+ var testResult = true;
+ try {
+ testFunc();
+ } catch (e) {
+ suiteSuccess = false;
+ testResult = false;
+ printError("Error: ", e, e.stack);
+ }
+ print("[ " + (testResult ? "PASS" : "FAIL") + " ] eolian_js_suite: " + testName);
+ if (testResult)
+ suiteOk += 1;
+ else
+ suiteFail.push(testName);
+}
+// end Preamble
+
+// eolian Preamble
+if (typeof process != "undefined")
+{
+ suite = require('eolian_js_suite_mod');
+ assert(suite != null, "could not load eolian_js_suite_mod");
+ ConstructorMethodClass = suite.ConstructorMethodClass;
+ TestObject = suite.Test.Object;
+}
+else
+{
+ ConstructorMethodClass = suite.ConstructorMethodClass;
+ TestObject = suite.Test.Object;
+}
+
+function expectException(func) {
+ var exceptionCaught = false;
+ try {
+ func();
+ } catch (e) {
+ exceptionCaught = true;
+ }
+ assert(exceptionCaught, "Exception expected but not thrown!");
+}
+// end eolian Preamble
+
+// Test cases //
+startTest("constructor_null_parent", function() {
+ var obj = new TestObject(null);
+ assert(obj !== null);
+});
+
+startTest("integral_in_and_out_parameters", function() {
+ var obj = new TestObject(null);
+
+ var expectedValue = 1234;
+ obj.methodIntegralInA(expectedValue);
+
+ var actualValue = obj.methodIntegralOutA();
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+});
+
+startTest("integral_inout_parameter", function() {
+ var obj = new TestObject(null);
+
+ var expectedValue = 1234;
+ var actualValue = obj.methodIntegralInout(-expectedValue);
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+
+ var expectedValue = -4321;
+ var actualValue = obj.methodIntegralInout(-expectedValue);
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+});
+
+startTest("integral_return_value", function() {
+ var obj = new TestObject(null);
+
+ var expectedValue = 1234;
+ obj.methodIntegralInA(expectedValue);
+
+ var actualValue = obj.methodIntegralReturnA();
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+});
+
+startTest("more_parameters_than_expected_is_ok", function() {
+ var obj = new TestObject(null);
+ var expectedValue = 1234;
+ obj.methodIntegralInA(expectedValue, 4321);
+
+ var actualValue = obj.methodIntegralOutA();
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+});
+
+startTest("less_parameters_that_expected_fails", function() {
+ var obj = new TestObject(null);
+ expectException(function() {
+ obj.methodIntegralInA();
+ });
+});
+
+startTest("wrong_parameter_type_fails", function() {
+ var obj = new TestObject(null);
+ expectException(function() {
+ obj.methodIntegralInA('string');
+ });
+});
+
+startTest("mixed_in_out_and_result", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodDivMod(7, 3);
+ var success = ret[0];
+ var quotient = ret[1];
+ var remainder = ret[2];
+ assert(success);
+ assert(2 == quotient);
+ assert(1 == remainder);
+
+ ret = obj.methodDivMod(42, 0);
+ success = ret[0];
+ assert(!success);
+});
+
+startTest("boolean", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodAnd(false, false);
+ assert(ret == false);
+ ret = obj.methodAnd(false, true);
+ assert(ret == false);
+ ret = obj.methodAnd(true, false);
+ assert(ret == false);
+ ret = obj.methodAnd(true, true);
+ assert(ret);
+});
+
+startTest("floating_point", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodModf(3.14159);
+ assert(Math.abs(ret[0] - 0.14159) < 0.00001, "Math.abs(ret[0] - 0.14159) < 0.00001 (" + Math.abs(ret[0] - 0.14159) + " < 0.00001)");
+ assert(ret[1] == 3, "ret[1] == 3 (" + ret[1] + " == 3)");
+});
+
+startTest("string_inout", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodUppercase('hello world');
+ assert(ret == "HELLO WORLD", "ret == " + ret);
+});
+
+startTest("in_null_string", function() {
+ var obj = new TestObject(null);
+ var success = obj.methodInNull(null);
+ assert(success, "success == " + success);
+});
+
+
+startTest("out_null_string", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodOutNull();
+ assert(ret[0], "success == " + ret[0]);
+ assert(ret[1] === null, "output == " + ret[1]);
+});
+
+
+startTest("inout_null_string", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodInoutNull(null);
+ assert(ret[0], "success == " + ret[0]);
+ assert(ret[1] === null, "output == " + ret[1]);
+});
+
+
+startTest("return_null_string", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodReturnNull();
+ assert(ret === null, "ret == " + ret);
+});
+
+
+startTest("null_values", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodNull(null, null);
+ assert(ret[0] === null, "ret == " + ret[0]);
+ assert(ret[1] === null, "ret == " + ret[1]);
+ assert(ret[2] === null, "ret == " + ret[2]);
+});
+
+startTest("enum_values", function() {
+ var obj = new TestObject(null);
+ var ret = obj.methodInEnumReturnEnum(suite.Test.EnumEx.SECOND);
+ assert(ret === suite.Test.EnumEx.SECOND);
+ var value = suite.Test.EnumEx.THIRD;
+ assert(value === 2);
+ ret = obj.methodInEnumReturnEnum(value);
+ assert(ret === value);
+});
+
+startTest("struct_values", function() {
+ var obj = new TestObject(null);
+ var newStruct = new suite.Test.StructEx;
+ newStruct.valueInt = 42;
+ newStruct.valueEnum = suite.Test.EnumEx.FOURTH;
+ var ret = newStruct.valueInt;
+ assert(ret === 42);
+ ret = newStruct.valueEnum;
+ assert(ret === suite.Test.EnumEx.FOURTH);
+ ret = obj.methodInStructReturnStruct(newStruct);
+ assert(ret.valueInt === 42);
+ assert(ret.valueEnum === suite.Test.EnumEx.FOURTH);
+});
+
+startTest("event_simple", function() {
+ var v = false;
+ var obj = new TestObject(null);
+ var ret = obj.on
+ ("test",
+ function()
+ {
+ printInfo('Event called')
+ v = true;
+ }
+ );
+ printInfo('going to call event');
+ obj.callEvent();
+ printInfo('is event called?');
+ assert(v);
+});
+
+startTest("event_object_call", function() {
+ var v = false;
+ var obj = new TestObject(null);
+ var ret = obj.on
+ ("test",
+ function()
+ {
+ printInfo('Event called');
+ var o = arguments[0];
+ assert(o != null);
+ var expectedValue = 1234;
+ o.methodIntegralInA(expectedValue);
+ var actualValue = o.methodIntegralOutA();
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+ v = true;
+ }
+ );
+ printInfo('going to call event');
+ obj.callEvent();
+ printInfo('is event called?');
+ assert(v);
+});
+
+startTest("event_structarg", function() {
+ var v = false;
+ var obj = new TestObject(null);
+ var ret = obj.on
+ ("test_structarg",
+ function()
+ {
+ printInfo('Event called');
+ var s = arguments[1];
+ assert(s != null);
+ assert(s.valueInt === 42);
+ assert(s.valueEnum === suite.Test.EnumEx.THIRD);
+ v = true;
+ }
+ );
+ printInfo('going to call event');
+ obj.callEvent();
+ printInfo('is event called?');
+ assert(v);
+});
+
+startTest("event_stringarg", function() {
+ var v = false;
+ var obj = new TestObject(null);
+ var ret = obj.on
+ ("test_stringarg",
+ function()
+ {
+ printInfo('Event called');
+ var s = arguments[1];
+ assert(s === "foo");
+ v = true;
+ }
+ );
+ printInfo('going to call event');
+ obj.callEvent();
+ printInfo('is event called?');
+ assert(v);
+});
+
+// // TODO: disabled. Not implemented yet
+// startTest("integral_array", function() {
+// var obj = new TestObject(null);
+// var ret = obj.methodArrayAt([1, 2, 3, 4, 5], 1);
+// assert(ret == 2, "ret == " + ret);
+// });
+
+startTest("array_in_array_out", function() {
+ var obj = new TestObject(null);
+ var newArray = obj.methodArrayWith42();
+ assert(newArray != null);
+ var arr = obj.methodArrayInArrayOut(newArray);
+ assert(arr != null);
+ assert(arr[0] === 42);
+ assert(newArray[0] === arr[0]);
+});
+
+startTest("method_array_of_objects", function() {
+ var obj = new TestObject(null);
+ var arr = obj.methodArrayOfObjects(null);
+ assert(arr != null);
+ assert(arr[0] != null);
+ arr = obj.methodArrayOfObjects(arr);
+ assert(arr != null);
+ var v = arr[0];
+ assert(v != null);
+ // assert(v == obj); // TODO: check if same Eo object pointer?
+ var expectedValue = 1234;
+ v.methodIntegralInA(expectedValue);
+ var actualValue = v.methodIntegralOutA();
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+});
+
+// FIXME
+// startTest("method_array_of_strings", function() {
+// var obj = new TestObject(null);
+// var arr = obj.methodArrayOfStrings(null);
+// assert(arr != null);
+// assert(arr[0] === "foo");
+// arr = obj.methodArrayOfStrings(arr);
+// assert(arr != null);
+// assert(arr[0] === "foo");
+// });
+
+startTest("method_array_of_ints", function() {
+ var obj = new TestObject(null);
+ var arr = obj.methodArrayOfInts(null);
+ assert(arr != null);
+ assert(arr[0] === 42);
+ arr = obj.methodArrayOfInts(arr);
+ assert(arr != null);
+ assert(arr[0] === 42);
+});
+
+startTest("method_array_of_bools", function() {
+ var obj = new TestObject(null);
+ var arr = obj.methodArrayOfBools(null);
+ assert(arr != null);
+ assert(arr[0] === true);
+ arr = obj.methodArrayOfBools(arr);
+ assert(arr != null);
+ assert(arr[0] === true);
+});
+
+startTest("method_array_of_doubles", function() {
+ var obj = new TestObject(null);
+ var arr = obj.methodArrayOfDoubles(null);
+ assert(arr != null);
+ assert(arr[0] === 42.0);
+ arr = obj.methodArrayOfDoubles(arr);
+ assert(arr != null);
+ assert(arr[0] === 42.0);
+});
+
+startTest("method_array_of_enums", function() {
+ var obj = new TestObject(null);
+ var arr = obj.methodArrayOfEnums(null);
+ assert(arr != null);
+ assert(arr[0] === suite.Test.EnumEx.THIRD);
+ arr = obj.methodArrayOfEnums(arr);
+ assert(arr != null);
+ assert(arr[0] === suite.Test.EnumEx.THIRD);
+});
+
+startTest("method_array_of_structs", function() {
+ var obj = new TestObject(null);
+ var arr = obj.methodArrayOfStructs(null);
+ assert(arr != null);
+ var s = arr[0];
+ assert(s != null);
+ assert(s.valueInt === 42);
+ assert(s.valueEnum === suite.Test.EnumEx.THIRD);
+ arr = obj.methodArrayOfStructs(arr);
+ s = arr[0];
+ assert(s != null);
+ assert(s.valueInt === 42);
+ assert(s.valueEnum === suite.Test.EnumEx.THIRD);
+});
+
+startTest("list_in_list_out", function() {
+ var obj = new TestObject(null);
+ var newList = obj.methodListWith42();
+ assert(newList != null);
+ var lis = obj.methodListInListOut(newList);
+ assert(lis != null);
+ // assert(lis == newList); // TODO: check same list pointer?
+ assert(lis[0] === 42);
+ assert(newList[0] === lis[0]);
+});
+
+startTest("method_list_of_objects", function() {
+ var obj = new TestObject(null);
+ var lis = obj.methodListOfObjects(null);
+ assert(lis != null);
+ assert(lis[0] != null);
+ lis = obj.methodListOfObjects(lis);
+ assert(lis != null);
+ var v = lis[0];
+ assert(v != null);
+ // assert(v == obj); // TODO: check if same Eo object pointer?
+ var expectedValue = 1234;
+ v.methodIntegralInA(expectedValue);
+ var actualValue = v.methodIntegralOutA();
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+});
+
+// FIXME
+// startTest("method_list_of_strings", function() {
+// var obj = new TestObject(null);
+// var lis = obj.methodListOfStrings(null);
+// assert(lis != null);
+// assert(lis[0] === "foo");
+// lis = obj.methodListOfStrings(lis);
+// assert(lis != null);
+// assert(lis[0] === "foo");
+// });
+
+startTest("method_list_of_ints", function() {
+ var obj = new TestObject(null);
+ var lis = obj.methodListOfInts(null);
+ assert(lis != null);
+ assert(lis[0] === 42);
+ lis = obj.methodListOfInts(lis);
+ assert(lis != null);
+ assert(lis[0] === 42);
+});
+
+startTest("method_list_of_bools", function() {
+ var obj = new TestObject(null);
+ var lis = obj.methodListOfBools(null);
+ assert(lis != null);
+ assert(lis[0] === true);
+ lis = obj.methodListOfBools(lis);
+ assert(lis != null);
+ assert(lis[0] === true);
+});
+
+startTest("method_list_of_doubles", function() {
+ var obj = new TestObject(null);
+ var lis = obj.methodListOfDoubles(null);
+ assert(lis != null);
+ assert(lis[0] === 42.0);
+ lis = obj.methodListOfDoubles(lis);
+ assert(lis != null);
+ assert(lis[0] === 42.0);
+});
+
+startTest("method_list_of_enums", function() {
+ var obj = new TestObject(null);
+ var lis = obj.methodListOfEnums(null);
+ assert(lis != null);
+ assert(lis[0] === suite.Test.EnumEx.THIRD);
+ lis = obj.methodListOfEnums(lis);
+ assert(lis != null);
+ assert(lis[0] === suite.Test.EnumEx.THIRD);
+});
+
+startTest("method_list_of_structs", function() {
+ var obj = new TestObject(null);
+ var lis = obj.methodListOfStructs(null);
+ assert(lis != null);
+ var s = lis[0];
+ assert(s != null);
+ assert(s.valueInt === 42);
+ assert(s.valueEnum === suite.Test.EnumEx.THIRD);
+ lis = obj.methodListOfStructs(lis);
+ s = lis[0];
+ assert(s != null);
+ assert(s.valueInt === 42);
+ assert(s.valueEnum === suite.Test.EnumEx.THIRD);
+});
+
+startTest("method_accessor_of_objects", function() {
+ var obj = new TestObject(null);
+ var acc = obj.methodAccessorOfObjects(null);
+ assert(acc != null);
+ assert(acc.get(0) != null);
+ acc = obj.methodAccessorOfObjects(acc);
+ assert(acc != null);
+ var v = acc.get(0);
+ assert(v != null);
+ var expectedValue = 1234;
+ v.methodIntegralInA(expectedValue);
+ var actualValue = v.methodIntegralOutA();
+ assert(actualValue == expectedValue, actualValue + " == " + expectedValue);
+});
+
+// FIXME
+// startTest("method_accessor_of_strings", function() {
+// var obj = new TestObject(null);
+// var acc = obj.methodAccessorOfStrings(null);
+// assert(acc != null);
+// assert(acc.get(0) === "foo");
+// acc = obj.methodAccessorOfStrings(acc);
+// assert(acc != null);
+// assert(acc.get(0) === "foo");
+// });
+
+startTest("method_accessor_of_ints", function() {
+ var obj = new TestObject(null);
+ var acc = obj.methodAccessorOfInts(null);
+ assert(acc != null);
+ assert(acc.get(0) === 42);
+ acc = obj.methodAccessorOfInts(acc);
+ assert(acc != null);
+ assert(acc.get(0) === 42);
+});
+
+startTest("method_accessor_of_bools", function() {
+ var obj = new TestObject(null);
+ var acc = obj.methodAccessorOfBools(null);
+ assert(acc != null);
+ assert(acc.get(0) === true);
+ acc = obj.methodAccessorOfBools(acc);
+ assert(acc != null);
+ assert(acc.get(0) === true);
+});
+
+startTest("method_accessor_of_doubles", function() {
+ var obj = new TestObject(null);
+ var acc = obj.methodAccessorOfDoubles(null);
+ assert(acc != null);
+ assert(acc.get(0) === 42.0);
+ acc = obj.methodAccessorOfDoubles(acc);
+ assert(acc != null);
+ assert(acc.get(0) === 42.0);
+});
+
+startTest("method_accessor_of_enums", function() {
+ var obj = new TestObject(null);
+ var acc = obj.methodAccessorOfEnums(null);
+ assert(acc != null);
+ assert(acc.get(0) === suite.Test.EnumEx.THIRD);
+ acc = obj.methodAccessorOfEnums(acc);
+ assert(acc != null);
+ assert(acc.get(0) === suite.Test.EnumEx.THIRD);
+});
+
+startTest("method_accessor_of_structs", function() {
+ var obj = new TestObject(null);
+ var acc = obj.methodAccessorOfStructs(null);
+ assert(acc != null);
+ var s = acc.get(0);
+ assert(s != null);
+ assert(s.valueInt === 42);
+ assert(s.valueEnum === suite.Test.EnumEx.THIRD);
+ acc = obj.methodAccessorOfStructs(acc);
+ assert(acc != null);
+ s = acc.get(0);
+ assert(s != null);
+ assert(s.valueInt === 42);
+ assert(s.valueEnum === suite.Test.EnumEx.THIRD);
+});
+
+// Combinations of complex types //
+
+// FIXME
+// startTest("method_array_of_arrays_of_ints", function() {
+// var obj = new TestObject(null);
+// var arr = obj.methodArrayOfArraysOfInts(null);
+// assert(arr != null);
+// var a = arr[0];
+// assert(a != null);
+// assert(a[0] === 42);
+// arr = obj.methodArrayOfArraysOfInts(arr);
+// assert(arr != null);
+// a = arr[0];
+// assert(a != null);
+// assert(a[0] === 42);
+// });
+
+// FIXME
+// startTest("method_list_of_lists_of_ints", function() {
+// var obj = new TestObject(null);
+// var lis = obj.methodListOfListsOfInts(null);
+// assert(lis != null);
+// var l = lis[0];
+// assert(l != null);
+// assert(l[0] === 42);
+// lis = obj.methodListOfListsOfInts(lis);
+// assert(lis != null);
+// l = lis[0];
+// assert(l != null);
+// assert(l[0] === 42);
+// });
+
+// FIXME
+// startTest("method_array_of_lists_of_ints", function() {
+// var obj = new TestObject(null);
+// var arr = obj.methodArrayOfListsOfInts(null);
+// assert(arr != null);
+// var l = arr[0];
+// assert(l != null);
+// assert(l[0] === 42);
+// arr = obj.methodArrayOfListsOfInts(arr);
+// assert(arr != null);
+// l = arr[0];
+// assert(l != null);
+// assert(l[0] === 42);
+// });
+
+// FIXME
+// startTest("method_list_of_arrays_of_ints", function() {
+// var obj = new TestObject(null);
+// var lis = obj.methodListOfArraysOfInts(null);
+// assert(lis != null);
+// var a = lis[0];
+// assert(a != null);
+// assert(a[0] === 42);
+// lis = obj.methodListOfArraysOfInts(lis);
+// assert(lis != null);
+// a = lis[0];
+// assert(a != null);
+// assert(a[0] === 42);
+// });
+
+startTest("new Constructor_Method_Class", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ assert(obj);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class method1", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ obj.method1(2);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class method2", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ var r = obj.method2(3);
+ assert(r === 5);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class method3", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ obj.method3(3, 11.1);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class method4", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ var r = obj.method4(3, 11.1);
+ assert(r == 5);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class method3 less parameters than expected", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ expectException(function() {
+ obj.method3(3);
+ });
+});
+
+startTest("Constructor_Method_Class constructor less parameters than expected", function() {
+ expectException(function() {
+ var obj = new ConstructorMethodClass(null, 5);
+ });
+});
+
+startTest("Constructor_Method_Class constructor wrong parameter types", function() {
+ expectException(function() {
+ var obj = new ConstructorMethodClass(null, 5.1, 10);
+ });
+});
+
+// Out parameters //
+
+startTest("Constructor_Method_Class outmethod1", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ var r = obj.outmethod1();
+ assert(r == 5);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class outmethod2", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ var r = obj.outmethod2();
+ assert(Array.isArray(r));
+ printInfo("Return is array from outmethod2");
+ assert(r[0] == 11);
+ assert(r[1] == 10);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class outmethod3", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ var r = obj.outmethod3();
+ assert(Array.isArray(r));
+ printInfo("Return is array from outmethod3");
+ assert(r[0] == 11);
+ assert(r[1] == 5.1);
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class classoutmethod1", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ var c = obj.classoutmethod1(5, 10.0);
+ assert(c);
+ var r = c.method4(3, 11.1);
+ assert(r == 5);
+ assert(c.getFail() == false, "object fail flag set");
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("Constructor_Method_Class classoutmethod2", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ printInfo('1');
+ var c = obj.classoutmethod2(5, 10.0);
+ assert(c);
+ var r = c.method4(3, 11.1);
+ assert(r);
+ assert(r == 5);
+ assert(c.getFail() == false, "object fail flag set");
+ assert(obj.getFail() == false, "object fail flag set");
+});
+
+startTest("cast", function() {
+ var obj = new ConstructorMethodClass(null, 5, 10.0);
+ var c = obj.classoutmethod1(5, 10.0);
+ print('classoutmethod1');
+ assert(c);
+ var d = c.cast('Constructor_Method_Class');
+ assert(d);
+});
+
+if (!suiteSuccess) {
+ print ("[ Total tests run: %s ]", suiteOk + suiteFail.length);
+ print ("[ Total successful: %s ]", suiteOk);
+ print ("[ Total failures: %s ]", suiteFail.length);
+ print ("[ Tests failed: ]");
+ for (var i = 0; i < suiteFail.length; i++) {
+ print ("[ %s]", suiteFail[i]);
+ };
+ assert(false, "[ Test suite fail ]");
+} else {
+ print ("[ Test execution with success ]");
+ print ("[ Total tests run: %s ]", suiteOk);
+}
+
+exit();
diff --git a/src/tests/eolian_js/eolian_js_test_constructor_method_impl.c b/src/tests/eolian_js/eolian_js_test_constructor_method_impl.c
new file mode 100644
index 0000000000..1f454ebbf2
--- /dev/null
+++ b/src/tests/eolian_js/eolian_js_test_constructor_method_impl.c
@@ -0,0 +1,147 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <Eo.h>
+#include <Ecore.h>
+
+#include <stdlib.h>
+
+#include "constructor_method_class.eo.h"
+
+#include <check.h>
+
+struct _Constructor_Method_Class_Data
+{
+ Eina_Bool fail;
+};
+typedef struct _Constructor_Method_Class_Data Constructor_Method_Class_Data;
+
+#define MY_CLASS CONSTRUCTOR_METHOD_CLASS_CLASS
+
+EOLIAN static Eo_Base *
+_constructor_method_class_eo_base_constructor(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd)
+{
+ pd->fail = EINA_FALSE;
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
+}
+
+EOLIAN static void
+_constructor_method_class_constructor1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one)
+{
+ fprintf(stderr, "one == %d\n", one);
+ fflush(stderr);
+ if (one != 5)
+ pd->fail = EINA_TRUE;
+}
+
+EOLIAN static void
+_constructor_method_class_constructor2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, double two)
+{
+ fprintf(stderr, "two == %f\n", two);
+ fflush(stderr);
+ if (two != 10.0)
+ pd->fail = EINA_TRUE;
+}
+
+EOLIAN static Eo *
+_constructor_method_class_eo_base_finalize(Eo *obj, Constructor_Method_Class_Data *pd)
+{
+ if (pd->fail)
+ return NULL;
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
+EOLIAN static Eina_Bool
+_constructor_method_class_fail_get(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd)
+{
+ return pd->fail;
+}
+
+EOLIAN static void
+_constructor_method_class_method1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one)
+{
+ fprintf(stderr, "method1 one == %d\n", one);
+ fflush(stderr);
+ if (one != 2)
+ pd->fail = EINA_TRUE;
+}
+
+EOLIAN static int
+_constructor_method_class_method2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one)
+{
+ fprintf(stderr, "method2 one == %d\n", one);
+ fflush(stderr);
+ if (one != 3)
+ pd->fail = EINA_TRUE;
+ return 5;
+}
+
+EOLIAN static void
+_constructor_method_class_method3(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one, double two)
+{
+ fprintf(stderr, "method3 one == %d two == %f\n", one, two);
+ fflush(stderr);
+ if (one != 3)
+ pd->fail = EINA_TRUE;
+ if (two != 11.1)
+ pd->fail = EINA_TRUE;
+}
+
+EOLIAN static int
+_constructor_method_class_method4(Eo * obj EINA_UNUSED, Constructor_Method_Class_Data *pd, int one, double two)
+{
+ fprintf(stderr, "method4 one == %d two == %f\n", one, two);
+ fflush(stderr);
+ if (one != 3)
+ pd->fail = EINA_TRUE;
+ if (two != 11.1)
+ pd->fail = EINA_TRUE;
+ return 5;
+}
+
+EOLIAN static void
+_constructor_method_class_outmethod1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int *one)
+{
+ fprintf(stderr, "outmethod1\n");
+ fflush(stderr);
+ *one = 5;
+}
+
+EOLIAN static int
+_constructor_method_class_outmethod2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int *one)
+{
+ fprintf(stderr, "outmethod2\n");
+ fflush(stderr);
+ *one = 10;
+ return 11;
+}
+
+EOLIAN static void
+_constructor_method_class_outmethod3(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int *one, double *two)
+{
+ fprintf(stderr, "outmethod3\n");
+ fflush(stderr);
+ *one = 11;
+ *two = 5.1;
+}
+
+EOLIAN static Constructor_Method_Class *
+_constructor_method_class_classoutmethod1(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int one, double two)
+{
+ fprintf(stderr, "classoutmethod1\n");
+ fflush(stderr);
+ return eo_add(MY_CLASS, NULL, constructor_method_class_constructor1(one), constructor_method_class_constructor2(two));
+}
+
+EOLIAN static void
+_constructor_method_class_classoutmethod2(Eo* obj EINA_UNUSED, Constructor_Method_Class_Data *pd EINA_UNUSED, int one, double two, Constructor_Method_Class **out_class)
+{
+ fprintf(stderr, "classoutmethod2\n");
+ fflush(stderr);
+ *out_class = eo_add(MY_CLASS, NULL, constructor_method_class_constructor1(one), constructor_method_class_constructor2(two));
+}
+
+
+#include <constructor_method_class.eo.c>
diff --git a/src/tests/eolian_js/eolian_js_test_eolian_js_binding.cc b/src/tests/eolian_js/eolian_js_test_eolian_js_binding.cc
new file mode 100644
index 0000000000..dbdd016a34
--- /dev/null
+++ b/src/tests/eolian_js/eolian_js_test_eolian_js_binding.cc
@@ -0,0 +1,44 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <Eo_Js.hh>
+#include <Eina.hh>
+#include <Eo.hh>
+
+#include <check.h>
+
+
+#include <iostream>
+#include <cassert>
+#include <fstream>
+
+typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark;
+
+#include "constructor_method_class.eo.js.cc"
+#include "test_object.eo.js.cc"
+
+#ifdef EAPI
+# undef EAPI
+#endif
+
+#ifdef _WIN32
+# define EAPI __declspec(dllimport)
+#else
+# ifdef __GNUC__
+# if __GNUC__ >= 4
+# define EAPI __attribute__ ((visibility("default")))
+# else
+# define EAPI
+# endif
+# else
+# define EAPI
+# endif
+#endif /* ! _WIN32 */
+
+void eolian_js_test_register_eolian_js_binding(v8::Handle<v8::Object> exports)
+{
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ test::register_object(exports, isolate);
+ register_constructor_method_class(exports, isolate);
+}
diff --git a/src/tests/eolian_js/eolian_js_test_evas_box.cc b/src/tests/eolian_js/eolian_js_test_evas_box.cc
new file mode 100644
index 0000000000..e859f2a24f
--- /dev/null
+++ b/src/tests/eolian_js/eolian_js_test_evas_box.cc
@@ -0,0 +1,151 @@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <Eo_Js.hh>
+#include <Eina.hh>
+#include <Eo.hh>
+
+#include <check.h>
+
+#include <iostream>
+
+#include <cassert>
+#include <tuple>
+
+namespace evas {
+EAPI void register_box(v8::Handle<v8::Object> global, v8::Isolate* isolate);
+}
+
+namespace {
+
+static const char script[] =
+ "function assert(condition, message) {\n"
+ " if (!condition) {\n"
+ " print(\"Assertion failed \", message);\n"
+ " throw message || \"Assertion failed\";\n"
+ " }\n"
+ "}\n"
+ "print(\"teste\");\n"
+ "x = new Box();\n"
+ ;
+
+const char* ToCString(const v8::String::Utf8Value& value) {
+ return *value ? *value : "<string conversion failed>";
+}
+
+// Executes a string within the current v8 context.
+bool ExecuteString(v8::Isolate* isolate,
+ v8::Handle<v8::String> source,
+ v8::Handle<v8::Value> name)
+{
+ efl::eina::js::compatibility_handle_scope handle_scope(isolate);
+ v8::TryCatch try_catch;
+ v8::ScriptOrigin origin(name);
+ v8::Handle<v8::Script> script = v8::Script::Compile(source, &origin);
+ if (script.IsEmpty()) {
+ std::abort();
+ // Print errors that happened during compilation.
+ // if (report_exceptions)
+ // ReportException(isolate, &try_catch);
+ return false;
+ }
+ else
+ {
+ v8::Handle<v8::Value> result = script->Run();
+ if (result.IsEmpty()) {
+ std::cout << "Failed with exception thrown" << std::endl;
+ assert(try_catch.HasCaught());
+ std::abort();
+ // Print errors that happened during execution.
+ // if (report_exceptions)
+ // ReportException(isolate, &try_catch);
+ return false;
+ } else {
+ assert(!try_catch.HasCaught());
+ // if (print_result && !result->IsUndefined()) {
+ // // If all went well and the result wasn't undefined then print
+ // // the returned value.
+ // v8::String::Utf8Value str(result);
+ // const char* cstr = ToCString(str);
+ // printf("%s\n", cstr);
+ // }
+ return true;
+ }
+ }
+}
+
+efl::eina::js::compatibility_return_type Print(efl::eina::js::compatibility_callback_info_type args) {
+ bool first = true;
+ for (int i = 0; i < args.Length(); i++) {
+ efl::eina::js::compatibility_handle_scope handle_scope(args.GetIsolate());
+ if (first) {
+ first = false;
+ } else {
+ printf(" ");
+ }
+ v8::String::Utf8Value str(args[i]);
+ const char* cstr = ToCString(str);
+ printf("%s", cstr);
+ }
+ printf("\n");
+ fflush(stdout);
+}
+
+START_TEST(eolian_js_test_evas_box)
+{
+ int argc = 1;
+ const char* argv[] = {"test"};
+ efl::eina::eina_init eina_init;
+ efl::eo::eo_init eo_init;
+
+ //v8::V8::InitializeICU();
+ v8::V8::Initialize();
+ v8::V8::SetFlagsFromCommandLine(&argc, const_cast<char**>(argv), true);
+
+ v8::Isolate* isolate = efl::eina::js::compatibility_isolate_new();
+
+ v8::Isolate::Scope isolate_scope(isolate);
+
+ assert(isolate != 0);
+
+ v8::Handle<v8::Context> context;
+ efl::eina::js::compatibility_handle_scope handle_scope(isolate);
+
+ {
+ // Create a template for the global object.
+ v8::Handle<v8::ObjectTemplate> global = efl::eina::js::compatibility_new<v8::ObjectTemplate>(isolate);
+ // Bind the global 'print' function to the C++ Print callback.
+ global->Set(efl::eina::js::compatibility_new<v8::String>(isolate, "print"),
+ efl::eina::js::compatibility_new<v8::FunctionTemplate>(isolate, Print));
+
+ context = efl::eina::js::compatibility_new<v8::Context>(isolate, nullptr, global);
+
+ }
+ if (context.IsEmpty()) {
+ fprintf(stderr, "Error creating context\n");
+ }
+ context->Enter();
+ {
+ // Enter the execution environment before evaluating any code.
+ v8::Context::Scope context_scope(context);
+ v8::Local<v8::String> name(efl::eina::js::compatibility_new<v8::String>(/*context->GetIsolate()*/nullptr, "(shell)"));
+
+ evas::register_box(context->Global(), isolate);
+
+ efl::eina::js::compatibility_handle_scope handle_scope(/*context->GetIsolate()*/nullptr);
+ ExecuteString(/*context->GetIsolate()*/isolate,
+ efl::eina::js::compatibility_new<v8::String>/*FromUtf8*/(/*context->GetIsolate()*/nullptr, script),
+ name);
+ }
+ context->Exit();
+}
+END_TEST
+
+}
+
+void eolian_js_test_evas_box(TCase* tc)
+{
+ tcase_add_test(tc, eolian_js_test_evas_box);
+}
diff --git a/src/tests/eolian_js/eolian_js_test_test_object_impl.c b/src/tests/eolian_js/eolian_js_test_test_object_impl.c
new file mode 100644
index 0000000000..6f35b7ecdd
--- /dev/null
+++ b/src/tests/eolian_js/eolian_js_test_test_object_impl.c
@@ -0,0 +1,620 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <Eo.h>
+#include <Ecore.h>
+
+#include "test_object.eo.h"
+
+#include <check.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <math.h>
+#include <stdlib.h>
+
+struct _Test_Object_Data
+{
+ int a;
+};
+
+typedef struct _Test_Object_Data Test_Object_Data;
+
+#define MY_CLASS TEST_OBJECT_CLASS
+
+EOLIAN static Eo_Base *
+_test_object_eo_base_constructor(Eo* obj, Test_Object_Data *pd)
+{
+ fprintf(stdout, "_test_object_eo_base_constructor\n");
+
+ pd->a = 0;
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
+}
+
+EOLIAN static Eo *
+_test_object_eo_base_finalize(Eo *obj, Test_Object_Data *pd EINA_UNUSED)
+{
+ fprintf(stdout, "_test_object_eo_base_finalize\n");
+
+ return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
+EOLIAN static void
+_test_object_eo_base_destructor(Eo* obj, Test_Object_Data *pd EINA_UNUSED)
+{
+ fprintf(stdout, "_test_object_eo_base_destructor\n");
+ eo_do_super(obj, MY_CLASS, eo_destructor());
+}
+
+
+EOLIAN static void
+_test_object_method_integral_in_a(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd,
+ int a)
+{
+ fprintf(stdout, "_test_object_method_integral_in_a(%d)\n", a);
+ pd->a = a;
+}
+
+EOLIAN static void
+_test_object_method_integral_out_a(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd,
+ int *a)
+{
+ fprintf(stdout, "_test_object_method_integral_out_a(%p)\n", a);
+ *a = pd->a;
+}
+
+EOLIAN static void
+_test_object_method_integral_inout(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ int *a)
+{
+ fprintf(stdout, "_test_object_method_integral_inout(%d [%p])\n", *a, a);
+ *a = -(*a);
+}
+
+EOLIAN static int
+_test_object_method_integral_return_a(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd)
+{
+ fprintf(stdout, "_test_object_method_integral_return_a()\n");
+ return pd->a;
+}
+
+EOLIAN static Eina_Bool
+_test_object_method_div_mod(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ int a,
+ int b,
+ int *quotient,
+ int *remainder)
+{
+ fprintf(stdout, "_test_object_method_div_mod(%d, %d, %p, %p)\n", a, b, quotient, remainder);
+ if (0 == b) return EINA_FALSE;
+ *quotient = a / b;
+ *remainder = a % b;
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_test_object_method_and(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Bool a,
+ Eina_Bool b)
+{
+ fprintf(stdout, "_test_object_method_and(%d, %d)\n", a, b);
+ return a && b;
+}
+
+EOLIAN static double
+_test_object_method_modf(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ double x,
+ double *int_part)
+{
+ fprintf(stdout, "_test_object_method_modf(%f, %p)\n", x, int_part);
+ return modf(x, int_part);
+}
+
+EOLIAN static void
+_test_object_method_uppercase(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ char **str)
+{
+ fprintf(stdout, "_test_object_method_uppercase('%s')\n", *str);
+ if (!*str) return;
+
+ char *p = *str;
+ while ('\0' != *p)
+ {
+ *p = toupper(*p);
+ p++;
+ }
+}
+
+EOLIAN static Eina_Bool
+_test_object_method_in_null(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ char *a)
+{
+ fprintf(stdout, "_test_object_method_in_null(%p)\n", a);
+ return NULL == a;
+}
+
+EOLIAN static Eina_Bool
+_test_object_method_out_null(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ char **a)
+{
+ fprintf(stdout, "_test_object_method_out_null(%p)\n", a);
+ *a = NULL;
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_test_object_method_inout_null(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ char **a)
+{
+ fprintf(stdout, "_test_object_method_inout_null(%p)\n", a);
+ return NULL == *a;
+}
+
+EOLIAN static char *
+_test_object_method_return_null(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED)
+{
+ fprintf(stdout, "_test_object_method_return_null()\n");
+ return NULL;
+}
+
+EOLIAN static void
+_test_object_call_event(Eo* obj, Test_Object_Data *pd EINA_UNUSED)
+{
+ fprintf(stderr, "_test_object_event_call()\n"); fflush(stderr);
+ static Test_Struct_Ex s = {42, TEST_ENUM_EX_THIRD};
+ eo_do(obj, eo_event_callback_call(TEST_OBJECT_EVENT_TEST, NULL));
+ eo_do(obj, eo_event_callback_call(TEST_OBJECT_EVENT_TEST_STRUCTARG, &s));
+ eo_do(obj, eo_event_callback_call(TEST_OBJECT_EVENT_TEST_STRINGARG, "foo"));
+}
+
+EOLIAN static char *
+_test_object_method_null(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ char *in,
+ char **out,
+ char **inout)
+{
+ fprintf(stdout, "_test_object_method_null(%p, %p, %p)\n", in, out, inout);
+ assert(!in);
+ *out = NULL;
+ *inout = NULL;
+ return NULL;
+}
+
+// Arrays //
+
+EOLIAN static int
+_test_object_method_array_at(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *array,
+ int index)
+{
+ fprintf(stdout, "_test_object_method_array_at(%p, %d)\n", array, index);
+ return *((int*)eina_array_data_get(array, index));
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_with_42(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED)
+{
+ fprintf(stdout, "_test_object_method_array_with_42()\n");
+ Eina_Array *arr = eina_array_new(2);
+ int* n = malloc(sizeof(int));
+ *n = 42;
+ eina_array_push(arr, n);
+ return arr;
+}
+
+EOLIAN static void
+_test_object_method_array_in_array_out(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in,
+ Eina_Array **a_out)
+{
+ fprintf(stdout, "_test_object_method_array_in_array_out(%p, %p)\n", a_in, a_out);
+ *a_out = a_in;
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_objects(Eo* obj,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_objects(%p)\n", a_in);
+ if (a_in) return a_in;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, obj);
+ return arr;
+}
+
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_strings(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_strings(%p)\n", a_in);
+ if (a_in) return a_in;
+ Eina_Array *arr = eina_array_new(2);
+ const char* v = "foo";
+ fprintf(stdout, "v = %p\n", v);
+ eina_array_push(arr, v);
+ return arr;
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_ints(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_ints(%p)\n", a_in);
+ if (a_in) return a_in;
+ int *v = malloc(sizeof(int));
+ *v = 42;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return arr;
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_bools(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_bools(%p)\n", a_in);
+ if (a_in) return a_in;
+ Eina_Bool *v = malloc(sizeof(Eina_Bool));
+ *v = EINA_TRUE;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return arr;
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_doubles(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_doubles(%p)\n", a_in);
+ if (a_in) return a_in;
+ double *v = malloc(sizeof(double));
+ *v = 42;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return arr;
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_enums(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_enums(%p)\n", a_in);
+ if (a_in) return a_in;
+ Test_Enum_Ex *v = malloc(sizeof(Test_Enum_Ex));
+ *v = TEST_ENUM_EX_THIRD;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return arr;
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_structs(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_structs(%p)\n", a_in);
+ if (a_in) return a_in;
+ Test_Struct_Ex *v = malloc(sizeof(Test_Struct_Ex));
+ v->value_int = 42;
+ v->value_enum = TEST_ENUM_EX_THIRD;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return arr;
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_arrays_of_ints(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_arrays_of_ints(%p)\n", a_in);
+ if (a_in) return a_in;
+ int *v = malloc(sizeof(int));
+ *v = 42;
+ Eina_Array *a1 = eina_array_new(2);
+ eina_array_push(a1, v);
+ Eina_Array *a2 = eina_array_new(2);
+ eina_array_push(a2, a1);
+ return a2;
+}
+
+// Lists //
+
+EOLIAN static Eina_List *
+_test_object_method_list_with_42(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED)
+{
+ fprintf(stdout, "_test_object_method_list_with_42()\n");
+ int* n = malloc(sizeof(int));
+ *n = 42;
+ return eina_list_append(NULL, n);
+}
+
+EOLIAN static void
+_test_object_method_list_in_list_out(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in,
+ Eina_List **l_out)
+{
+ fprintf(stdout, "_test_object_method_list_in_list_out(%p , %p)\n", l_in, l_out);
+ *l_out = l_in;
+}
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_objects(Eo* obj,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_objects(%p)\n", l_in);
+ if (l_in) return l_in;
+ return eina_list_append(NULL, obj);
+}
+
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_strings(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_strings(%p)\n", l_in);
+ if (l_in) return l_in;
+ return eina_list_append(NULL, "foo");
+}
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_ints(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_ints(%p)\n", l_in);
+ if (l_in) return l_in;
+ int *v = malloc(sizeof(int));
+ *v = 42;
+ return eina_list_append(NULL, v);
+}
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_bools(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_bools(%p)\n", l_in);
+ if (l_in) return l_in;
+ Eina_Bool *v = malloc(sizeof(Eina_Bool));
+ *v = EINA_TRUE;
+ return eina_list_append(NULL, v);
+}
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_doubles(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_doubles(%p)\n", l_in);
+ if (l_in) return l_in;
+ double *v = malloc(sizeof(double));
+ *v = 42;
+ return eina_list_append(NULL, v);
+}
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_enums(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_enums(%p)\n", l_in);
+ if (l_in) return l_in;
+ Test_Enum_Ex *v = malloc(sizeof(Test_Enum_Ex));
+ *v = TEST_ENUM_EX_THIRD;
+ return eina_list_append(NULL, v);
+}
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_structs(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_structs(%p)\n", l_in);
+ if (l_in) return l_in;
+ Test_Struct_Ex *v = malloc(sizeof(Test_Struct_Ex));
+ v->value_int = 42;
+ v->value_enum = TEST_ENUM_EX_THIRD;
+ return eina_list_append(NULL, v);
+}
+
+// Accessors //
+
+EOLIAN static Eina_Accessor *
+_test_object_method_accessor_of_objects(Eo* obj,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Accessor *a_in)
+{
+ fprintf(stdout, "_test_object_method_accessor_of_objects(%p)\n", a_in);
+ if (a_in) return a_in;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, obj);
+ return eina_array_accessor_new(arr);
+}
+
+EOLIAN static Eina_Accessor *
+_test_object_method_accessor_of_strings(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Accessor *a_in)
+{
+ fprintf(stdout, "_test_object_method_accessor_of_strings(%p)\n", a_in);
+ if (a_in) return a_in;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, "foo");
+ return eina_array_accessor_new(arr);
+}
+
+EOLIAN static Eina_Accessor *
+_test_object_method_accessor_of_ints(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Accessor *a_in)
+{
+ fprintf(stdout, "_test_object_method_accessor_of_ints(%p)\n", a_in);
+ if (a_in) return a_in;
+ int *v = malloc(sizeof(int));
+ *v = 42;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return eina_array_accessor_new(arr);
+}
+
+EOLIAN static Eina_Accessor *
+_test_object_method_accessor_of_bools(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Accessor *a_in)
+{
+ fprintf(stdout, "_test_object_method_accessor_of_bools(%p)\n", a_in);
+ if (a_in) return a_in;
+ Eina_Bool *v = malloc(sizeof(Eina_Bool));
+ *v = EINA_TRUE;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return eina_array_accessor_new(arr);
+}
+
+EOLIAN static Eina_Accessor *
+_test_object_method_accessor_of_doubles(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Accessor *a_in)
+{
+ fprintf(stdout, "_test_object_method_accessor_of_doubles(%p)\n", a_in);
+ if (a_in) return a_in;
+ double *v = malloc(sizeof(double));
+ *v = 42.0;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return eina_array_accessor_new(arr);
+}
+
+EOLIAN static Eina_Accessor *
+_test_object_method_accessor_of_enums(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Accessor *a_in)
+{
+ fprintf(stdout, "_test_object_method_accessor_of_enums(%p)\n", a_in);
+ if (a_in) return a_in;
+ Test_Enum_Ex *v = malloc(sizeof(Test_Enum_Ex));
+ *v = TEST_ENUM_EX_THIRD;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return eina_array_accessor_new(arr);
+}
+
+EOLIAN static Eina_Accessor *
+_test_object_method_accessor_of_structs(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Accessor *a_in)
+{
+ fprintf(stdout, "_test_object_method_accessor_of_structs(%p)\n", a_in);
+ if (a_in) return a_in;
+ Test_Struct_Ex *v = malloc(sizeof(Test_Struct_Ex));
+ v->value_int = 42;
+ v->value_enum = TEST_ENUM_EX_THIRD;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return eina_array_accessor_new(arr);
+}
+
+// Combinations of complex types
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_lists_of_ints(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_lists_of_ints(%p)\n", l_in);
+ if (l_in) return l_in;
+ int *v = malloc(sizeof(int));
+ *v = 42;
+ return eina_list_append(NULL, eina_list_append(NULL, v));
+}
+
+EOLIAN static Eina_Array *
+_test_object_method_array_of_lists_of_ints(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_Array *a_in)
+{
+ fprintf(stdout, "_test_object_method_array_of_lists_of_ints(%p)\n", a_in);
+ if (a_in) return a_in;
+ int *v = malloc(sizeof(int));
+ *v = 42;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, eina_list_append(NULL, v));
+ return arr;
+}
+
+EOLIAN static Eina_List *
+_test_object_method_list_of_arrays_of_ints(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Eina_List *l_in)
+{
+ fprintf(stdout, "_test_object_method_list_of_arrays_of_ints(%p)\n", l_in);
+ if (l_in) return l_in;
+ int *v = malloc(sizeof(int));
+ *v = 42;
+ Eina_Array *arr = eina_array_new(2);
+ eina_array_push(arr, v);
+ return eina_list_append(NULL, arr);
+}
+
+EOLIAN static const Eina_List *
+_test_object_method_list_with_opaque_elements(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED)
+{
+ fprintf(stdout, "_test_object_method_list_with_opaque_elements()\n");
+ return NULL;
+}
+
+EOLIAN static Test_Enum_Ex
+_test_object_method_in_enum_return_enum(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Test_Enum_Ex e)
+{
+ fprintf(stdout, "_test_object_method_in_enum_return_enum(%d)\n", e);
+ return e;
+}
+
+EOLIAN static Test_Struct_Ex *
+_test_object_method_in_struct_return_struct(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED,
+ Test_Struct_Ex *s)
+{
+ fprintf(stdout, "_test_object_method_in_struct_return_struct()\n");
+ return s;
+}
+
+EOLIAN static void
+_test_object_event_repeated_event_name(Eo* obj EINA_UNUSED,
+ Test_Object_Data *pd EINA_UNUSED)
+{
+}
+
+#include <test_object.eo.c>
diff --git a/src/tests/eolian_js/test_object.eo b/src/tests/eolian_js/test_object.eo
new file mode 100644
index 0000000000..c292c248e7
--- /dev/null
+++ b/src/tests/eolian_js/test_object.eo
@@ -0,0 +1,305 @@
+enum Test.Enum_Ex {
+ first = 0,
+ second,
+ third,
+ fourth
+}
+
+struct Test.Struct_Ex {
+ value_int: int;
+ value_enum: Test.Enum_Ex;
+}
+
+class Test.Object (Eo.Base) {
+ legacy_prefix: null;
+ methods {
+ method_integral_in_a {
+ [[ tests integral in ]]
+ params { a: int; }
+ }
+ method_integral_out_a {
+ [[ tests integral out ]]
+ params { @out a: int; }
+ }
+ method_integral_inout {
+ [[ tests integral inout ]]
+ params { @inout a: int; }
+ }
+ method_integral_return_a {
+ [[ tests integral result ]]
+ return: int;
+ }
+ method_div_mod {
+ [[ tests mixed in, outs and result ]]
+ params {
+ a: int;
+ b: int;
+ @out quotient: int;
+ @out remainder: int;
+ }
+ return: bool;
+ }
+ method_and {
+ [[ tests boolean ]]
+ params {
+ a: bool;
+ b: bool;
+ }
+ return: bool;
+ }
+ method_modf {
+ [[ tests floating point ]]
+ params {
+ a: double;
+ @out int_part: double;
+ }
+ return: double;
+ }
+ method_uppercase {
+ [[ tests string ]]
+ params {
+ @inout str: char*;
+ }
+ }
+ method_in_null {
+ [[ tests null input ]]
+ params {
+ a: char*;
+ }
+ return: bool;
+ }
+ method_out_null {
+ [[ tests null output ]]
+ params {
+ @out a: char*;
+ }
+ return: bool;
+ }
+ method_inout_null {
+ [[ tests null output ]]
+ params {
+ @inout a: char*;
+ }
+ return: bool;
+ }
+ method_return_null {
+ [[ tests null return ]]
+ return: char*;
+ }
+ method_null {
+ [[ tests null values ]]
+ params {
+ in: char*;
+ @out out: char*;
+ @inout inout: char*;
+ }
+ return: char*;
+ }
+ method_array_at {
+ [[ tests array ]]
+ params {
+ array: array<int>*;
+ index: int;
+ }
+ return: int;
+ }
+ method_array_with_42 {
+ [[ tests parameters ]]
+ return: free(own(array<int> *), eina_array_free) @warn_unused;
+ }
+ method_array_in_array_out {
+ [[ tests parameters ]]
+ params {
+ @in a_in: array<int> *;
+ @out a_out: array<int> *;
+ }
+ }
+ method_array_of_objects {
+ params {
+ @in a_in: array<Test.Object *> *;
+ }
+ return: array<Test.Object *> *;
+ }
+ method_array_of_strings {
+ params {
+ @in a_in: array<const(char) *> *;
+ }
+ return: array<const(char) *> *;
+ }
+ method_array_of_ints {
+ params {
+ @in a_in: array<int> *;
+ }
+ return: array<int> *;
+ }
+ method_array_of_bools {
+ params {
+ @in a_in: array<bool> *;
+ }
+ return: array<bool> *;
+ }
+ method_array_of_doubles {
+ params {
+ @in a_in: array<double> *;
+ }
+ return: array<double> *;
+ }
+ method_array_of_enums {
+ params {
+ @in a_in: array<Test.Enum_Ex> *;
+ }
+ return: array<Test.Enum_Ex> *;
+ }
+ method_array_of_structs {
+ params {
+ @in a_in: array<Test.Struct_Ex> *;
+ }
+ return: array<Test.Struct_Ex> *;
+ }
+ method_list_with_42 {
+ [[ tests parameters ]]
+ return: free(own(list<int> *), eina_list_free) @warn_unused;
+ }
+ method_list_in_list_out {
+ [[ tests parameters ]]
+ params {
+ @in l_in: list<int> *;
+ @out l_out: list<int> *;
+ }
+ }
+ method_list_of_objects {
+ params {
+ @in l_in: list<Test.Object *> *;
+ }
+ return: list<Test.Object *> *;
+ }
+ method_list_of_strings {
+ params {
+ @in l_in: list<const(char) *> *;
+ }
+ return: list<const(char) *> *;
+ }
+ method_list_of_ints {
+ params {
+ @in l_in: list<int> *;
+ }
+ return: list<int> *;
+ }
+ method_list_of_bools {
+ params {
+ @in l_in: list<bool> *;
+ }
+ return: list<bool> *;
+ }
+ method_list_of_doubles {
+ params {
+ @in l_in: list<double> *;
+ }
+ return: list<double> *;
+ }
+ method_list_of_enums {
+ params {
+ @in l_in: list<Test.Enum_Ex> *;
+ }
+ return: list<Test.Enum_Ex> *;
+ }
+ method_list_of_structs {
+ params {
+ @in l_in: list<Test.Struct_Ex> *;
+ }
+ return: list<Test.Struct_Ex> *;
+ }
+ method_accessor_of_objects {
+ params {
+ @in a_in: accessor<Test.Object *> *;
+ }
+ return: accessor<Test.Object *> *;
+ }
+ method_accessor_of_strings {
+ params {
+ @in a_in: accessor<const(char) *> *;
+ }
+ return: accessor<const(char) *> *;
+ }
+ method_accessor_of_ints {
+ params {
+ @in a_in: accessor<int> *;
+ }
+ return: accessor<int> *;
+ }
+ method_accessor_of_bools {
+ params {
+ @in a_in: accessor<bool> *;
+ }
+ return: accessor<bool> *;
+ }
+ method_accessor_of_doubles {
+ params {
+ @in a_in: accessor<double> *;
+ }
+ return: accessor<double> *;
+ }
+ method_accessor_of_enums {
+ params {
+ @in a_in: accessor<Test.Enum_Ex> *;
+ }
+ return: accessor<Test.Enum_Ex> *;
+ }
+ method_accessor_of_structs {
+ params {
+ @in a_in: accessor<Test.Struct_Ex> *;
+ }
+ return: accessor<Test.Struct_Ex> *;
+ }
+ method_array_of_arrays_of_ints {
+ params {
+ @in a_in: array<array<int> *> *;
+ }
+ return: array<array<int> *> *;
+ }
+ method_list_of_lists_of_ints {
+ params {
+ @in l_in: list<list<int> *> *;
+ }
+ return: list<list<int> *> *;
+ }
+ method_array_of_lists_of_ints {
+ params {
+ @in a_in: array<list<int> *> *;
+ }
+ return: array<list<int> *> *;
+ }
+ method_list_of_arrays_of_ints {
+ params {
+ @in l_in: list<array<int> *> *;
+ }
+ return: list<array<int> *> *;
+ }
+ method_list_with_opaque_elements {
+ return: const(list<Elm.Calendar.Mark*>)*;
+ }
+ method_in_enum_return_enum {
+ params { e: Test.Enum_Ex; }
+ return: Test.Enum_Ex;
+ }
+ method_in_struct_return_struct {
+ params { e: Test.Struct_Ex *; }
+ return: Test.Struct_Ex *;
+ }
+ call_event {
+ }
+ event_repeated_event_name {
+ }
+ }
+ implements {
+ Eo.Base.finalize;
+ Eo.Base.constructor;
+ Eo.Base.destructor;
+ }
+ events {
+ test;
+ test,structarg: Test.Struct_Ex;
+ test,stringarg: const(char)*;
+ repeated,event,name;
+ }
+}