add python test for glib and test against lib

print->print_message is caused because GI does print->print_
in python bindings which is not good.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
pull/234/head
Igor Gnatenko 9 years ago
parent 7b0dd7299c
commit 0384fa9175
  1. 18
      test cases/frameworks/7 gnome/gir/meson-sample.c
  2. 2
      test cases/frameworks/7 gnome/gir/meson-sample.h
  3. 20
      test cases/frameworks/7 gnome/gir/meson.build
  4. 4
      test cases/frameworks/7 gnome/gir/prog.c
  5. 6
      test cases/frameworks/7 gnome/gir/prog.py
  6. 1
      test cases/frameworks/7 gnome/installed_files.txt

@ -17,6 +17,14 @@ enum {
static GParamSpec *gParamSpecs [LAST_PROP]; static GParamSpec *gParamSpecs [LAST_PROP];
/**
* meson_sample_new:
* @msg: The message to set.
*
* Allocates a new #MesonSample.
*
* Returns: (transfer full): a #MesonSample.
*/
MesonSample * MesonSample *
meson_sample_new (const gchar *msg) meson_sample_new (const gchar *msg)
{ {
@ -99,8 +107,16 @@ meson_sample_init (MesonSample *self)
{ {
} }
/**
* meson_sample_print_message:
* @self: a #MesonSample.
*
* Prints the message.
*
* Returns: Nothing.
*/
void void
meson_sample_print (MesonSample *self) meson_sample_print_message (MesonSample *self)
{ {
g_return_if_fail (MESON_IS_SAMPLE (self)); g_return_if_fail (MESON_IS_SAMPLE (self));

@ -14,7 +14,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (MesonSample, meson_sample, MESON, SAMPLE, GObject) G_DECLARE_FINAL_TYPE (MesonSample, meson_sample, MESON, SAMPLE, GObject)
MesonSample *meson_sample_new (const gchar *msg); MesonSample *meson_sample_new (const gchar *msg);
void meson_sample_print (MesonSample *self); void meson_sample_print_message (MesonSample *self);
G_END_DECLS G_END_DECLS

@ -1,13 +1,21 @@
libsources = ['meson-sample.c', 'meson-sample.h'] libsources = ['meson-sample.c', 'meson-sample.h']
girlib = shared_library(
'girlib',
sources : libsources,
dependencies : gobj,
install : true
)
girexe = executable( girexe = executable(
'girprog', 'girprog',
sources : [libsources, 'prog.c'], sources : 'prog.c',
dependencies : [glib, gobj, gir] dependencies : [glib, gobj, gir],
link_with : girlib
) )
gnome.generate_gir( gnome.generate_gir(
girexe, girlib,
sources : libsources, sources : libsources,
nsversion : '1.0', nsversion : '1.0',
namespace : 'Meson', namespace : 'Meson',
@ -17,4 +25,8 @@ gnome.generate_gir(
install : true install : true
) )
test('gobject introspection', girexe) test('gobject introspection/c', girexe)
test('gobject introspection/py', find_program('prog.py'),
env : ['GI_TYPELIB_PATH=@0@'.format(meson.current_build_dir()),
'LD_LIBRARY_PATH=@0@'.format(meson.current_build_dir()),
])

@ -16,8 +16,8 @@ main (gint argc,
return 1; return 1;
} }
g_autoptr(MesonSample) i = meson_sample_new ("Hello, meson!"); g_autoptr(MesonSample) i = meson_sample_new ("Hello, meson/c!");
meson_sample_print (i); meson_sample_print_message (i);
return 0; return 0;
} }

@ -0,0 +1,6 @@
#!/usr/bin/env python3
from gi.repository import Meson
if __name__ == "__main__":
s = Meson.Sample.new("Hello, meson/py!")
s.print_message()

@ -1,3 +1,4 @@
usr/lib/girepository-1.0/Meson-1.0.typelib usr/lib/girepository-1.0/Meson-1.0.typelib
usr/lib/libgirlib.so
usr/share/gir-1.0/Meson-1.0.gir usr/share/gir-1.0/Meson-1.0.gir
usr/share/glib-2.0/schemas/com.github.meson.gschema.xml usr/share/glib-2.0/schemas/com.github.meson.gschema.xml

Loading…
Cancel
Save