diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-11-27 14:35:09 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-11-27 14:35:09 +0000 |
commit | bd13543736d2042f8f6c68c145286f396ad632f9 (patch) | |
tree | 5f5d4cda65a17e36d8c3e5b1975f65ce7695848f /tests/tools | |
parent | 1069de984331165d72e5cbfa4576325a624ad9c7 (diff) |
Add a script to generate GObject type macros etc., and a test case
Diffstat (limited to 'tests/tools')
-rw-r--r-- | tests/tools/Makefile.am | 16 | ||||
-rw-r--r-- | tests/tools/expected-ginterface-foo.h | 16 | ||||
-rw-r--r-- | tests/tools/expected-gobject-foo.h | 21 | ||||
-rw-r--r-- | tests/tools/test-gobject-foo.sh | 18 |
4 files changed, 71 insertions, 0 deletions
diff --git a/tests/tools/Makefile.am b/tests/tools/Makefile.am index e69de29bb..df9ad4801 100644 --- a/tests/tools/Makefile.am +++ b/tests/tools/Makefile.am @@ -0,0 +1,16 @@ +dist_noinst_SCRIPTS = \ + test-gobject-foo.sh + +EXTRA_DIST = \ + expected-gobject-foo.h \ + expected-ginterface-foo.h + +all-local: + chmod +x $(dist_noinst_SCRIPTS) + +TESTS = $(dist_noinst_SCRIPTS) + +TESTS_ENVIRONMENT = \ + PYTHON=$(PYTHON) \ + srcdir=$(srcdir) \ + top_srcdir=$(top_srcdir) diff --git a/tests/tools/expected-ginterface-foo.h b/tests/tools/expected-ginterface-foo.h new file mode 100644 index 000000000..03761b229 --- /dev/null +++ b/tests/tools/expected-ginterface-foo.h @@ -0,0 +1,16 @@ +typedef struct _XyzBadgerMushroomSnake XyzBadgerMushroomSnake; +typedef struct _XyzBadgerMushroomSnakeClass XyzBadgerMushroomSnakeClass; +typedef struct _XyzBadgerMushroomSnakePrivate XyzBadgerMushroomSnakePrivate; + +GType xyz_badger_mushroom_snake_get_type (void); + +#define XYZ_BADGER_TYPE_MUSHROOM_SNAKE \ + (xyz_badger_mushroom_snake_get_type ()) +#define XYZ_BADGER_MUSHROOM_SNAKE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), XYZ_BADGER_TYPE_MUSHROOM_SNAKE, \ + XyzBadgerMushroomSnake)) +#define XYZ_BADGER_IS_MUSHROOM_SNAKE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XYZ_BADGER_TYPE_MUSHROOM_SNAKE)) +#define XYZ_BADGER_MUSHROOM_SNAKE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), XYZ_BADGER_TYPE_MUSHROOM_SNAKE, \ + XyzBadgerMushroomSnakeClass)) diff --git a/tests/tools/expected-gobject-foo.h b/tests/tools/expected-gobject-foo.h new file mode 100644 index 000000000..528ff5a50 --- /dev/null +++ b/tests/tools/expected-gobject-foo.h @@ -0,0 +1,21 @@ +typedef struct _XyzBadgerMushroomSnake XyzBadgerMushroomSnake; +typedef struct _XyzBadgerMushroomSnakeClass XyzBadgerMushroomSnakeClass; +typedef struct _XyzBadgerMushroomSnakePrivate XyzBadgerMushroomSnakePrivate; + +GType xyz_badger_mushroom_snake_get_type (void); + +#define XYZ_BADGER_TYPE_MUSHROOM_SNAKE \ + (xyz_badger_mushroom_snake_get_type ()) +#define XYZ_BADGER_MUSHROOM_SNAKE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), XYZ_BADGER_TYPE_MUSHROOM_SNAKE, \ + XyzBadgerMushroomSnake)) +#define XYZ_BADGER_MUSHROOM_SNAKE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), XYZ_BADGER_TYPE_MUSHROOM_SNAKE, \ + XyzBadgerMushroomSnakeClass)) +#define XYZ_BADGER_IS_MUSHROOM_SNAKE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XYZ_BADGER_TYPE_MUSHROOM_SNAKE)) +#define XYZ_BADGER_IS_MUSHROOM_SNAKE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), XYZ_BADGER_TYPE_MUSHROOM_SNAKE)) +#define XYZ_BADGER_MUSHROOM_SNAKE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), XYZ_BADGER_TYPE_MUSHROOM_SNAKE, \ + XyzBadgerMushroomSnakeClass)) diff --git a/tests/tools/test-gobject-foo.sh b/tests/tools/test-gobject-foo.sh new file mode 100644 index 000000000..465678102 --- /dev/null +++ b/tests/tools/test-gobject-foo.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e + +${PYTHON} ${top_srcdir}/tools/gobject-foo.py Xyz_Badger Mushroom_Snake \ + > gobject-foo.h +${PYTHON} ${top_srcdir}/tools/gobject-foo.py --interface \ + Xyz_Badger Mushroom_Snake > ginterface-foo.h + +e=0 +# We assume POSIX diff, until someone complains +diff -b -c ${srcdir}/expected-gobject-foo.h gobject-foo.h || e=$? +diff -b -c ${srcdir}/expected-ginterface-foo.h ginterface-foo.h || e=$? + +rm -f gobject-foo.h +rm -f ginterface-foo.h + +exit $e |