diff --git a/moo/medit-app/print-functions.py b/moo/medit-app/print-functions.py index 679a2cab..2d30e9fc 100644 --- a/moo/medit-app/print-functions.py +++ b/moo/medit-app/print-functions.py @@ -10,14 +10,16 @@ op.add_option("--output-lua", action="store") lua_functions = [] python_functions = [] -def walk(elm, lang, out): +def walk(elm, lang, out, cls=None): if elm.get('moo.private') == '1' or elm.get('moo.' + lang) == '0': return if elm.tag in ('module', 'class', 'boxed', 'pointer', 'enum', 'flags'): for child in elm.getchildren(): - walk(child, lang, out) + walk(child, lang, out, elm.get('name')) elif elm.tag in ('static-method', 'method', 'function', 'constructor'): print >>out, elm.get('c_name') + elif elm.tag in ('signal'): + print >>out, '%s::%s' % (cls, elm.get('name')) lua_out = open(opts.output_lua, 'w') python_out = open(opts.output_python, 'w') diff --git a/moo/moolua/moo-lua-api-util.cpp b/moo/moolua/moo-lua-api-util.cpp index 327ba906..4d7c8494 100644 --- a/moo/moolua/moo-lua-api-util.cpp +++ b/moo/moolua/moo-lua-api-util.cpp @@ -515,6 +515,9 @@ struct SignalClosure lua_State *L; GObject *instance; int cb_ref; +#ifdef MOO_ENABLE_COVERAGE + char *signal_full_name; +#endif }; static void signal_closure_finalize (G_GNUC_UNUSED gpointer dummy, GClosure *gclosure) @@ -701,6 +704,10 @@ signal_closure_marshal (SignalClosure *closure, { get_ret_gvalue (L, return_value); lua_pop (L, 1); + +#ifdef MOO_ENABLE_COVERAGE + moo_test_coverage_record ("lua", closure->full_signal_name); +#endif } else { @@ -772,6 +779,19 @@ cfunc_GObject_connect_impl (gpointer pself, lua_State *L, int first_arg, gboolea gulong cb_id = g_signal_connect_closure (self, signal, closure, after); g_closure_unref (closure); +#ifdef MOO_ENABLE_COVERAGE + if (cb_id != 0) + { + GSignalQuery query; + g_signal_query (g_signal_lookup (signal, G_OBJECT_TYPE (self)), &query); + g_assert (query.signal_id != 0); + ((SignalClosure*) closure)->signal_full_name = + g_strdup_printf ("%s::%s", + g_type_name (query.itype), + query.signal_name)); + } +#endif + moo_lua_push_int (L, cb_id); return 1; }