diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2010-04-13 19:15:49 -0400 |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2010-04-13 19:15:49 -0400 |
commit | 5a47e96e3f580c973e6880dafa747f54c144c760 (patch) | |
tree | 1728a626e6a8972c8ce1a6deb8eebc5a3657d14d | |
parent | 9fef1acb42cd900d4a814a7378f60bc189121785 (diff) | |
download | pygi-5a47e96e3f580c973e6880dafa747f54c144c760.tar.gz pygi-5a47e96e3f580c973e6880dafa747f54c144c760.tar.xz pygi-5a47e96e3f580c973e6880dafa747f54c144c760.zip |
Use GIMarshallingTests (old TestGI) in gobject-introspection
-rw-r--r-- | gi/overrides/TestGI.py | 69 | ||||
-rw-r--r-- | tests/Makefile.am | 40 | ||||
-rw-r--r-- | tests/libtestgi.c | 2924 | ||||
-rw-r--r-- | tests/libtestgi.h | 628 | ||||
-rw-r--r-- | tests/test_gi.py | 832 |
5 files changed, 416 insertions, 4077 deletions
diff --git a/gi/overrides/TestGI.py b/gi/overrides/TestGI.py deleted file mode 100644 index bbbe481..0000000 --- a/gi/overrides/TestGI.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# vim: tabstop=4 shiftwidth=4 expandtab -# -# Copyright (C) 2010 Simon van der Linden <svdlinden@src.gnome.org> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 -# USA - -from ..types import override -from ..importer import modules - -TestGI = modules['TestGI'] - - -OVERRIDES_CONSTANT = 7 - - -class OverridesStruct(TestGI.OverridesStruct): - - def __new__(cls, long_): - return TestGI.OverridesStruct.__new__(cls) - - def __init__(self, long_): - TestGI.OverridesStruct.__init__(self) - self.long_ = long_ - - def method(self): - return TestGI.OverridesStruct.method(self) / 7 - -OverridesStruct = override(OverridesStruct) - - -class OverridesObject(TestGI.OverridesObject): - - def __new__(cls, long_): - return TestGI.OverridesObject.__new__(cls) - - def __init__(self, long_): - TestGI.OverridesObject.__init__(self) - # FIXME: doesn't work yet - #self.long_ = long_ - - @classmethod - def new(cls, long_): - self = TestGI.OverridesObject.new() - # FIXME: doesn't work yet - #self.long_ = long_ - return self - - def method(self): - return TestGI.OverridesObject.method(self) / 7 - -OverridesObject = override(OverridesObject) - - -__all__ = [OVERRIDES_CONSTANT, OverridesStruct, OverridesObject] - diff --git a/tests/Makefile.am b/tests/Makefile.am index a014bfd..e3eb633 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,48 +1,8 @@ - -noinst_LTLIBRARIES = libtestgi.la - -libtestgi_la_CFLAGS = $(GNOME_CFLAGS) -libtestgi_la_LDFLAGS = -avoid-version -libtestgi_la_LIBADD = $(GNOME_LIBS) -libtestgi_la_SOURCES = \ - libtestgi.c \ - libtestgi.h - -# Force linking of a shared object. -libtestgi_la_LINK = $(LINK) -rpath $(pkgpyexecdir) - -TestGI-0.0.gir: libtestgi.la - $(AM_V_GEN) \ - $(INTROSPECTION_SCANNER) -v \ - --namespace TestGI \ - --nsversion 0.0 \ - $(GNOME_CFLAGS) \ - --include GObject-2.0 \ - --library libtestgi.la \ - --libtool "$(top_builddir)/libtool" \ - --pkg gobject-2.0 \ - --output $@ \ - $(addprefix $(srcdir)/,$(libtestgi_la_SOURCES)) - -BUILT_GIRSOURCES = TestGI-0.0.gir - noinst_PYTHON = \ runtests.py \ test_gi.py -nodist_noinst_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) - -CLEANFILES = \ - $(BUILT_GIRSOURCES) \ - $(BUILT_GIRSOURCES:.gir=.typelib) - - check-local: - GI_TYPELIB_PATH=$(srcdir)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \ LD_LIBRARY_PATH=$(srcdir)/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \ $(PYTHON) $(srcdir)/runtests.py $$TEST_NAMES -.gir.typelib: - $(AM_V_GEN) \ - LD_LIBRARY_PATH=$(srcdir)/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \ - $(INTROSPECTION_COMPILER) --includedir=$(srcdir) $< -o $(@F) diff --git a/tests/libtestgi.c b/tests/libtestgi.c deleted file mode 100644 index a9edf21..0000000 --- a/tests/libtestgi.c +++ /dev/null @@ -1,2924 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - */ - -#include "libtestgi.h" - -#include <string.h> - - -/* Booleans */ - -gboolean -test_gi_boolean_return_true (void) -{ - return TRUE; -} - -gboolean -test_gi_boolean_return_false (void) -{ - return FALSE; -} - -void -test_gi_boolean_in_true (gboolean bool_) -{ - g_assert (bool_ == TRUE); -} - -void -test_gi_boolean_in_false (gboolean bool_) -{ - g_assert (bool_ == FALSE); -} - -/** - * test_gi_boolean_out_true: - * bool_: (out): - */ -void -test_gi_boolean_out_true (gboolean *bool_) -{ - *bool_ = TRUE; -} - -/** - * test_gi_boolean_out_false: - * bool_: (out): - */ -void -test_gi_boolean_out_false (gboolean *bool_) -{ - *bool_ = FALSE; -} - -/** - * test_gi_boolean_inout_true_false: - * bool_: (inout): - */ -void -test_gi_boolean_inout_true_false (gboolean *bool_) -{ - g_assert (*bool_ == TRUE); - *bool_ = FALSE; -} - -/** - * test_gi_boolean_inout_false_true: - * bool_: (inout): - */ -void -test_gi_boolean_inout_false_true (gboolean *bool_) -{ - g_assert (*bool_ == FALSE); - *bool_ = TRUE; -} - - -/* Integers */ - -gint8 -test_gi_int8_return_max (void) -{ - return G_MAXINT8; -} - -gint8 -test_gi_int8_return_min (void) -{ - return G_MININT8; -} - -void -test_gi_int8_in_max (gint8 int8) -{ - g_assert(int8 == G_MAXINT8); -} - -void -test_gi_int8_in_min (gint8 int8) -{ - g_assert(int8 == G_MININT8); -} - -/** - * test_gi_int8_out_max: - * int8: (out): - */ -void -test_gi_int8_out_max (gint8 *int8) -{ - *int8 = G_MAXINT8; -} - -/** - * test_gi_int8_out_min: - * int8: (out): - */ -void -test_gi_int8_out_min (gint8 *int8) -{ - *int8 = G_MININT8; -} - -/** - * test_gi_int8_inout_max_min: - * int8: (inout): - */ -void -test_gi_int8_inout_max_min (gint8 *int8) -{ - g_assert(*int8 == G_MAXINT8); - *int8 = G_MININT8; -} - -/** - * test_gi_int8_inout_min_max: - * int8: (inout): - */ -void -test_gi_int8_inout_min_max (gint8 *int8) -{ - g_assert(*int8 == G_MININT8); - *int8 = G_MAXINT8; -} - - -guint8 -test_gi_uint8_return (void) -{ - return G_MAXUINT8; -} - -void -test_gi_uint8_in (guint8 uint8) -{ - g_assert(uint8 == G_MAXUINT8); -} - -/** - * test_gi_uint8_out: - * uint8: (out): - */ -void -test_gi_uint8_out (guint8 *uint8) -{ - *uint8 = G_MAXUINT8; -} - -/** - * test_gi_uint8_inout: - * uint8: (inout): - */ -void -test_gi_uint8_inout (guint8 *uint8) -{ - g_assert(*uint8 == G_MAXUINT8); - *uint8 = 0; -} - - -gint16 -test_gi_int16_return_max (void) -{ - return G_MAXINT16; -} - -gint16 -test_gi_int16_return_min (void) -{ - return G_MININT16; -} - -void -test_gi_int16_in_max (gint16 int16) -{ - g_assert(int16 == G_MAXINT16); -} - -void -test_gi_int16_in_min (gint16 int16) -{ - g_assert(int16 == G_MININT16); -} - -/** - * test_gi_int16_out_max: - * int16: (out): - */ -void -test_gi_int16_out_max (gint16 *int16) -{ - *int16 = G_MAXINT16; -} - -/** - * test_gi_int16_out_min: - * int16: (out): - */ -void -test_gi_int16_out_min (gint16 *int16) -{ - *int16 = G_MININT16; -} - -/** - * test_gi_int16_inout_max_min: - * int16: (inout): - */ -void -test_gi_int16_inout_max_min (gint16 *int16) -{ - g_assert(*int16 == G_MAXINT16); - *int16 = G_MININT16; -} - -/** - * test_gi_int16_inout_min_max: - * int16: (inout): - */ -void -test_gi_int16_inout_min_max (gint16 *int16) -{ - g_assert(*int16 == G_MININT16); - *int16 = G_MAXINT16; -} - - -guint16 -test_gi_uint16_return (void) -{ - return G_MAXUINT16; -} - -void -test_gi_uint16_in (guint16 uint16) -{ - g_assert(uint16 == G_MAXUINT16); -} - -/** - * test_gi_uint16_out: - * uint16: (out): - */ -void -test_gi_uint16_out (guint16 *uint16) -{ - *uint16 = G_MAXUINT16; -} - -/** - * test_gi_uint16_inout: - * uint16: (inout): - */ -void -test_gi_uint16_inout (guint16 *uint16) -{ - g_assert(*uint16 == G_MAXUINT16); - *uint16 = 0; -} - - -gint32 -test_gi_int32_return_max (void) -{ - return G_MAXINT32; -} - -gint32 -test_gi_int32_return_min (void) -{ - return G_MININT32; -} - -void -test_gi_int32_in_max (gint32 int32) -{ - g_assert(int32 == G_MAXINT32); -} - -void -test_gi_int32_in_min (gint32 int32) -{ - g_assert(int32 == G_MININT32); -} - -/** - * test_gi_int32_out_max: - * int32: (out): - */ -void -test_gi_int32_out_max (gint32 *int32) -{ - *int32 = G_MAXINT32; -} - -/** - * test_gi_int32_out_min: - * int32: (out): - */ -void -test_gi_int32_out_min (gint32 *int32) -{ - *int32 = G_MININT32; -} - -/** - * test_gi_int32_inout_max_min: - * int32: (inout): - */ -void -test_gi_int32_inout_max_min (gint32 *int32) -{ - g_assert(*int32 == G_MAXINT32); - *int32 = G_MININT32; -} - -/** - * test_gi_int32_inout_min_max: - * int32: (inout): - */ -void -test_gi_int32_inout_min_max (gint32 *int32) -{ - g_assert(*int32 == G_MININT32); - *int32 = G_MAXINT32; -} - - -guint32 -test_gi_uint32_return (void) -{ - return G_MAXUINT32; -} - -void -test_gi_uint32_in (guint32 uint32) -{ - g_assert(uint32 == G_MAXUINT32); -} - -/** - * test_gi_uint32_out: - * uint32: (out): - */ -void -test_gi_uint32_out (guint32 *uint32) -{ - *uint32 = G_MAXUINT32; -} - -/** - * test_gi_uint32_inout: - * uint32: (inout): - */ -void -test_gi_uint32_inout (guint32 *uint32) -{ - g_assert(*uint32 == G_MAXUINT32); - *uint32 = 0; -} - - -gint64 -test_gi_int64_return_max (void) -{ - return G_MAXINT64; -} - -gint64 -test_gi_int64_return_min (void) -{ - return G_MININT64; -} - -void -test_gi_int64_in_max (gint64 int64) -{ - g_assert(int64 == G_MAXINT64); -} - -void -test_gi_int64_in_min (gint64 int64) -{ - g_assert(int64 == G_MININT64); -} - -/** - * test_gi_int64_out_max: - * int64: (out): - */ -void -test_gi_int64_out_max (gint64 *int64) -{ - *int64 = G_MAXINT64; -} - -/** - * test_gi_int64_out_min: - * int64: (out): - */ -void -test_gi_int64_out_min (gint64 *int64) -{ - *int64 = G_MININT64; -} - -/** - * test_gi_int64_inout_max_min: - * int64: (inout): - */ -void -test_gi_int64_inout_max_min (gint64 *int64) -{ - g_assert(*int64 == G_MAXINT64); - *int64 = G_MININT64; -} - -/** - * test_gi_int64_inout_min_max: - * int64: (inout): - */ -void -test_gi_int64_inout_min_max (gint64 *int64) -{ - g_assert(*int64 == G_MININT64); - *int64 = G_MAXINT64; -} - - -guint64 -test_gi_uint64_return (void) -{ - return G_MAXUINT64; -} - -void -test_gi_uint64_in (guint64 uint64) -{ - g_assert(uint64 == G_MAXUINT64); -} - -/** - * test_gi_uint64_out: - * uint64: (out): - */ -void -test_gi_uint64_out (guint64 *uint64) -{ - *uint64 = G_MAXUINT64; -} - -/** - * test_gi_uint64_inout: - * uint64: (inout): - */ -void -test_gi_uint64_inout (guint64 *uint64) -{ - g_assert(*uint64 == G_MAXUINT64); - *uint64 = 0; -} - - -gshort -test_gi_short_return_max (void) -{ - return G_MAXSHORT; -} - -gshort -test_gi_short_return_min (void) -{ - return G_MINSHORT; -} - -void -test_gi_short_in_max (gshort short_) -{ - g_assert(short_ == G_MAXSHORT); -} - -void -test_gi_short_in_min (gshort short_) -{ - g_assert(short_ == G_MINSHORT); -} - -/** - * test_gi_short_out_max: - * short_: (out): - */ -void -test_gi_short_out_max (gshort *short_) -{ - *short_ = G_MAXSHORT; -} - -/** - * test_gi_short_out_min: - * short_: (out): - */ -void -test_gi_short_out_min (gshort *short_) -{ - *short_ = G_MINSHORT; -} - -/** - * test_gi_short_inout_max_min: - * short_: (inout): - */ -void -test_gi_short_inout_max_min (gshort *short_) -{ - g_assert(*short_ == G_MAXSHORT); - *short_ = G_MINSHORT; -} - -/** - * test_gi_short_inout_min_max: - * short_: (inout): - */ -void -test_gi_short_inout_min_max (gshort *short_) -{ - g_assert(*short_ == G_MINSHORT); - *short_ = G_MAXSHORT; -} - - -gushort -test_gi_ushort_return (void) -{ - return G_MAXUSHORT; -} - -void -test_gi_ushort_in (gushort ushort) -{ - g_assert(ushort == G_MAXUSHORT); -} - -/** - * test_gi_ushort_out: - * ushort: (out): - */ -void -test_gi_ushort_out (gushort *ushort) -{ - *ushort = G_MAXUSHORT; -} - -/** - * test_gi_ushort_inout: - * ushort: (inout): - */ -void -test_gi_ushort_inout (gushort *ushort) -{ - g_assert(*ushort == G_MAXUSHORT); - *ushort = 0; -} - - -gint -test_gi_int_return_max (void) -{ - return G_MAXINT; -} - -gint -test_gi_int_return_min (void) -{ - return G_MININT; -} - -void -test_gi_int_in_max (gint int_) -{ - g_assert(int_ == G_MAXINT); -} - -void -test_gi_int_in_min (gint int_) -{ - g_assert(int_ == G_MININT); -} - -/** - * test_gi_int_out_max: - * int_: (out): - */ -void -test_gi_int_out_max (gint *int_) -{ - *int_ = G_MAXINT; -} - -/** - * test_gi_int_out_min: - * int_: (out): - */ -void -test_gi_int_out_min (gint *int_) -{ - *int_ = G_MININT; -} - -/** - * test_gi_int_inout_max_min: - * int_: (inout): - */ -void -test_gi_int_inout_max_min (gint *int_) -{ - g_assert(*int_ == G_MAXINT); - *int_ = G_MININT; -} - -/** - * test_gi_int_inout_min_max: - * int_: (inout): - */ -void -test_gi_int_inout_min_max (gint *int_) -{ - g_assert(*int_ == G_MININT); - *int_ = G_MAXINT; -} - - -guint -test_gi_uint_return (void) -{ - return G_MAXUINT; -} - -void -test_gi_uint_in (guint uint) -{ - g_assert(uint == G_MAXUINT); -} - -/** - * test_gi_uint_out: - * uint: (out): - */ -void -test_gi_uint_out (guint *uint) -{ - *uint = G_MAXUINT; -} - -/** - * test_gi_uint_inout: - * uint: (inout): - */ -void -test_gi_uint_inout (guint *uint) -{ - g_assert(*uint == G_MAXUINT); - *uint = 0; -} - - -glong -test_gi_long_return_max (void) -{ - return G_MAXLONG; -} - -glong -test_gi_long_return_min (void) -{ - return G_MINLONG; -} - -void -test_gi_long_in_max (glong long_) -{ - g_assert(long_ == G_MAXLONG); -} - -void -test_gi_long_in_min (glong long_) -{ - g_assert(long_ == G_MINLONG); -} - -/** - * test_gi_long_out_max: - * long_: (out): - */ -void -test_gi_long_out_max (glong *long_) -{ - *long_ = G_MAXLONG; -} - -/** - * test_gi_long_out_min: - * long_: (out): - */ -void -test_gi_long_out_min (glong *long_) -{ - *long_ = G_MINLONG; -} - -/** - * test_gi_long_inout_max_min: - * long_: (inout): - */ -void -test_gi_long_inout_max_min (glong *long_) -{ - g_assert(*long_ == G_MAXLONG); - *long_ = G_MINLONG; -} - -/** - * test_gi_long_inout_min_max: - * long_: (inout): - */ -void -test_gi_long_inout_min_max (glong *long_) -{ - g_assert(*long_ == G_MINLONG); - *long_ = G_MAXLONG; -} - - -gulong -test_gi_ulong_return (void) -{ - return G_MAXULONG; -} - -void -test_gi_ulong_in (gulong ulong) -{ - g_assert(ulong == G_MAXULONG); -} - -/** - * test_gi_ulong_out: - * ulong: (out): - */ -void -test_gi_ulong_out (gulong *ulong) -{ - *ulong = G_MAXULONG; -} - -/** - * test_gi_ulong_inout: - * ulong: (inout): - */ -void -test_gi_ulong_inout (gulong *ulong) -{ - g_assert(*ulong == G_MAXULONG); - *ulong = 0; -} - - -gssize -test_gi_ssize_return_max (void) -{ - return G_MAXSSIZE; -} - -gssize -test_gi_ssize_return_min (void) -{ - return G_MINSSIZE; -} - -void -test_gi_ssize_in_max (gssize ssize) -{ - g_assert(ssize == G_MAXSSIZE); -} - -void -test_gi_ssize_in_min (gssize ssize) -{ - g_assert(ssize == G_MINSSIZE); -} - -/** - * test_gi_ssize_out_max: - * ssize: (out): - */ -void -test_gi_ssize_out_max (gssize *ssize) -{ - *ssize = G_MAXSSIZE; -} - -/** - * test_gi_ssize_out_min: - * ssize: (out): - */ -void -test_gi_ssize_out_min (gssize *ssize) -{ - *ssize = G_MINSSIZE; -} - -/** - * test_gi_ssize_inout_max_min: - * ssize: (inout): - */ -void -test_gi_ssize_inout_max_min (gssize *ssize) -{ - g_assert(*ssize == G_MAXSSIZE); - *ssize = G_MINSSIZE; -} - -/** - * test_gi_ssize_inout_min_max: - * ssize: (inout): - */ -void -test_gi_ssize_inout_min_max (gssize *ssize) -{ - g_assert(*ssize == G_MINSSIZE); - *ssize = G_MAXSSIZE; -} - - -gsize -test_gi_size_return (void) -{ - return G_MAXSIZE; -} - -void -test_gi_size_in (gsize size) -{ - g_assert(size == G_MAXSIZE); -} - -/** - * test_gi_size_out: - * size: (out): - */ -void -test_gi_size_out (gsize *size) -{ - *size = G_MAXSIZE; -} - -/** - * test_gi_size_inout: - * size: (inout): - */ -void -test_gi_size_inout (gsize *size) -{ - g_assert(*size == G_MAXSIZE); - *size = 0; -} - - -gfloat -test_gi_float_return (void) -{ - return G_MAXFLOAT; -} - -void -test_gi_float_in (gfloat float_) -{ - g_assert(float_ == G_MAXFLOAT); -} - -/** - * test_gi_float_out: - * float_: (out): - */ -void -test_gi_float_out (gfloat *float_) -{ - *float_ = G_MAXFLOAT; -} - -/** - * test_gi_float_inout: - * float_: (inout): - */ -void -test_gi_float_inout (gfloat *float_) -{ - g_assert(*float_ == G_MAXFLOAT); - *float_ = G_MINFLOAT; -} - - -gdouble -test_gi_double_return (void) -{ - return G_MAXDOUBLE; -} - -void -test_gi_double_in (gdouble double_) -{ - g_assert(double_ == G_MAXDOUBLE); -} - -/** - * test_gi_double_out: - * double_: (out): - */ -void -test_gi_double_out (gdouble *double_) -{ - *double_ = G_MAXDOUBLE; -} - -/** - * test_gi_double_inout: - * double_: (inout): - */ -void -test_gi_double_inout (gdouble *double_) -{ - g_assert(*double_ == G_MAXDOUBLE); - *double_ = G_MINDOUBLE; -} - - -time_t -test_gi_time_t_return (void) -{ - return 1234567890; -} - -void -test_gi_time_t_in (time_t time_t_) -{ - g_assert(time_t_ == 1234567890); -} - -/** - * test_gi_time_t_out: - * time_t_: (out): - */ -void -test_gi_time_t_out (time_t *time_t_) -{ - *time_t_ = 1234567890; -} - -/** - * test_gi_time_t_inout: - * time_t_: (inout): - */ -void -test_gi_time_t_inout (time_t *time_t_) -{ - g_assert(*time_t_ == 1234567890); - *time_t_ = 0; -} - - -GType -test_gi_gtype_return (void) -{ - return G_TYPE_NONE; -} - -void -test_gi_gtype_in (GType gtype) -{ - g_assert(gtype == G_TYPE_NONE); -} - -/** - * test_gi_gtype_out: - * gtype: (out): - */ -void -test_gi_gtype_out (GType *gtype) -{ - *gtype = G_TYPE_NONE; -} - -/** - * test_gi_gtype_inout: - * gtype: (inout): - */ -void -test_gi_gtype_inout (GType *gtype) -{ - g_assert(*gtype == G_TYPE_NONE); - *gtype = G_TYPE_INT; -} - - -const gchar * -test_gi_utf8_none_return (void) -{ - return TESTGI_CONSTANT_UTF8; -} - -gchar * -test_gi_utf8_full_return (void) -{ - return g_strdup(TESTGI_CONSTANT_UTF8); -} - -void -test_gi_utf8_none_in (const gchar *utf8) -{ - g_assert(strcmp(TESTGI_CONSTANT_UTF8, utf8) == 0); -} - -void -test_gi_utf8_full_in (gchar *utf8) -{ - g_assert(strcmp(TESTGI_CONSTANT_UTF8, utf8) == 0); - g_free(utf8); -} - -/** - * test_gi_utf8_none_out: - * utf8: (out) (transfer none): - */ -void -test_gi_utf8_none_out (gchar **utf8) -{ - *utf8 = TESTGI_CONSTANT_UTF8; -} - -/** - * test_gi_utf8_full_out: - * utf8: (out) (transfer full): - */ -void -test_gi_utf8_full_out (gchar **utf8) -{ - *utf8 = g_strdup(TESTGI_CONSTANT_UTF8); -} - -/** - * test_gi_utf8_none_inout: - * utf8: (inout) (transfer none): - */ -void -test_gi_utf8_none_inout (gchar **utf8) -{ - g_assert(strcmp(TESTGI_CONSTANT_UTF8, *utf8) == 0); - *utf8 = ""; -} - -/** - * test_gi_utf8_full_inout: - * utf8: (inout) (transfer full): - */ -void -test_gi_utf8_full_inout (gchar **utf8) -{ - g_assert(strcmp(TESTGI_CONSTANT_UTF8, *utf8) == 0); - g_free(*utf8); - *utf8 = g_strdup(""); -} - - -/** - * test_gi_array_fixed_int_return: - * Returns: (array fixed-size=4): - */ -const gint * -test_gi_array_fixed_int_return (void) -{ - static gint ints[] = {-1, 0, 1, 2}; - return ints; -} - -/** - * test_gi_array_fixed_short_return: - * Returns: (array fixed-size=4): - */ -const gshort * -test_gi_array_fixed_short_return (void) -{ - static gshort shorts[] = {-1, 0, 1, 2}; - return shorts; -} - -/** - * test_gi_array_fixed_int_in: - * @ints: (array fixed-size=4): - */ -void -test_gi_array_fixed_int_in (const gint *ints) -{ - g_assert(ints[0] == -1); - g_assert(ints[1] == 0); - g_assert(ints[2] == 1); - g_assert(ints[3] == 2); -} - -/** - * test_gi_array_fixed_short_in: - * @shorts: (array fixed-size=4): - */ -void -test_gi_array_fixed_short_in (const gshort *shorts) -{ - g_assert(shorts[0] == -1); - g_assert(shorts[1] == 0); - g_assert(shorts[2] == 1); - g_assert(shorts[3] == 2); -} - -/** - * test_gi_array_fixed_out: - * @ints: (out) (array fixed-size=4) (transfer none): - */ -void -test_gi_array_fixed_out (gint **ints) -{ - static gint values[] = {-1, 0, 1, 2}; - *ints = values; -} - -/** - * test_gi_array_fixed_out_struct: - * @structs: (out) (array fixed-size=2) (transfer none): - */ -void -test_gi_array_fixed_out_struct (TestGISimpleStruct **structs) -{ - static TestGISimpleStruct *values; - - if (values == NULL) { - values = g_new(TestGISimpleStruct, 2); - - values[0].long_ = 7; - values[0].int8 = 6; - - values[1].long_ = 6; - values[1].int8 = 7; - } - - *structs = values; -} - -/** - * test_gi_array_fixed_inout: - * @ints: (inout) (array fixed-size=4) (transfer none): - */ -void -test_gi_array_fixed_inout (gint **ints) -{ - static gint values[] = {2, 1, 0, -1}; - - g_assert((*ints)[0] == -1); - g_assert((*ints)[1] == 0); - g_assert((*ints)[2] == 1); - g_assert((*ints)[3] == 2); - - *ints = values; -} - - -/** - * test_gi_array_return: - * Returns: (array length=length): - */ -const gint * -test_gi_array_return (gint *length) -{ - static gint ints[] = {-1, 0, 1, 2}; - - *length = 4; - return ints; -} - -/** - * test_gi_array_in: - * @ints: (array length=length): - */ -void -test_gi_array_in (const gint *ints, gint length) -{ - g_assert(length == 4); - g_assert(ints[0] == -1); - g_assert(ints[1] == 0); - g_assert(ints[2] == 1); - g_assert(ints[3] == 2); -} - -/** - * test_gi_array_out: - * @ints: (out) (array length=length) (transfer none): - */ -void -test_gi_array_out (gint **ints, gint *length) -{ - static gint values[] = {-1, 0, 1, 2}; - - *length = 4; - *ints = values; -} - -/** - * test_gi_array_inout: - * @ints: (inout) (array length=length) (transfer none): - * @length: (inout): - */ -void -test_gi_array_inout (gint **ints, gint *length) -{ - static gint values[] = {-2, -1, 0, 1, 2}; - - g_assert(*length == 4); - g_assert((*ints)[0] == -1); - g_assert((*ints)[1] == 0); - g_assert((*ints)[2] == 1); - g_assert((*ints)[3] == 2); - - *length = 5; - *ints = values; -} - -/** - * test_gi_array_zero_terminated_return: - * Returns: (array zero-terminated=1) (transfer none): - */ -gchar ** -test_gi_array_zero_terminated_return (void) -{ - static gchar *values[] = {"0", "1", "2", NULL}; - return values; -} - -/** - * test_gi_array_zero_terminated_in: - * @utf8s: (array zero-terminated=1) (transfer none): - */ -void -test_gi_array_zero_terminated_in (gchar **utf8s) -{ - g_assert(g_strv_length(utf8s)); - g_assert(strcmp(utf8s[0], "0") == 0); - g_assert(strcmp(utf8s[1], "1") == 0); - g_assert(strcmp(utf8s[2], "2") == 0); -} - -/** - * test_gi_array_zero_terminated_out: - * @utf8s: (out) (array zero-terminated=1) (transfer none): - */ -void -test_gi_array_zero_terminated_out (gchar ***utf8s) -{ - static gchar *values[] = {"0", "1", "2", NULL}; - *utf8s = values; -} - -/** - * test_gi_array_zero_terminated_inout: - * @utf8s: (inout) (array zero-terminated=1) (transfer none): - */ -void -test_gi_array_zero_terminated_inout (gchar ***utf8s) -{ - static gchar *values[] = {"-1", "0", "1", "2", NULL}; - - g_assert(g_strv_length(*utf8s)); - g_assert(strcmp((*utf8s)[0], "0") == 0); - g_assert(strcmp((*utf8s)[1], "1") == 0); - g_assert(strcmp((*utf8s)[2], "2") == 0); - - *utf8s = values; -} - - -/** - * test_gi_glist_int_none_return: - * Returns: (element-type gint) (transfer none): - */ -GList * -test_gi_glist_int_none_return (void) -{ - static GList *list = NULL; - - if (list == NULL) { - list = g_list_append(list, GINT_TO_POINTER(-1)); - list = g_list_append(list, GINT_TO_POINTER(0)); - list = g_list_append(list, GINT_TO_POINTER(1)); - list = g_list_append(list, GINT_TO_POINTER(2)); - } - - return list; -} - -/** - * test_gi_glist_utf8_none_return: - * Returns: (element-type utf8) (transfer none): - */ -GList * -test_gi_glist_utf8_none_return (void) -{ - static GList *list = NULL; - - if (list == NULL) { - list = g_list_append(list, "0"); - list = g_list_append(list, "1"); - list = g_list_append(list, "2"); - } - - return list; -} - -/** - * test_gi_glist_utf8_container_return: - * Returns: (element-type utf8) (transfer container): - */ -GList * -test_gi_glist_utf8_container_return (void) -{ - GList *list = NULL; - - list = g_list_append(list, "0"); - list = g_list_append(list, "1"); - list = g_list_append(list, "2"); - - return list; -} - -/** - * test_gi_glist_utf8_full_return: - * Returns: (element-type utf8) (transfer full): - */ -GList * -test_gi_glist_utf8_full_return (void) -{ - GList *list = NULL; - - list = g_list_append(list, g_strdup("0")); - list = g_list_append(list, g_strdup("1")); - list = g_list_append(list, g_strdup("2")); - - return list; -} - -/** - * test_gi_glist_int_none_in: - * @list: (element-type gint) (transfer none): - */ -void -test_gi_glist_int_none_in (GList *list) -{ - g_assert(g_list_length(list) == 4); - g_assert(GPOINTER_TO_INT(g_list_nth_data(list, 0)) == -1); - g_assert(GPOINTER_TO_INT(g_list_nth_data(list, 1)) == 0); - g_assert(GPOINTER_TO_INT(g_list_nth_data(list, 2)) == 1); - g_assert(GPOINTER_TO_INT(g_list_nth_data(list, 3)) == 2); -} - -/** - * test_gi_glist_utf8_none_in: - * @list: (element-type utf8) (transfer none): - */ -void -test_gi_glist_utf8_none_in (GList *list) -{ - g_assert(g_list_length(list) == 3); - g_assert(strcmp(g_list_nth_data(list, 0), "0") == 0); - g_assert(strcmp(g_list_nth_data(list, 1), "1") == 0); - g_assert(strcmp(g_list_nth_data(list, 2), "2") == 0); -} - -/** - * test_gi_glist_utf8_container_in: - * @list: (element-type utf8) (transfer container): - */ -void -test_gi_glist_utf8_container_in (GList *list) -{ - g_assert(g_list_length(list) == 3); - g_assert(strcmp(g_list_nth_data(list, 0), "0") == 0); - g_assert(strcmp(g_list_nth_data(list, 1), "1") == 0); - g_assert(strcmp(g_list_nth_data(list, 2), "2") == 0); - g_list_free(list); -} - -/** - * test_gi_glist_utf8_full_in: - * @list: (element-type utf8) (transfer full): - */ -void -test_gi_glist_utf8_full_in (GList *list) -{ - g_assert(g_list_length(list) == 3); - g_assert(strcmp(g_list_nth_data(list, 0), "0") == 0); - g_assert(strcmp(g_list_nth_data(list, 1), "1") == 0); - g_assert(strcmp(g_list_nth_data(list, 2), "2") == 0); - g_free(g_list_nth_data(list, 0)); - g_free(g_list_nth_data(list, 1)); - g_free(g_list_nth_data(list, 2)); - g_list_free(list); -} - -/** - * test_gi_glist_utf8_none_out: - * @list: (out) (element-type utf8) (transfer none): - */ -void -test_gi_glist_utf8_none_out (GList **list) -{ - static GList *values = NULL; - - if (values == NULL) { - values = g_list_append(values, "0"); - values = g_list_append(values, "1"); - values = g_list_append(values, "2"); - } - - *list = values; -} - -/** - * test_gi_glist_utf8_container_out: - * @list: (out) (element-type utf8) (transfer container): - */ -void -test_gi_glist_utf8_container_out (GList **list) -{ - *list = NULL; - - *list = g_list_append(*list, "0"); - *list = g_list_append(*list, "1"); - *list = g_list_append(*list, "2"); -} - -/** - * test_gi_glist_utf8_full_out: - * @list: (out) (element-type utf8) (transfer full): - */ -void -test_gi_glist_utf8_full_out (GList **list) -{ - *list = NULL; - - *list = g_list_append(*list, g_strdup("0")); - *list = g_list_append(*list, g_strdup("1")); - *list = g_list_append(*list, g_strdup("2")); -} - -/** - * test_gi_glist_utf8_none_inout: - * @list: (inout) (element-type utf8) (transfer none): - */ -void -test_gi_glist_utf8_none_inout (GList **list) -{ - static GList *values = NULL; - - g_assert(g_list_length(*list) == 3); - g_assert(strcmp(g_list_nth_data(*list, 0), "0") == 0); - g_assert(strcmp(g_list_nth_data(*list, 1), "1") == 0); - g_assert(strcmp(g_list_nth_data(*list, 2), "2") == 0); - - if (values == NULL) { - values = g_list_append(values, "-2"); - values = g_list_append(values, "-1"); - values = g_list_append(values, "0"); - values = g_list_append(values, "1"); - } - - *list = values; -} - -/** - * test_gi_glist_utf8_container_inout: - * @list: (inout) (element-type utf8) (transfer container): - */ -void -test_gi_glist_utf8_container_inout (GList **list) -{ - g_assert(g_list_length(*list) == 3); - g_assert(strcmp(g_list_nth_data(*list, 0), "0") == 0); - g_assert(strcmp(g_list_nth_data(*list, 1), "1") == 0); - g_assert(strcmp(g_list_nth_data(*list, 2), "2") == 0); - - *list = g_list_remove_link(*list, g_list_last(*list)); - - *list = g_list_prepend(*list, "-1"); - *list = g_list_prepend(*list, "-2"); -} - -/** - * test_gi_glist_utf8_full_inout: - * @list: (inout) (element-type utf8) (transfer full): - */ -void -test_gi_glist_utf8_full_inout (GList **list) -{ - gpointer *data; - - g_assert(g_list_length(*list) == 3); - g_assert(strcmp(g_list_nth_data(*list, 0), "0") == 0); - g_assert(strcmp(g_list_nth_data(*list, 1), "1") == 0); - g_assert(strcmp(g_list_nth_data(*list, 2), "2") == 0); - - data = g_list_last(*list)->data; - *list = g_list_remove(*list, data); - g_free(data); - - *list = g_list_prepend(*list, g_strdup("-1")); - *list = g_list_prepend(*list, g_strdup("-2")); -} - - -/** - * test_gi_gslist_int_none_return: - * Returns: (element-type gint) (transfer none): - */ -GSList * -test_gi_gslist_int_none_return (void) -{ - static GSList *list = NULL; - - if (list == NULL) { - list = g_slist_prepend(list, GINT_TO_POINTER(-1)); - list = g_slist_prepend(list, GINT_TO_POINTER(0)); - list = g_slist_prepend(list, GINT_TO_POINTER(1)); - list = g_slist_prepend(list, GINT_TO_POINTER(2)); - list = g_slist_reverse(list); - } - - return list; -} - -/** - * test_gi_gslist_utf8_none_return: - * Returns: (element-type utf8) (transfer none): - */ -GSList * -test_gi_gslist_utf8_none_return (void) -{ - static GSList *list = NULL; - - if (list == NULL) { - list = g_slist_prepend(list, "0"); - list = g_slist_prepend(list, "1"); - list = g_slist_prepend(list, "2"); - list = g_slist_reverse(list); - } - - return list; -} - -/** - * test_gi_gslist_utf8_container_return: - * Returns: (element-type utf8) (transfer container): - */ -GSList * -test_gi_gslist_utf8_container_return (void) -{ - GSList *list = NULL; - - list = g_slist_prepend(list, "0"); - list = g_slist_prepend(list, "1"); - list = g_slist_prepend(list, "2"); - list = g_slist_reverse(list); - - return list; -} - -/** - * test_gi_gslist_utf8_full_return: - * Returns: (element-type utf8) (transfer full): - */ -GSList * -test_gi_gslist_utf8_full_return (void) -{ - GSList *list = NULL; - - list = g_slist_prepend(list, g_strdup("0")); - list = g_slist_prepend(list, g_strdup("1")); - list = g_slist_prepend(list, g_strdup("2")); - list = g_slist_reverse(list); - - return list; -} - -/** - * test_gi_gslist_int_none_in: - * @list: (element-type gint) (transfer none): - */ -void -test_gi_gslist_int_none_in (GSList *list) -{ - g_assert(g_slist_length(list) == 4); - g_assert(GPOINTER_TO_INT(g_slist_nth_data(list, 0)) == -1); - g_assert(GPOINTER_TO_INT(g_slist_nth_data(list, 1)) == 0); - g_assert(GPOINTER_TO_INT(g_slist_nth_data(list, 2)) == 1); - g_assert(GPOINTER_TO_INT(g_slist_nth_data(list, 3)) == 2); -} - -/** - * test_gi_gslist_utf8_none_in: - * @list: (element-type utf8) (transfer none): - */ -void -test_gi_gslist_utf8_none_in (GSList *list) -{ - g_assert(g_slist_length(list) == 3); - g_assert(strcmp(g_slist_nth_data(list, 0), "0") == 0); - g_assert(strcmp(g_slist_nth_data(list, 1), "1") == 0); - g_assert(strcmp(g_slist_nth_data(list, 2), "2") == 0); -} - -/** - * test_gi_gslist_utf8_container_in: - * @list: (element-type utf8) (transfer container): - */ -void -test_gi_gslist_utf8_container_in (GSList *list) -{ - g_assert(g_slist_length(list) == 3); - g_assert(strcmp(g_slist_nth_data(list, 0), "0") == 0); - g_assert(strcmp(g_slist_nth_data(list, 1), "1") == 0); - g_assert(strcmp(g_slist_nth_data(list, 2), "2") == 0); - g_slist_free(list); -} - -/** - * test_gi_gslist_utf8_full_in: - * @list: (element-type utf8) (transfer full): - */ -void -test_gi_gslist_utf8_full_in (GSList *list) -{ - g_assert(g_slist_length(list) == 3); - g_assert(strcmp(g_slist_nth_data(list, 0), "0") == 0); - g_assert(strcmp(g_slist_nth_data(list, 1), "1") == 0); - g_assert(strcmp(g_slist_nth_data(list, 2), "2") == 0); - g_free(g_slist_nth_data(list, 0)); - g_free(g_slist_nth_data(list, 1)); - g_free(g_slist_nth_data(list, 2)); - g_slist_free(list); -} - -/** - * test_gi_gslist_utf8_none_out: - * @list: (out) (element-type utf8) (transfer none): - */ -void -test_gi_gslist_utf8_none_out (GSList **list) -{ - static GSList *values = NULL; - - if (values == NULL) { - values = g_slist_prepend(values, "0"); - values = g_slist_prepend(values, "1"); - values = g_slist_prepend(values, "2"); - values = g_slist_reverse(values); - } - - *list = values; -} - -/** - * test_gi_gslist_utf8_container_out: - * @list: (out) (element-type utf8) (transfer container): - */ -void -test_gi_gslist_utf8_container_out (GSList **list) -{ - *list = NULL; - - *list = g_slist_prepend(*list, "0"); - *list = g_slist_prepend(*list, "1"); - *list = g_slist_prepend(*list, "2"); - *list = g_slist_reverse(*list); -} - -/** - * test_gi_gslist_utf8_full_out: - * @list: (out) (element-type utf8) (transfer full): - */ -void -test_gi_gslist_utf8_full_out (GSList **list) -{ - *list = NULL; - - *list = g_slist_prepend(*list, g_strdup("0")); - *list = g_slist_prepend(*list, g_strdup("1")); - *list = g_slist_prepend(*list, g_strdup("2")); - *list = g_slist_reverse(*list); -} - -/** - * test_gi_gslist_utf8_none_inout: - * @list: (inout) (element-type utf8) (transfer none): - */ -void -test_gi_gslist_utf8_none_inout (GSList **list) -{ - static GSList *values = NULL; - - g_assert(g_slist_length(*list) == 3); - g_assert(strcmp(g_slist_nth_data(*list, 0), "0") == 0); - g_assert(strcmp(g_slist_nth_data(*list, 1), "1") == 0); - g_assert(strcmp(g_slist_nth_data(*list, 2), "2") == 0); - - if (values == NULL) { - values = g_slist_prepend(values, "-2"); - values = g_slist_prepend(values, "-1"); - values = g_slist_prepend(values, "0"); - values = g_slist_prepend(values, "1"); - values = g_slist_reverse(values); - } - - *list = values; -} - -/** - * test_gi_gslist_utf8_container_inout: - * @list: (inout) (element-type utf8) (transfer container): - */ -void -test_gi_gslist_utf8_container_inout (GSList **list) -{ - g_assert(g_slist_length(*list) == 3); - g_assert(strcmp(g_slist_nth_data(*list, 0), "0") == 0); - g_assert(strcmp(g_slist_nth_data(*list, 1), "1") == 0); - g_assert(strcmp(g_slist_nth_data(*list, 2), "2") == 0); - - *list = g_slist_remove_link(*list, g_slist_last(*list)); - - *list = g_slist_prepend(*list, "-1"); - *list = g_slist_prepend(*list, "-2"); -} - -/** - * test_gi_gslist_utf8_full_inout: - * @list: (inout) (element-type utf8) (transfer full): - */ -void -test_gi_gslist_utf8_full_inout (GSList **list) -{ - gpointer *data; - - g_assert(g_slist_length(*list) == 3); - g_assert(strcmp(g_slist_nth_data(*list, 0), "0") == 0); - g_assert(strcmp(g_slist_nth_data(*list, 1), "1") == 0); - g_assert(strcmp(g_slist_nth_data(*list, 2), "2") == 0); - - data = g_slist_last(*list)->data; - *list = g_slist_remove(*list, data); - g_free(data); - - *list = g_slist_prepend(*list, g_strdup("-1")); - *list = g_slist_prepend(*list, g_strdup("-2")); -} - - -/** - * test_gi_ghashtable_int_none_return: - * Returns: (element-type gint gint) (transfer none): - */ -GHashTable * -test_gi_ghashtable_int_none_return (void) -{ - static GHashTable *hash_table = NULL; - - if (hash_table == NULL) { - hash_table = g_hash_table_new(NULL, NULL); - g_hash_table_insert(hash_table, GINT_TO_POINTER(-1), GINT_TO_POINTER(1)); - g_hash_table_insert(hash_table, GINT_TO_POINTER(0), GINT_TO_POINTER(0)); - g_hash_table_insert(hash_table, GINT_TO_POINTER(1), GINT_TO_POINTER(-1)); - g_hash_table_insert(hash_table, GINT_TO_POINTER(2), GINT_TO_POINTER(-2)); - } - - return hash_table; -} - -/** - * test_gi_ghashtable_utf8_none_return: - * Returns: (element-type utf8 utf8) (transfer none): - */ -GHashTable * -test_gi_ghashtable_utf8_none_return (void) -{ - static GHashTable *hash_table = NULL; - - if (hash_table == NULL) { - hash_table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(hash_table, "-1", "1"); - g_hash_table_insert(hash_table, "0", "0"); - g_hash_table_insert(hash_table, "1", "-1"); - g_hash_table_insert(hash_table, "2", "-2"); - } - - return hash_table; -} - -/** - * test_gi_ghashtable_utf8_container_return: - * Returns: (element-type utf8 utf8) (transfer container): - */ -GHashTable * -test_gi_ghashtable_utf8_container_return (void) -{ - GHashTable *hash_table = NULL; - - hash_table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(hash_table, "-1", "1"); - g_hash_table_insert(hash_table, "0", "0"); - g_hash_table_insert(hash_table, "1", "-1"); - g_hash_table_insert(hash_table, "2", "-2"); - - return hash_table; -} - -/** - * test_gi_ghashtable_utf8_full_return: - * Returns: (element-type utf8 utf8) (transfer full): - */ -GHashTable * -test_gi_ghashtable_utf8_full_return (void) -{ - GHashTable *hash_table = NULL; - - hash_table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(hash_table, g_strdup("-1"), g_strdup("1")); - g_hash_table_insert(hash_table, g_strdup("0"), g_strdup("0")); - g_hash_table_insert(hash_table, g_strdup("1"), g_strdup("-1")); - g_hash_table_insert(hash_table, g_strdup("2"), g_strdup("-2")); - - return hash_table; -} - -/** - * test_gi_ghashtable_int_none_in: - * @hash_table: (element-type gint gint) (transfer none): - */ -void -test_gi_ghashtable_int_none_in (GHashTable *hash_table) -{ - g_assert(GPOINTER_TO_INT(g_hash_table_lookup(hash_table, GINT_TO_POINTER(-1))) == 1); - g_assert(GPOINTER_TO_INT(g_hash_table_lookup(hash_table, GINT_TO_POINTER(0))) == 0); - g_assert(GPOINTER_TO_INT(g_hash_table_lookup(hash_table, GINT_TO_POINTER(1))) == -1); - g_assert(GPOINTER_TO_INT(g_hash_table_lookup(hash_table, GINT_TO_POINTER(2))) == -2); -} - -/** - * test_gi_ghashtable_utf8_none_in: - * @hash_table: (element-type utf8 utf8) (transfer none): - */ -void -test_gi_ghashtable_utf8_none_in (GHashTable *hash_table) -{ - g_assert(strcmp(g_hash_table_lookup(hash_table, "-1"), "1") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "0"), "0") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "1"), "-1") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "2"), "-2") == 0); -} - -/** - * test_gi_ghashtable_utf8_container_in: - * @hash_table: (element-type utf8 utf8) (transfer container): - */ -void -test_gi_ghashtable_utf8_container_in (GHashTable *hash_table) -{ - g_assert(strcmp(g_hash_table_lookup(hash_table, "-1"), "1") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "0"), "0") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "1"), "-1") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "2"), "-2") == 0); - g_hash_table_steal_all(hash_table); - g_hash_table_unref(hash_table); -} - -/** - * test_gi_ghashtable_utf8_full_in: - * @hash_table: (element-type utf8 utf8) (transfer full): - */ -void -test_gi_ghashtable_utf8_full_in (GHashTable *hash_table) -{ - GHashTableIter hash_table_iter; - gpointer key, value; - - g_assert(strcmp(g_hash_table_lookup(hash_table, "-1"), "1") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "0"), "0") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "1"), "-1") == 0); - g_assert(strcmp(g_hash_table_lookup(hash_table, "2"), "-2") == 0); - - g_hash_table_iter_init(&hash_table_iter, hash_table); - while (g_hash_table_iter_next(&hash_table_iter, &key, &value)) { - g_free(key); - g_free(value); - g_hash_table_iter_steal(&hash_table_iter); - } - - g_hash_table_unref(hash_table); -} - -/** - * test_gi_ghashtable_utf8_none_out: - * @hash_table: (out) (element-type utf8 utf8) (transfer none): - */ -void -test_gi_ghashtable_utf8_none_out (GHashTable **hash_table) -{ - static GHashTable *new_hash_table = NULL; - - if (new_hash_table == NULL) { - new_hash_table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(new_hash_table, "-1", "1"); - g_hash_table_insert(new_hash_table, "0", "0"); - g_hash_table_insert(new_hash_table, "1", "-1"); - g_hash_table_insert(new_hash_table, "2", "-2"); - } - - *hash_table = new_hash_table; -} - -/** - * test_gi_ghashtable_utf8_container_out: - * @hash_table: (out) (element-type utf8 utf8) (transfer container): - */ -void -test_gi_ghashtable_utf8_container_out (GHashTable **hash_table) -{ - *hash_table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(*hash_table, "-1", "1"); - g_hash_table_insert(*hash_table, "0", "0"); - g_hash_table_insert(*hash_table, "1", "-1"); - g_hash_table_insert(*hash_table, "2", "-2"); -} - -/** - * test_gi_ghashtable_utf8_full_out: - * @hash_table: (out) (element-type utf8 utf8) (transfer full): - */ -void -test_gi_ghashtable_utf8_full_out (GHashTable **hash_table) -{ - *hash_table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(*hash_table, g_strdup("-1"), g_strdup("1")); - g_hash_table_insert(*hash_table, g_strdup("0"), g_strdup("0")); - g_hash_table_insert(*hash_table, g_strdup("1"), g_strdup("-1")); - g_hash_table_insert(*hash_table, g_strdup("2"), g_strdup("-2")); -} - -/** - * test_gi_ghashtable_utf8_none_inout: - * @hash_table: (inout) (element-type utf8 utf8) (transfer none): - */ -void -test_gi_ghashtable_utf8_none_inout (GHashTable **hash_table) -{ - static GHashTable *new_hash_table = NULL; - - g_assert(strcmp(g_hash_table_lookup(*hash_table, "-1"), "1") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "0"), "0") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "1"), "-1") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "2"), "-2") == 0); - - if (new_hash_table == NULL) { - new_hash_table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(new_hash_table, "-1", "1"); - g_hash_table_insert(new_hash_table, "0", "0"); - g_hash_table_insert(new_hash_table, "1", "1"); - } - - *hash_table = new_hash_table; -} - -/** - * test_gi_ghashtable_utf8_container_inout: - * @hash_table: (inout) (element-type utf8 utf8) (transfer container): - */ -void -test_gi_ghashtable_utf8_container_inout (GHashTable **hash_table) -{ - g_assert(strcmp(g_hash_table_lookup(*hash_table, "-1"), "1") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "0"), "0") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "1"), "-1") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "2"), "-2") == 0); - - g_hash_table_steal(*hash_table, "2"); - g_hash_table_steal(*hash_table, "1"); - g_hash_table_insert(*hash_table, "1", "1"); -} - -/** - * test_gi_ghashtable_utf8_full_inout: - * @hash_table: (inout) (element-type utf8 utf8) (transfer full): - */ -void -test_gi_ghashtable_utf8_full_inout (GHashTable **hash_table) -{ - g_assert(strcmp(g_hash_table_lookup(*hash_table, "-1"), "1") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "0"), "0") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "1"), "-1") == 0); - g_assert(strcmp(g_hash_table_lookup(*hash_table, "2"), "-2") == 0); - - g_hash_table_steal(*hash_table, "2"); - g_hash_table_steal(*hash_table, "1"); - g_hash_table_insert(*hash_table, "1", g_strdup("1")); -} - - -/** - * test_gi_gvalue_return: - * Returns: (transfer none): - */ -GValue * -test_gi_gvalue_return (void) -{ - static GValue *value = NULL; - - if (value == NULL) { - value = g_new0(GValue, 1); - g_value_init(value, G_TYPE_INT); - g_value_set_int(value, 42); - } - - return value; -} - -/** - * test_gi_gvalue_in: - * @value: (transfer none): - */ -void -test_gi_gvalue_in (GValue *value) -{ - g_assert(g_value_get_int(value) == 42); -} - -/** - * test_gi_gvalue_out: - * @value: (out) (transfer none): - */ -void -test_gi_gvalue_out (GValue **value) -{ - static GValue *new_value = NULL; - - if (new_value == NULL) { - new_value = g_new0(GValue, 1); - g_value_init(new_value, G_TYPE_INT); - g_value_set_int(new_value, 42); - } - - *value = new_value; -} - -/** - * test_gi_gvalue_inout: - * @value: (inout) (transfer none): - */ -void -test_gi_gvalue_inout (GValue **value) -{ - g_assert(g_value_get_int(*value) == 42); - g_value_unset(*value); - g_value_init(*value, G_TYPE_STRING); - g_value_set_string(*value, "42"); -} - - -/** - * test_gi_gclosure_in: - * @closure: (transfer none): - */ -void -test_gi_gclosure_in (GClosure *closure) -{ - GValue return_value = {0, }; - - g_value_init (&return_value, G_TYPE_INT); - - g_closure_invoke (closure, - &return_value, - 0, NULL, - NULL); - - g_assert(g_value_get_int (&return_value) == 42); - - g_value_unset(&return_value); -} - -gpointer -test_gi_pointer_in_return (gpointer pointer) -{ - return pointer; -} - -GType -test_gi_enum_get_type (void) -{ - static GType type = 0; - if (G_UNLIKELY(type == 0)) { - static const GEnumValue values[] = { - { TESTGI_ENUM_VALUE1, "TESTGI_ENUM_VALUE1", "value1" }, - { TESTGI_ENUM_VALUE2, "TESTGI_ENUM_VALUE2", "value2" }, - { TESTGI_ENUM_VALUE3, "TESTGI_ENUM_VALUE3", "value3" }, - { 0, NULL, NULL } - }; - type = g_enum_register_static (g_intern_static_string ("TestGIEnum"), values); - } - - return type; -} - -TestGIEnum -test_gi_enum_return (void) -{ - return TESTGI_ENUM_VALUE3; -} - -void -test_gi_enum_in (TestGIEnum enum_) -{ - g_assert(enum_ == TESTGI_ENUM_VALUE3); -} - -/** - * test_gi_enum_out: - * @enum_: (out): - */ -void -test_gi_enum_out (TestGIEnum *enum_) -{ - *enum_ = TESTGI_ENUM_VALUE3; -} - -/** - * test_gi_enum_inout: - * @enum_: (inout): - */ -void -test_gi_enum_inout (TestGIEnum *enum_) -{ - g_assert(*enum_ == TESTGI_ENUM_VALUE3); - *enum_ = TESTGI_ENUM_VALUE1; -} - - -GType -test_gi_flags_get_type (void) -{ - static GType type = 0; - if (G_UNLIKELY(type == 0)) { - static const GFlagsValue values[] = { - { TESTGI_FLAGS_VALUE1, "TESTGI_FLAGS_VALUE1", "value1" }, - { TESTGI_FLAGS_VALUE2, "TESTGI_FLAGS_VALUE2", "value2" }, - { TESTGI_FLAGS_VALUE3, "TESTGI_FLAGS_VALUE3", "value3" }, - { 0, NULL, NULL } - }; - type = g_flags_register_static (g_intern_static_string ("TestGIFlags"), values); - } - - return type; -} - -TestGIFlags -test_gi_flags_return (void) -{ - return TESTGI_FLAGS_VALUE2; -} - -void -test_gi_flags_in (TestGIFlags flags_) -{ - g_assert(flags_ == TESTGI_FLAGS_VALUE2); -} - -void -test_gi_flags_in_zero (TestGIFlags flags) -{ - g_assert(flags == 0); -} - -/** - * test_gi_flags_out: - * @flags_: (out): - */ -void -test_gi_flags_out (TestGIFlags *flags_) -{ - *flags_ = TESTGI_FLAGS_VALUE2; -} - -/** - * test_gi_flags_inout: - * @flags_: (inout): - */ -void -test_gi_flags_inout (TestGIFlags *flags_) -{ - g_assert(*flags_ == TESTGI_FLAGS_VALUE2); - *flags_ = TESTGI_FLAGS_VALUE1; -} - - -/** - * test_gi__simple_struct_return: - * Returns: (transfer none): - */ -TestGISimpleStruct * -test_gi__simple_struct_return (void) -{ - static TestGISimpleStruct *struct_ = NULL; - - if (struct_ == NULL) { - struct_ = g_new(TestGISimpleStruct, 1); - - struct_->long_ = 6; - struct_->int8 = 7; - } - - return struct_; -} - -/** - * test_gi__simple_struct_in: - * @struct_: (transfer none): - */ -void -test_gi__simple_struct_in (TestGISimpleStruct *struct_) -{ - g_assert(struct_->long_ == 6); - g_assert(struct_->int8 == 7); -} - -/** - * test_gi__simple_struct_out: - * @struct_: (out) (transfer none): - */ -void -test_gi__simple_struct_out (TestGISimpleStruct **struct_) -{ - static TestGISimpleStruct *new_struct = NULL; - - if (new_struct == NULL) { - new_struct = g_new(TestGISimpleStruct, 1); - - new_struct->long_ = 6; - new_struct->int8 = 7; - } - - *struct_ = new_struct; -} - -/** - * test_gi__simple_struct_inout: - * @struct_: (inout) (transfer none): - */ -void -test_gi__simple_struct_inout (TestGISimpleStruct **struct_) -{ - g_assert((*struct_)->long_ == 6); - g_assert((*struct_)->int8 == 7); - - (*struct_)->long_ = 7; - (*struct_)->int8 = 6; -} - -void -test_gi_simple_struct_method (TestGISimpleStruct *struct_) -{ - g_assert(struct_->long_ == 6); - g_assert(struct_->int8 == 7); -} - - -GType -test_gi_pointer_struct_get_type (void) -{ - static GType type = 0; - - if (type == 0) { - type = g_pointer_type_register_static ("TestGIPointerStruct"); - } - - return type; -} - -/** - * test_gi__pointer_struct_return: - * Returns: (transfer none): - */ -TestGIPointerStruct * -test_gi__pointer_struct_return (void) -{ - static TestGIPointerStruct *struct_ = NULL; - - if (struct_ == NULL) { - struct_ = g_new(TestGIPointerStruct, 1); - - struct_->long_ = 42; - } - - return struct_; -} - -/** - * test_gi__pointer_struct_in: - * @struct_: (transfer none): - */ -void -test_gi__pointer_struct_in (TestGIPointerStruct *struct_) -{ - g_assert(struct_->long_ == 42); -} - -/** - * test_gi__pointer_struct_out: - * @struct_: (out) (transfer none): - */ -void -test_gi__pointer_struct_out (TestGIPointerStruct **struct_) -{ - static TestGIPointerStruct *new_struct = NULL; - - if (new_struct == NULL) { - new_struct = g_new(TestGIPointerStruct, 1); - - new_struct->long_ = 42; - } - - *struct_ = new_struct; -} - -/** - * test_gi__pointer_struct_inout: - * @struct_: (inout) (transfer none): - */ -void -test_gi__pointer_struct_inout (TestGIPointerStruct **struct_) -{ - g_assert((*struct_)->long_ == 42); - - (*struct_)->long_ = 0; -} - - -TestGIBoxedStruct * -test_gi_boxed_struct_copy (TestGIBoxedStruct *struct_) -{ - TestGIBoxedStruct *new_struct; - - new_struct = g_slice_new (TestGIBoxedStruct); - - *new_struct = *struct_; - - return new_struct; -} - -static void -test_gi_boxed_struct_free (TestGIBoxedStruct *struct_) -{ - g_slice_free (TestGIBoxedStruct, struct_); -} - -GType -test_gi_boxed_struct_get_type (void) -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static ("TestGIBoxedStruct", - (GBoxedCopyFunc) test_gi_boxed_struct_copy, - (GBoxedFreeFunc) test_gi_boxed_struct_free); - } - - return type; -} - -TestGIBoxedStruct * -test_gi_boxed_struct_new (void) -{ - return g_slice_new (TestGIBoxedStruct); -} - -/** - * test_gi__boxed_struct_return: - * Returns: (transfer none): - */ -TestGIBoxedStruct * -test_gi__boxed_struct_return (void) -{ - static TestGIBoxedStruct *struct_ = NULL; - - if (struct_ == NULL) { - struct_ = g_new(TestGIBoxedStruct, 1); - - struct_->long_ = 42; - } - - return struct_; -} - -/** - * test_gi__boxed_struct_in: - * @struct_: (transfer none): - */ -void -test_gi__boxed_struct_in (TestGIBoxedStruct *struct_) -{ - g_assert(struct_->long_ == 42); -} - -/** - * test_gi__boxed_struct_out: - * @struct_: (out) (transfer none): - */ -void -test_gi__boxed_struct_out (TestGIBoxedStruct **struct_) -{ - static TestGIBoxedStruct *new_struct = NULL; - - if (new_struct == NULL) { - new_struct = g_new(TestGIBoxedStruct, 1); - - new_struct->long_ = 42; - } - - *struct_ = new_struct; -} - -/** - * test_gi__boxed_struct_inout: - * @struct_: (inout) (transfer none): - */ -void -test_gi__boxed_struct_inout (TestGIBoxedStruct **struct_) -{ - g_assert((*struct_)->long_ == 42); - - (*struct_)->long_ = 0; -} - - -enum -{ - PROP_0, - PROP_INT_ -}; - -G_DEFINE_TYPE (TestGIObject, test_gi_object, G_TYPE_OBJECT); - -static void -test_gi_object_init (TestGIObject *object) -{ -} - -static void -test_gi_object_finalize (GObject *object) -{ - G_OBJECT_CLASS (test_gi_object_parent_class)->finalize (object); -} - -static void -test_gi_object_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - g_return_if_fail (TESTGI_IS_OBJECT (object)); - - switch (prop_id) { - case PROP_INT_: - TESTGI_OBJECT (object)->int_ = g_value_get_int (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -test_gi_object_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - g_return_if_fail (TESTGI_IS_OBJECT (object)); - - switch (prop_id) { - case PROP_INT_: - g_value_set_int (value, TESTGI_OBJECT (object)->int_); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -test_gi_object_class_init (TestGIObjectClass *klass) -{ - GObjectClass* object_class = G_OBJECT_CLASS (klass); -#if 0 - GObjectClass* parent_class = G_OBJECT_CLASS (klass); -#endif - - object_class->finalize = test_gi_object_finalize; - object_class->set_property = test_gi_object_set_property; - object_class->get_property = test_gi_object_get_property; - - g_object_class_install_property (object_class, PROP_INT_, - g_param_spec_int ("int", "Integer", "An integer", G_MININT, G_MAXINT, 0, - G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); -} - - -void -test_gi_object_static_method (void) -{ -} - -void -test_gi_object_method (TestGIObject *object) -{ - g_return_if_fail (TESTGI_IS_OBJECT (object)); - g_assert (object->int_ == 42); -} - -void -test_gi_object_overridden_method (TestGIObject *object) -{ - g_return_if_fail (TESTGI_IS_OBJECT (object)); - g_assert (object->int_ == 0); -} - -TestGIObject * -test_gi_object_new (gint int_) -{ - return g_object_new (TESTGI_TYPE_OBJECT, "int", int_, NULL); -} - -/** - * test_gi_object_method_array_in: - * @ints: (array length=length): - */ -void -test_gi_object_method_array_in (TestGIObject *object, const gint *ints, gint length) -{ - g_assert(length == 4); - g_assert(ints[0] == -1); - g_assert(ints[1] == 0); - g_assert(ints[2] == 1); - g_assert(ints[3] == 2); -} - -/** - * test_gi_object_method_array_out: - * @ints: (out) (array length=length) (transfer none): - */ -void -test_gi_object_method_array_out (TestGIObject *object, gint **ints, gint *length) -{ - static gint values[] = {-1, 0, 1, 2}; - - *length = 4; - *ints = values; -} - -/** - * test_gi_object_method_array_inout: - * @ints: (inout) (array length=length) (transfer none): - * @length: (inout): - */ -void -test_gi_object_method_array_inout (TestGIObject *object, gint **ints, gint *length) -{ - static gint values[] = {-2, -1, 0, 1, 2}; - - g_assert(*length == 4); - g_assert((*ints)[0] == -1); - g_assert((*ints)[1] == 0); - g_assert((*ints)[2] == 1); - g_assert((*ints)[3] == 2); - - *length = 5; - *ints = values; -} - -/** - * test_gi_object_method_array_return: - * Returns: (array length=length): - */ -const gint * -test_gi_object_method_array_return (TestGIObject *object, gint *length) -{ - static gint ints[] = {-1, 0, 1, 2}; - - *length = 4; - return ints; -} - - -/** - * test_gi__object_none_return: - * Returns: (transfer none): - */ -TestGIObject * -test_gi__object_none_return (void) -{ - static TestGIObject *object = NULL; - - if (object == NULL) { - object = g_object_new(TESTGI_TYPE_OBJECT, NULL); - } - - return object; -} - -/** - * test_gi__object_full_return: - * Returns: (transfer full): - */ -TestGIObject * -test_gi__object_full_return (void) -{ - return g_object_new(TESTGI_TYPE_OBJECT, NULL); -} - -/** - * test_gi__object_none_in: - * @object: (transfer none): - */ -void -test_gi__object_none_in (TestGIObject *object) -{ - g_assert(object->int_ == 42); -} - -/** - * test_gi__object_full_in: - * @object: (transfer full): - */ -void -test_gi__object_full_in (TestGIObject *object) -{ - g_assert(object->int_ == 42); - g_object_unref(object); -} - -/** - * test_gi__object_none_out: - * @object: (out) (transfer none): - */ -void -test_gi__object_none_out (TestGIObject **object) -{ - static TestGIObject *new_object = NULL; - - if (new_object == NULL) { - new_object = g_object_new(TESTGI_TYPE_OBJECT, NULL); - } - - *object = new_object; -} - -/** - * test_gi__object_full_out: - * @object: (out) (transfer full): - */ -void -test_gi__object_full_out (TestGIObject **object) -{ - *object = g_object_new(TESTGI_TYPE_OBJECT, NULL); -} - -/** - * test_gi__object_none_inout: - * @object: (inout) (transfer none): - */ -void -test_gi__object_none_inout (TestGIObject **object) -{ - static TestGIObject *new_object = NULL; - - g_assert((*object)->int_ == 42); - - if (new_object == NULL) { - new_object = g_object_new(TESTGI_TYPE_OBJECT, NULL); - new_object->int_ = 0; - } - - *object = new_object; -} - -/** - * test_gi__object_full_inout: - * @object: (inout) (transfer full): - */ -void -test_gi__object_full_inout (TestGIObject **object) -{ - g_assert((*object)->int_ == 42); - g_object_unref(*object); - - *object = g_object_new(TESTGI_TYPE_OBJECT, NULL); -} - -/** - * test_gi__object_inout_same: - * @object: (inout): - */ -void -test_gi__object_inout_same (TestGIObject **object) -{ - g_assert((*object)->int_ == 42); - (*object)->int_ = 0; -} - - -G_DEFINE_TYPE (TestGISubObject, test_gi_sub_object, TESTGI_TYPE_OBJECT); - -static void -test_gi_sub_object_init (TestGISubObject *object) -{ -} - -static void -test_gi_sub_object_finalize (GObject *object) -{ - G_OBJECT_CLASS(test_gi_sub_object_parent_class)->finalize(object); -} - -static void -test_gi_sub_object_class_init (TestGISubObjectClass *klass) -{ - G_OBJECT_CLASS(klass)->finalize = test_gi_sub_object_finalize; -} - -void -test_gi_sub_object_sub_method (TestGISubObject *object) -{ - g_assert(TESTGI_OBJECT(object)->int_ == 0); -} - -void -test_gi_sub_object_overwritten_method (TestGISubObject *object) -{ - g_assert(TESTGI_OBJECT(object)->int_ == 0); -} - -/* Interfaces */ - -static void -test_gi_interface_class_init(void *g_iface) -{ -} - -GType -test_gi_interface_get_type(void) -{ - static GType type = 0; - if (type == 0) { - type = g_type_register_static_simple (G_TYPE_INTERFACE, - "TestGIInterface", - sizeof (TestGIInterfaceIface), - (GClassInitFunc) test_gi_interface_class_init, - 0, NULL, 0); - } - - return type; -} - - -/** - * test_gi_int_out_out: - * int0: (out): - * int1: (out): - */ -void -test_gi_int_out_out (gint *int0, gint *int1) -{ - *int0 = 6; - *int1 = 7; -} - -/** - * test_gi_int_return_out: - * int_: (out): - */ -gint -test_gi_int_return_out (gint *int_) -{ - *int_ = 7; - return 6; -} - - -TestGIOverridesStruct * -test_gi_overrides_struct_copy (TestGIOverridesStruct *struct_) -{ - TestGIOverridesStruct *new_struct; - - new_struct = g_slice_new (TestGIOverridesStruct); - - *new_struct = *struct_; - - return new_struct; -} - -static void -test_gi_overrides_struct_free (TestGIOverridesStruct *struct_) -{ - g_slice_free (TestGIOverridesStruct, struct_); -} - -GType -test_gi_overrides_struct_get_type (void) -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static ("TestGIOverridesStruct", - (GBoxedCopyFunc) test_gi_overrides_struct_copy, - (GBoxedFreeFunc) test_gi_overrides_struct_free); - } - - return type; -} - -TestGIOverridesStruct * -test_gi_overrides_struct_new (void) -{ - return g_slice_new (TestGIOverridesStruct); -} - -glong -test_gi_overrides_struct_method (TestGIOverridesStruct *struct_) -{ - return 42; -} - - -/** - * test_gi__overrides_struct_return: - * - * Returns: (transfer full): - */ -TestGIOverridesStruct * -test_gi__overrides_struct_return (void) -{ - return test_gi_overrides_struct_new(); -} - - -G_DEFINE_TYPE (TestGIOverridesObject, test_gi_overrides_object, G_TYPE_OBJECT); - -static void -test_gi_overrides_object_init (TestGIOverridesObject *object) -{ -} - -static void -test_gi_overrides_object_finalize (GObject *object) -{ - G_OBJECT_CLASS (test_gi_overrides_object_parent_class)->finalize (object); -} - -static void -test_gi_overrides_object_class_init (TestGIOverridesObjectClass *klass) -{ - GObjectClass* object_class = G_OBJECT_CLASS (klass); -#if 0 - GObjectClass* parent_class = G_OBJECT_CLASS (klass); -#endif - - object_class->finalize = test_gi_overrides_object_finalize; -} - -TestGIOverridesObject * -test_gi_overrides_object_new (void) -{ - return g_object_new (TESTGI_TYPE_OVERRIDES_OBJECT, NULL); -} - -glong -test_gi_overrides_object_method (TestGIOverridesObject *object) -{ - return 42; -} - - -/** - * test_gi__overrides_object_return: - * - * Returns: (transfer full): - */ -TestGIOverridesObject * -test_gi__overrides_object_return (void) -{ - return g_object_new (TESTGI_TYPE_OVERRIDES_OBJECT, NULL); -} diff --git a/tests/libtestgi.h b/tests/libtestgi.h deleted file mode 100644 index a08a7fc..0000000 --- a/tests/libtestgi.h +++ /dev/null @@ -1,628 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - */ - -#include <glib-object.h> - -#ifndef __TEST_GI_H__ -#define __TEST_GI_H__ - -typedef struct _TestGISimpleStruct TestGISimpleStruct; - -/* Constants */ - -#define TESTGI_CONSTANT_NUMBER 42 -#define TESTGI_CONSTANT_UTF8 "const \xe2\x99\xa5 utf8" - - -/* Booleans */ - -gboolean test_gi_boolean_return_true (void); -gboolean test_gi_boolean_return_false (void); - -void test_gi_boolean_in_true (gboolean bool_); -void test_gi_boolean_in_false (gboolean bool_); - -void test_gi_boolean_out_true (gboolean *bool_); -void test_gi_boolean_out_false (gboolean *bool_); - -void test_gi_boolean_inout_true_false (gboolean *bool_); -void test_gi_boolean_inout_false_true (gboolean *bool_); - - -/* Integers */ - -gint8 test_gi_int8_return_max (void); -gint8 test_gi_int8_return_min (void); - -void test_gi_int8_in_max (gint8 int8); -void test_gi_int8_in_min (gint8 int8); - -void test_gi_int8_out_max (gint8 *int8); -void test_gi_int8_out_min (gint8 *int8); - -void test_gi_int8_inout_max_min (gint8 *int8); -void test_gi_int8_inout_min_max (gint8 *int8); - - -guint8 test_gi_uint8_return (void); - -void test_gi_uint8_in (guint8 uint8); - -void test_gi_uint8_out (guint8 *uint8); -void test_gi_uint8_inout (guint8 *uint8); - - -gint16 test_gi_int16_return_max (void); -gint16 test_gi_int16_return_min (void); - -void test_gi_int16_in_max (gint16 int16); -void test_gi_int16_in_min (gint16 int16); - -void test_gi_int16_out_max (gint16 *int16); -void test_gi_int16_out_min (gint16 *int16); - -void test_gi_int16_inout_max_min (gint16 *int16); -void test_gi_int16_inout_min_max (gint16 *int16); - - -guint16 test_gi_uint16_return (void); - -void test_gi_uint16_in (guint16 uint16); - -void test_gi_uint16_out (guint16 *uint16); -void test_gi_uint16_inout (guint16 *uint16); - - -gint32 test_gi_int32_return_max (void); -gint32 test_gi_int32_return_min (void); - -void test_gi_int32_in_max (gint32 int32); -void test_gi_int32_in_min (gint32 int32); - -void test_gi_int32_out_max (gint32 *int32); -void test_gi_int32_out_min (gint32 *int32); - -void test_gi_int32_inout_max_min (gint32 *int32); -void test_gi_int32_inout_min_max (gint32 *int32); - - -guint32 test_gi_uint32_return (void); - -void test_gi_uint32_in (guint32 uint32); - -void test_gi_uint32_out (guint32 *uint32); -void test_gi_uint32_inout (guint32 *uint32); - - -gint64 test_gi_int64_return_max (void); -gint64 test_gi_int64_return_min (void); - -void test_gi_int64_in_max (gint64 int64); -void test_gi_int64_in_min (gint64 int64); - -void test_gi_int64_out_max (gint64 *int64); -void test_gi_int64_out_min (gint64 *int64); - -void test_gi_int64_inout_max_min (gint64 *int64); -void test_gi_int64_inout_min_max (gint64 *int64); - - -guint64 test_gi_uint64_return (void); - -void test_gi_uint64_in (guint64 uint64); - -void test_gi_uint64_out (guint64 *uint64); -void test_gi_uint64_inout (guint64 *uint64); - - -gshort test_gi_short_return_max (void); -gshort test_gi_short_return_min (void); - -void test_gi_short_in_max (gshort short_); -void test_gi_short_in_min (gshort short_); - -void test_gi_short_out_max (gshort *short_); -void test_gi_short_out_min (gshort *short_); - -void test_gi_short_inout_max_min (gshort *short_); -void test_gi_short_inout_min_max (gshort *short_); - - -gushort test_gi_ushort_return (void); - -void test_gi_ushort_in (gushort ushort); - -void test_gi_ushort_out (gushort *ushort); -void test_gi_ushort_inout (gushort *ushort); - - -gint test_gi_int_return_max (void); -gint test_gi_int_return_min (void); - -void test_gi_int_in_max (gint int_); -void test_gi_int_in_min (gint int_); - -void test_gi_int_out_max (gint *int_); -void test_gi_int_out_min (gint *int_); - -void test_gi_int_inout_max_min (gint *int_); -void test_gi_int_inout_min_max (gint *int_); - - -guint test_gi_uint_return (void); - -void test_gi_uint_in (guint uint); - -void test_gi_uint_out (guint *uint); -void test_gi_uint_inout (guint *uint); - - -glong test_gi_long_return_max (void); -glong test_gi_long_return_min (void); - -void test_gi_long_in_max (glong long_); -void test_gi_long_in_min (glong long_); - -void test_gi_long_out_max (glong *long_); -void test_gi_long_out_min (glong *long_); - -void test_gi_long_inout_max_min (glong *long_); -void test_gi_long_inout_min_max (glong *long_); - - -gulong test_gi_ulong_return (void); - -void test_gi_ulong_in (gulong ulong); - -void test_gi_ulong_out (gulong *ulong); -void test_gi_ulong_inout (gulong *ulong); - - -gssize test_gi_ssize_return_max (void); -gssize test_gi_ssize_return_min (void); - -void test_gi_ssize_in_max (gssize ssize); -void test_gi_ssize_in_min (gssize ssize); - -void test_gi_ssize_out_max (gssize *ssize); -void test_gi_ssize_out_min (gssize *ssize); - -void test_gi_ssize_inout_max_min (gssize *ssize); -void test_gi_ssize_inout_min_max (gssize *ssize); - - -gsize test_gi_size_return (void); - -void test_gi_size_in (gsize size); - -void test_gi_size_out (gsize *size); -void test_gi_size_inout (gsize *size); - - -/* Floating-point */ - -gfloat test_gi_float_return (void); - -void test_gi_float_in (gfloat float_); - -void test_gi_float_out (gfloat *float_); - -void test_gi_float_inout (gfloat *float_); - - -gdouble test_gi_double_return (void); - -void test_gi_double_in (gdouble double_); - -void test_gi_double_out (gdouble *double_); - -void test_gi_double_inout (gdouble *double_); - - -/* Timestamps */ - -time_t test_gi_time_t_return (void); - -void test_gi_time_t_in (time_t time_t_); - -void test_gi_time_t_out (time_t *time_t_); - -void test_gi_time_t_inout (time_t *time_t_); - - -/* GType */ - -GType test_gi_gtype_return (void); - -void test_gi_gtype_in (GType gtype); - -void test_gi_gtype_out (GType *gtype); - -void test_gi_gtype_inout (GType *gtype); - - -/* UTF-8 */ - -const gchar *test_gi_utf8_none_return (void); -gchar *test_gi_utf8_full_return (void); - -void test_gi_utf8_none_in (const gchar *utf8); -void test_gi_utf8_full_in (gchar *utf8); - -void test_gi_utf8_none_out (gchar **utf8); -void test_gi_utf8_full_out (gchar **utf8); - -void test_gi_utf8_none_inout (gchar **utf8); -void test_gi_utf8_full_inout (gchar **utf8); - - -/* Arrays */ - -/* Fixed-size */ -const gint *test_gi_array_fixed_int_return (void); -const gshort *test_gi_array_fixed_short_return (void); - -void test_gi_array_fixed_int_in (const gint *ints); -void test_gi_array_fixed_short_in (const gshort *shorts); - -void test_gi_array_fixed_out (gint **ints); - -void test_gi_array_fixed_out_struct (TestGISimpleStruct **structs); - -void test_gi_array_fixed_inout (gint **ints); - -/* Variable-size */ - -const gint *test_gi_array_return (gint *length); - -void test_gi_array_in (const gint *ints, gint length); - -void test_gi_array_out (gint **ints, gint *length); - -void test_gi_array_inout (gint **ints, gint *length); - -/* Zero-terminated */ - -gchar **test_gi_array_zero_terminated_return (void); - -void test_gi_array_zero_terminated_in (gchar **utf8s); - -void test_gi_array_zero_terminated_out (gchar ***utf8s); - -void test_gi_array_zero_terminated_inout (gchar ***utf8s); - - -/* GList */ - -GList *test_gi_glist_int_none_return (void); -GList *test_gi_glist_utf8_none_return (void); -GList *test_gi_glist_utf8_container_return (void); -GList *test_gi_glist_utf8_full_return (void); - -void test_gi_glist_int_none_in (GList *list); -void test_gi_glist_utf8_none_in (GList *list); -void test_gi_glist_utf8_container_in (GList *list); -void test_gi_glist_utf8_full_in (GList *list); - -void test_gi_glist_utf8_none_out (GList **list); -void test_gi_glist_utf8_container_out (GList **list); -void test_gi_glist_utf8_full_out (GList **list); - -void test_gi_glist_utf8_none_inout (GList **list); -void test_gi_glist_utf8_container_inout (GList **list); -void test_gi_glist_utf8_full_inout (GList **list); - - -/* GSList */ - -GSList *test_gi_gslist_int_none_return (void); -GSList *test_gi_gslist_utf8_none_return (void); -GSList *test_gi_gslist_utf8_container_return (void); -GSList *test_gi_gslist_utf8_full_return (void); - -void test_gi_gslist_int_none_in (GSList *list); -void test_gi_gslist_utf8_none_in (GSList *list); -void test_gi_gslist_utf8_container_in (GSList *list); -void test_gi_gslist_utf8_full_in (GSList *list); - -void test_gi_gslist_utf8_none_out (GSList **list); -void test_gi_gslist_utf8_container_out (GSList **list); -void test_gi_gslist_utf8_full_out (GSList **list); - -void test_gi_gslist_utf8_none_inout (GSList **list); -void test_gi_gslist_utf8_container_inout (GSList **list); -void test_gi_gslist_utf8_full_inout (GSList **list); - - -/* GHashTable */ - -GHashTable *test_gi_ghashtable_int_none_return (void); -GHashTable *test_gi_ghashtable_utf8_none_return (void); -GHashTable *test_gi_ghashtable_utf8_container_return (void); -GHashTable *test_gi_ghashtable_utf8_full_return (void); - -void test_gi_ghashtable_int_none_in (GHashTable *hash_table); -void test_gi_ghashtable_utf8_none_in (GHashTable *hash_table); -void test_gi_ghashtable_utf8_container_in (GHashTable *hash_table); -void test_gi_ghashtable_utf8_full_in (GHashTable *hash_table); - -void test_gi_ghashtable_utf8_none_out (GHashTable **hash_table); -void test_gi_ghashtable_utf8_container_out (GHashTable **hash_table); -void test_gi_ghashtable_utf8_full_out (GHashTable **hash_table); - -void test_gi_ghashtable_utf8_none_inout (GHashTable **hash_table); -void test_gi_ghashtable_utf8_container_inout (GHashTable **hash_table); -void test_gi_ghashtable_utf8_full_inout (GHashTable **hash_table); - - -/* GValue */ - -GValue *test_gi_gvalue_return (void); - -void test_gi_gvalue_in (GValue *value); - -void test_gi_gvalue_out (GValue **value); - -void test_gi_gvalue_inout (GValue **value); - - -/* GClosure */ - -void test_gi_gclosure_in (GClosure *closure); - - -/* Pointer */ - -gpointer test_gi_pointer_in_return (gpointer pointer); - - -/* GEnum */ - -typedef enum -{ - TESTGI_ENUM_VALUE1, - TESTGI_ENUM_VALUE2, - TESTGI_ENUM_VALUE3 = 42 -} TestGIEnum; - -GType test_gi_enum_get_type (void) G_GNUC_CONST; -#define TESTGI_TYPE_ENUM (test_gi_enum_get_type ()) - -TestGIEnum test_gi_enum_return (void); - -void test_gi_enum_in (TestGIEnum enum_); - -void test_gi_enum_out (TestGIEnum *enum_); - -void test_gi_enum_inout (TestGIEnum *enum_); - - -/* GFlags */ - -typedef enum -{ - TESTGI_FLAGS_VALUE1 = 1 << 0, - TESTGI_FLAGS_VALUE2 = 1 << 1, - TESTGI_FLAGS_VALUE3 = 1 << 2 -} TestGIFlags; - -GType test_gi_flags_get_type (void) G_GNUC_CONST; -#define TESTGI_TYPE_FLAGS (test_gi_flags_get_type ()) - -TestGIFlags test_gi_flags_return (void); - -void test_gi_flags_in (TestGIFlags flags_); -void test_gi_flags_in_zero (TestGIFlags flags); - -void test_gi_flags_out (TestGIFlags *flags_); - -void test_gi_flags_inout (TestGIFlags *flags_); - - -/* Structure */ - -struct _TestGISimpleStruct { - glong long_; - gint8 int8; -}; - -typedef struct { - TestGISimpleStruct simple_struct; -} TestGINestedStruct; - -typedef struct { - gpointer pointer; -} TestGINotSimpleStruct; - - -TestGISimpleStruct *test_gi__simple_struct_return (void); - -void test_gi__simple_struct_in (TestGISimpleStruct *struct_); - -void test_gi__simple_struct_out (TestGISimpleStruct **struct_); - -void test_gi__simple_struct_inout (TestGISimpleStruct **struct_); - -void test_gi_simple_struct_method (TestGISimpleStruct *struct_); - - -typedef struct { - glong long_; -} TestGIPointerStruct; - -GType test_gi_pointer_struct_get_type (void) G_GNUC_CONST; - -TestGIPointerStruct *test_gi__pointer_struct_return (void); - -void test_gi__pointer_struct_in (TestGIPointerStruct *struct_); - -void test_gi__pointer_struct_out (TestGIPointerStruct **struct_); - -void test_gi__pointer_struct_inout (TestGIPointerStruct **struct_); - - -typedef struct { - glong long_; -} TestGIBoxedStruct; - -GType test_gi_boxed_struct_get_type (void) G_GNUC_CONST; - -TestGIBoxedStruct *test_gi_boxed_struct_new (void); - -TestGIBoxedStruct *test_gi__boxed_struct_return (void); - -void test_gi__boxed_struct_in (TestGIBoxedStruct *struct_); - -void test_gi__boxed_struct_out (TestGIBoxedStruct **struct_); - -void test_gi__boxed_struct_inout (TestGIBoxedStruct **struct_); - - -/* Object */ - -#define TESTGI_TYPE_OBJECT (test_gi_object_get_type ()) -#define TESTGI_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TESTGI_TYPE_OBJECT, TestGIObject)) -#define TESTGI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TESTGI_TYPE_OBJECT, TestGIObjectClass)) -#define TESTGI_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TESTGI_TYPE_OBJECT)) -#define TESTGI_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TESTGI_TYPE_OBJECT)) -#define TESTGI_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TESTGI_TYPE_OBJECT, TestGIObjectClass)) - -typedef struct _TestGIObjectClass TestGIObjectClass; -typedef struct _TestGIObject TestGIObject; - -struct _TestGIObjectClass -{ - GObjectClass parent_class; -}; - -struct _TestGIObject -{ - GObject parent_instance; - - gint int_; -}; - -GType test_gi_object_get_type (void) G_GNUC_CONST; -void test_gi_object_static_method (void); -void test_gi_object_method (TestGIObject *object); -void test_gi_object_overridden_method (TestGIObject *object); -TestGIObject *test_gi_object_new (gint int_); - -void test_gi_object_method_array_in (TestGIObject *object, const gint *ints, gint length); -void test_gi_object_method_array_out (TestGIObject *object, gint **ints, gint *length); -void test_gi_object_method_array_inout (TestGIObject *object, gint **ints, gint *length); -const gint *test_gi_object_method_array_return (TestGIObject *object, gint *length); - -TestGIObject *test_gi__object_none_return (void); -TestGIObject *test_gi__object_full_return (void); - -void test_gi__object_none_in (TestGIObject *object); -void test_gi__object_full_in (TestGIObject *object); - -void test_gi__object_none_out (TestGIObject **object); -void test_gi__object_full_out (TestGIObject **object); - -void test_gi__object_none_inout (TestGIObject **object); -void test_gi__object_full_inout (TestGIObject **object); -void test_gi__object_inout_same (TestGIObject **object); - - -#define TESTGI_TYPE_SUB_OBJECT (test_gi_sub_object_get_type ()) -#define TESTGI_SUB_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TESTGI_TYPE_SUB_OBJECT, TestGISubObject)) -#define TESTGI_SUB_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TESTGI_TYPE_SUB_OBJECT, TestGISubObjectClass)) -#define TESTGI_IS_SUB_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TESTGI_TYPE_SUB_OBJECT)) -#define TESTGI_IS_SUB_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TESTGI_TYPE_SUB_OBJECT)) -#define TESTGI_SUB_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TESTGI_TYPE_SUB_OBJECT, TestGISubObjectClass)) - -typedef struct _TestGISubObjectClass TestGISubObjectClass; -typedef struct _TestGISubObject TestGISubObject; - -struct _TestGISubObjectClass -{ - TestGIObjectClass parent_class; -}; - -struct _TestGISubObject -{ - TestGIObject parent_instance; -}; - -GType test_gi_sub_object_get_type (void) G_GNUC_CONST; - -void test_gi_sub_object_sub_method (TestGISubObject *object); -void test_gi_sub_object_overwritten_method (TestGISubObject *object); - -/* Interfaces */ - -#define TESTGI_TYPE_INTERFACE (test_gi_interface_get_type ()) -#define TESTGI_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TESTGI_TYPE_INTERFACE, TestGIInterface)) -#define TESTGI_IS_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TESTGI_TYPE_INTERFACE)) -#define TESTGI_INTERFACE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TESTGI_TYPE_INTERFACE, TestGIInterfaceIface)) - -typedef struct _TestGIInterface TestGIInterface; -typedef struct _TestGIInterfaceIface TestGIInterfaceIface; - -struct _TestGIInterfaceIface { - GTypeInterface base_iface; -}; - -GType test_gi_interface_get_type (void) G_GNUC_CONST; - - -/* Multiple output arguments */ - -void test_gi_int_out_out (gint *int0, gint *int1); -gint test_gi_int_return_out (gint *int_); - - -/* Overrides */ - -#define TESTGI_OVERRIDES_CONSTANT 42 - - -typedef struct { - glong long_; -} TestGIOverridesStruct; - -GType test_gi_overrides_struct_get_type (void) G_GNUC_CONST; - -TestGIOverridesStruct *test_gi_overrides_struct_new (void); - -glong test_gi_overrides_struct_method (TestGIOverridesStruct *struct_); - -TestGIOverridesStruct *test_gi__overrides_struct_return (void); - - -#define TESTGI_TYPE_OVERRIDES_OBJECT (test_gi_overrides_object_get_type ()) -#define TESTGI_OVERRIDES_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TESTGI_TYPE_OVERRIDES_OBJECT, TestGIOverridesObject)) -#define TESTGI_OVERRIDES_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TESTGI_TYPE_OVERRIDES_OBJECT, TestGIOverridesObjectClass)) -#define TESTGI_IS_OVERRIDES_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TESTGI_TYPE_OVERRIDES_OBJECT)) -#define TESTGI_IS_OVERRIDES_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TESTGI_TYPE_OVERRIDES_OBJECT)) -#define TESTGI_OVERRIDES_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TESTGI_TYPE_OVERRIDES_OBJECT, TestGIOverridesObjectClass)) - -typedef struct _TestGIOverridesObjectClass TestGIOverridesObjectClass; -typedef struct _TestGIOverridesObject TestGIOverridesObject; - -struct _TestGIOverridesObjectClass -{ - GObjectClass parent_class; -}; - -struct _TestGIOverridesObject -{ - GObject parent_instance; - - glong long_; -}; - -GType test_gi_overrides_object_get_type (void) G_GNUC_CONST; - -TestGIOverridesObject *test_gi_overrides_object_new (void); - -glong test_gi_overrides_object_method (TestGIOverridesObject *object); - - -TestGIOverridesObject *test_gi__overrides_object_return (void); - -#endif /* __TEST_GI_H__ */ diff --git a/tests/test_gi.py b/tests/test_gi.py index f6187cd..89dfe87 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -12,7 +12,7 @@ from datetime import datetime import sys sys.path.insert(0, "../") -from gi.repository import TestGI +from gi.repository import GIMarshallingTests CONSTANT_UTF8 = "const \xe2\x99\xa5 utf8" @@ -47,32 +47,32 @@ class TestConstant(unittest.TestCase): # Blocked by https://bugzilla.gnome.org/show_bug.cgi?id=595773 # def test_constant_utf8(self): -# self.assertEquals(CONSTANT_UTF8, TestGI.CONSTANT_UTF8) +# self.assertEquals(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8) def test_constant_number(self): - self.assertEquals(CONSTANT_NUMBER, TestGI.CONSTANT_NUMBER) + self.assertEquals(CONSTANT_NUMBER, GIMarshallingTests.CONSTANT_NUMBER) class TestBoolean(unittest.TestCase): def test_boolean_return(self): - self.assertEquals(True, TestGI.boolean_return_true()) - self.assertEquals(False, TestGI.boolean_return_false()) + self.assertEquals(True, GIMarshallingTests.boolean_return_true()) + self.assertEquals(False, GIMarshallingTests.boolean_return_false()) def test_boolean_in(self): - TestGI.boolean_in_true(True) - TestGI.boolean_in_false(False) + GIMarshallingTests.boolean_in_true(True) + GIMarshallingTests.boolean_in_false(False) - TestGI.boolean_in_true(1) - TestGI.boolean_in_false(0) + GIMarshallingTests.boolean_in_true(1) + GIMarshallingTests.boolean_in_false(0) def test_boolean_out(self): - self.assertEquals(True, TestGI.boolean_out_true()) - self.assertEquals(False, TestGI.boolean_out_false()) + self.assertEquals(True, GIMarshallingTests.boolean_out_true()) + self.assertEquals(False, GIMarshallingTests.boolean_out_false()) def test_boolean_inout(self): - self.assertEquals(False, TestGI.boolean_inout_true_false(True)) - self.assertEquals(True, TestGI.boolean_inout_false_true(False)) + self.assertEquals(False, GIMarshallingTests.boolean_inout_true_false(True)) + self.assertEquals(True, GIMarshallingTests.boolean_inout_false_true(False)) class TestInt8(unittest.TestCase): @@ -81,31 +81,31 @@ class TestInt8(unittest.TestCase): MIN = gobject.G_MININT8 def test_int8_return(self): - self.assertEquals(self.MAX, TestGI.int8_return_max()) - self.assertEquals(self.MIN, TestGI.int8_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int8_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int8_return_min()) def test_int8_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.int8_in_max(max) - TestGI.int8_in_min(min) + GIMarshallingTests.int8_in_max(max) + GIMarshallingTests.int8_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.int8_in_max, max) - self.assertRaises(ValueError, TestGI.int8_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.int8_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.int8_in_min, min) - self.assertRaises(TypeError, TestGI.int8_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.int8_in_max, "self.MAX") def test_int8_out(self): - self.assertEquals(self.MAX, TestGI.int8_out_max()) - self.assertEquals(self.MIN, TestGI.int8_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int8_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int8_out_min()) def test_int8_inout(self): - self.assertEquals(self.MIN, TestGI.int8_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.int8_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.int8_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.int8_inout_min_max(Number(self.MIN))) class TestUInt8(unittest.TestCase): @@ -113,25 +113,25 @@ class TestUInt8(unittest.TestCase): MAX = gobject.G_MAXUINT8 def test_uint8_return(self): - self.assertEquals(self.MAX, TestGI.uint8_return()) + self.assertEquals(self.MAX, GIMarshallingTests.uint8_return()) def test_uint8_in(self): number = Number(self.MAX) - TestGI.uint8_in(number) + GIMarshallingTests.uint8_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.uint8_in, number) - self.assertRaises(ValueError, TestGI.uint8_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.uint8_in, number) + self.assertRaises(ValueError, GIMarshallingTests.uint8_in, Number(-1)) - self.assertRaises(TypeError, TestGI.uint8_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.uint8_in, "self.MAX") def test_uint8_out(self): - self.assertEquals(self.MAX, TestGI.uint8_out()) + self.assertEquals(self.MAX, GIMarshallingTests.uint8_out()) def test_uint8_inout(self): - self.assertEquals(0, TestGI.uint8_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.uint8_inout(Number(self.MAX))) class TestInt16(unittest.TestCase): @@ -140,31 +140,31 @@ class TestInt16(unittest.TestCase): MIN = gobject.G_MININT16 def test_int16_return(self): - self.assertEquals(self.MAX, TestGI.int16_return_max()) - self.assertEquals(self.MIN, TestGI.int16_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int16_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int16_return_min()) def test_int16_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.int16_in_max(max) - TestGI.int16_in_min(min) + GIMarshallingTests.int16_in_max(max) + GIMarshallingTests.int16_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.int16_in_max, max) - self.assertRaises(ValueError, TestGI.int16_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.int16_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.int16_in_min, min) - self.assertRaises(TypeError, TestGI.int16_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.int16_in_max, "self.MAX") def test_int16_out(self): - self.assertEquals(self.MAX, TestGI.int16_out_max()) - self.assertEquals(self.MIN, TestGI.int16_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int16_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int16_out_min()) def test_int16_inout(self): - self.assertEquals(self.MIN, TestGI.int16_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.int16_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.int16_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.int16_inout_min_max(Number(self.MIN))) class TestUInt16(unittest.TestCase): @@ -172,25 +172,25 @@ class TestUInt16(unittest.TestCase): MAX = gobject.G_MAXUINT16 def test_uint16_return(self): - self.assertEquals(self.MAX, TestGI.uint16_return()) + self.assertEquals(self.MAX, GIMarshallingTests.uint16_return()) def test_uint16_in(self): number = Number(self.MAX) - TestGI.uint16_in(number) + GIMarshallingTests.uint16_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.uint16_in, number) - self.assertRaises(ValueError, TestGI.uint16_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.uint16_in, number) + self.assertRaises(ValueError, GIMarshallingTests.uint16_in, Number(-1)) - self.assertRaises(TypeError, TestGI.uint16_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.uint16_in, "self.MAX") def test_uint16_out(self): - self.assertEquals(self.MAX, TestGI.uint16_out()) + self.assertEquals(self.MAX, GIMarshallingTests.uint16_out()) def test_uint16_inout(self): - self.assertEquals(0, TestGI.uint16_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.uint16_inout(Number(self.MAX))) class TestInt32(unittest.TestCase): @@ -199,31 +199,31 @@ class TestInt32(unittest.TestCase): MIN = gobject.G_MININT32 def test_int32_return(self): - self.assertEquals(self.MAX, TestGI.int32_return_max()) - self.assertEquals(self.MIN, TestGI.int32_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int32_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int32_return_min()) def test_int32_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.int32_in_max(max) - TestGI.int32_in_min(min) + GIMarshallingTests.int32_in_max(max) + GIMarshallingTests.int32_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.int32_in_max, max) - self.assertRaises(ValueError, TestGI.int32_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.int32_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.int32_in_min, min) - self.assertRaises(TypeError, TestGI.int32_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.int32_in_max, "self.MAX") def test_int32_out(self): - self.assertEquals(self.MAX, TestGI.int32_out_max()) - self.assertEquals(self.MIN, TestGI.int32_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int32_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int32_out_min()) def test_int32_inout(self): - self.assertEquals(self.MIN, TestGI.int32_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.int32_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.int32_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.int32_inout_min_max(Number(self.MIN))) class TestUInt32(unittest.TestCase): @@ -231,25 +231,25 @@ class TestUInt32(unittest.TestCase): MAX = gobject.G_MAXUINT32 def test_uint32_return(self): - self.assertEquals(self.MAX, TestGI.uint32_return()) + self.assertEquals(self.MAX, GIMarshallingTests.uint32_return()) def test_uint32_in(self): number = Number(self.MAX) - TestGI.uint32_in(number) + GIMarshallingTests.uint32_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.uint32_in, number) - self.assertRaises(ValueError, TestGI.uint32_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.uint32_in, number) + self.assertRaises(ValueError, GIMarshallingTests.uint32_in, Number(-1)) - self.assertRaises(TypeError, TestGI.uint32_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.uint32_in, "self.MAX") def test_uint32_out(self): - self.assertEquals(self.MAX, TestGI.uint32_out()) + self.assertEquals(self.MAX, GIMarshallingTests.uint32_out()) def test_uint32_inout(self): - self.assertEquals(0, TestGI.uint32_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.uint32_inout(Number(self.MAX))) class TestInt64(unittest.TestCase): @@ -258,31 +258,31 @@ class TestInt64(unittest.TestCase): MIN = - (2 ** 63) def test_int64_return(self): - self.assertEquals(self.MAX, TestGI.int64_return_max()) - self.assertEquals(self.MIN, TestGI.int64_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int64_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int64_return_min()) def test_int64_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.int64_in_max(max) - TestGI.int64_in_min(min) + GIMarshallingTests.int64_in_max(max) + GIMarshallingTests.int64_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.int64_in_max, max) - self.assertRaises(ValueError, TestGI.int64_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.int64_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.int64_in_min, min) - self.assertRaises(TypeError, TestGI.int64_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.int64_in_max, "self.MAX") def test_int64_out(self): - self.assertEquals(self.MAX, TestGI.int64_out_max()) - self.assertEquals(self.MIN, TestGI.int64_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int64_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int64_out_min()) def test_int64_inout(self): - self.assertEquals(self.MIN, TestGI.int64_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.int64_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.int64_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.int64_inout_min_max(Number(self.MIN))) class TestUInt64(unittest.TestCase): @@ -290,25 +290,25 @@ class TestUInt64(unittest.TestCase): MAX = 2 ** 64 - 1 def test_uint64_return(self): - self.assertEquals(self.MAX, TestGI.uint64_return()) + self.assertEquals(self.MAX, GIMarshallingTests.uint64_return()) def test_uint64_in(self): number = Number(self.MAX) - TestGI.uint64_in(number) + GIMarshallingTests.uint64_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.uint64_in, number) - self.assertRaises(ValueError, TestGI.uint64_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.uint64_in, number) + self.assertRaises(ValueError, GIMarshallingTests.uint64_in, Number(-1)) - self.assertRaises(TypeError, TestGI.uint64_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.uint64_in, "self.MAX") def test_uint64_out(self): - self.assertEquals(self.MAX, TestGI.uint64_out()) + self.assertEquals(self.MAX, GIMarshallingTests.uint64_out()) def test_uint64_inout(self): - self.assertEquals(0, TestGI.uint64_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.uint64_inout(Number(self.MAX))) class TestShort(unittest.TestCase): @@ -317,31 +317,31 @@ class TestShort(unittest.TestCase): MIN = gobject.constants.G_MINSHORT def test_short_return(self): - self.assertEquals(self.MAX, TestGI.short_return_max()) - self.assertEquals(self.MIN, TestGI.short_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.short_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.short_return_min()) def test_short_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.short_in_max(max) - TestGI.short_in_min(min) + GIMarshallingTests.short_in_max(max) + GIMarshallingTests.short_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.short_in_max, max) - self.assertRaises(ValueError, TestGI.short_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.short_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.short_in_min, min) - self.assertRaises(TypeError, TestGI.short_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.short_in_max, "self.MAX") def test_short_out(self): - self.assertEquals(self.MAX, TestGI.short_out_max()) - self.assertEquals(self.MIN, TestGI.short_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.short_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.short_out_min()) def test_short_inout(self): - self.assertEquals(self.MIN, TestGI.short_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.short_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.short_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.short_inout_min_max(Number(self.MIN))) class TestUShort(unittest.TestCase): @@ -349,25 +349,25 @@ class TestUShort(unittest.TestCase): MAX = gobject.constants.G_MAXUSHORT def test_ushort_return(self): - self.assertEquals(self.MAX, TestGI.ushort_return()) + self.assertEquals(self.MAX, GIMarshallingTests.ushort_return()) def test_ushort_in(self): number = Number(self.MAX) - TestGI.ushort_in(number) + GIMarshallingTests.ushort_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.ushort_in, number) - self.assertRaises(ValueError, TestGI.ushort_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.ushort_in, number) + self.assertRaises(ValueError, GIMarshallingTests.ushort_in, Number(-1)) - self.assertRaises(TypeError, TestGI.ushort_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.ushort_in, "self.MAX") def test_ushort_out(self): - self.assertEquals(self.MAX, TestGI.ushort_out()) + self.assertEquals(self.MAX, GIMarshallingTests.ushort_out()) def test_ushort_inout(self): - self.assertEquals(0, TestGI.ushort_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.ushort_inout(Number(self.MAX))) class TestInt(unittest.TestCase): @@ -376,31 +376,31 @@ class TestInt(unittest.TestCase): MIN = gobject.constants.G_MININT def test_int_return(self): - self.assertEquals(self.MAX, TestGI.int_return_max()) - self.assertEquals(self.MIN, TestGI.int_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int_return_min()) def test_int_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.int_in_max(max) - TestGI.int_in_min(min) + GIMarshallingTests.int_in_max(max) + GIMarshallingTests.int_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.int_in_max, max) - self.assertRaises(ValueError, TestGI.int_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.int_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.int_in_min, min) - self.assertRaises(TypeError, TestGI.int_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.int_in_max, "self.MAX") def test_int_out(self): - self.assertEquals(self.MAX, TestGI.int_out_max()) - self.assertEquals(self.MIN, TestGI.int_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.int_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.int_out_min()) def test_int_inout(self): - self.assertEquals(self.MIN, TestGI.int_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.int_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.int_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.int_inout_min_max(Number(self.MIN))) class TestUInt(unittest.TestCase): @@ -408,25 +408,25 @@ class TestUInt(unittest.TestCase): MAX = gobject.constants.G_MAXUINT def test_uint_return(self): - self.assertEquals(self.MAX, TestGI.uint_return()) + self.assertEquals(self.MAX, GIMarshallingTests.uint_return()) def test_uint_in(self): number = Number(self.MAX) - TestGI.uint_in(number) + GIMarshallingTests.uint_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.uint_in, number) - self.assertRaises(ValueError, TestGI.uint_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.uint_in, number) + self.assertRaises(ValueError, GIMarshallingTests.uint_in, Number(-1)) - self.assertRaises(TypeError, TestGI.uint_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.uint_in, "self.MAX") def test_uint_out(self): - self.assertEquals(self.MAX, TestGI.uint_out()) + self.assertEquals(self.MAX, GIMarshallingTests.uint_out()) def test_uint_inout(self): - self.assertEquals(0, TestGI.uint_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.uint_inout(Number(self.MAX))) class TestLong(unittest.TestCase): @@ -435,31 +435,31 @@ class TestLong(unittest.TestCase): MIN = gobject.constants.G_MINLONG def test_long_return(self): - self.assertEquals(self.MAX, TestGI.long_return_max()) - self.assertEquals(self.MIN, TestGI.long_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.long_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.long_return_min()) def test_long_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.long_in_max(max) - TestGI.long_in_min(min) + GIMarshallingTests.long_in_max(max) + GIMarshallingTests.long_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.long_in_max, max) - self.assertRaises(ValueError, TestGI.long_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.long_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.long_in_min, min) - self.assertRaises(TypeError, TestGI.long_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.long_in_max, "self.MAX") def test_long_out(self): - self.assertEquals(self.MAX, TestGI.long_out_max()) - self.assertEquals(self.MIN, TestGI.long_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.long_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.long_out_min()) def test_long_inout(self): - self.assertEquals(self.MIN, TestGI.long_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.long_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.long_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.long_inout_min_max(Number(self.MIN))) class TestULong(unittest.TestCase): @@ -467,25 +467,25 @@ class TestULong(unittest.TestCase): MAX = gobject.constants.G_MAXULONG def test_ulong_return(self): - self.assertEquals(self.MAX, TestGI.ulong_return()) + self.assertEquals(self.MAX, GIMarshallingTests.ulong_return()) def test_ulong_in(self): number = Number(self.MAX) - TestGI.ulong_in(number) + GIMarshallingTests.ulong_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.ulong_in, number) - self.assertRaises(ValueError, TestGI.ulong_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.ulong_in, number) + self.assertRaises(ValueError, GIMarshallingTests.ulong_in, Number(-1)) - self.assertRaises(TypeError, TestGI.ulong_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.ulong_in, "self.MAX") def test_ulong_out(self): - self.assertEquals(self.MAX, TestGI.ulong_out()) + self.assertEquals(self.MAX, GIMarshallingTests.ulong_out()) def test_ulong_inout(self): - self.assertEquals(0, TestGI.ulong_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.ulong_inout(Number(self.MAX))) class TestSSize(unittest.TestCase): @@ -494,31 +494,31 @@ class TestSSize(unittest.TestCase): MIN = gobject.constants.G_MINLONG def test_ssize_return(self): - self.assertEquals(self.MAX, TestGI.ssize_return_max()) - self.assertEquals(self.MIN, TestGI.ssize_return_min()) + self.assertEquals(self.MAX, GIMarshallingTests.ssize_return_max()) + self.assertEquals(self.MIN, GIMarshallingTests.ssize_return_min()) def test_ssize_in(self): max = Number(self.MAX) min = Number(self.MIN) - TestGI.ssize_in_max(max) - TestGI.ssize_in_min(min) + GIMarshallingTests.ssize_in_max(max) + GIMarshallingTests.ssize_in_min(min) max.value += 1 min.value -= 1 - self.assertRaises(ValueError, TestGI.ssize_in_max, max) - self.assertRaises(ValueError, TestGI.ssize_in_min, min) + self.assertRaises(ValueError, GIMarshallingTests.ssize_in_max, max) + self.assertRaises(ValueError, GIMarshallingTests.ssize_in_min, min) - self.assertRaises(TypeError, TestGI.ssize_in_max, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.ssize_in_max, "self.MAX") def test_ssize_out(self): - self.assertEquals(self.MAX, TestGI.ssize_out_max()) - self.assertEquals(self.MIN, TestGI.ssize_out_min()) + self.assertEquals(self.MAX, GIMarshallingTests.ssize_out_max()) + self.assertEquals(self.MIN, GIMarshallingTests.ssize_out_min()) def test_ssize_inout(self): - self.assertEquals(self.MIN, TestGI.ssize_inout_max_min(Number(self.MAX))) - self.assertEquals(self.MAX, TestGI.ssize_inout_min_max(Number(self.MIN))) + self.assertEquals(self.MIN, GIMarshallingTests.ssize_inout_max_min(Number(self.MAX))) + self.assertEquals(self.MAX, GIMarshallingTests.ssize_inout_min_max(Number(self.MIN))) class TestSize(unittest.TestCase): @@ -526,25 +526,25 @@ class TestSize(unittest.TestCase): MAX = gobject.constants.G_MAXULONG def test_size_return(self): - self.assertEquals(self.MAX, TestGI.size_return()) + self.assertEquals(self.MAX, GIMarshallingTests.size_return()) def test_size_in(self): number = Number(self.MAX) - TestGI.size_in(number) + GIMarshallingTests.size_in(number) number.value += 1 - self.assertRaises(ValueError, TestGI.size_in, number) - self.assertRaises(ValueError, TestGI.size_in, Number(-1)) + self.assertRaises(ValueError, GIMarshallingTests.size_in, number) + self.assertRaises(ValueError, GIMarshallingTests.size_in, Number(-1)) - self.assertRaises(TypeError, TestGI.size_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.size_in, "self.MAX") def test_size_out(self): - self.assertEquals(self.MAX, TestGI.size_out()) + self.assertEquals(self.MAX, GIMarshallingTests.size_out()) def test_size_inout(self): - self.assertEquals(0, TestGI.size_inout(Number(self.MAX))) + self.assertEquals(0, GIMarshallingTests.size_inout(Number(self.MAX))) class TestFloat(unittest.TestCase): @@ -553,18 +553,18 @@ class TestFloat(unittest.TestCase): MIN = gobject.constants.G_MINFLOAT def test_float_return(self): - self.assertAlmostEquals(self.MAX, TestGI.float_return()) + self.assertAlmostEquals(self.MAX, GIMarshallingTests.float_return()) def test_float_in(self): - TestGI.float_in(Number(self.MAX)) + GIMarshallingTests.float_in(Number(self.MAX)) - self.assertRaises(TypeError, TestGI.float_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.float_in, "self.MAX") def test_float_out(self): - self.assertAlmostEquals(self.MAX, TestGI.float_out()) + self.assertAlmostEquals(self.MAX, GIMarshallingTests.float_out()) def test_float_inout(self): - self.assertAlmostEquals(self.MIN, TestGI.float_inout(Number(self.MAX))) + self.assertAlmostEquals(self.MIN, GIMarshallingTests.float_inout(Number(self.MAX))) class TestDouble(unittest.TestCase): @@ -573,18 +573,18 @@ class TestDouble(unittest.TestCase): MIN = gobject.constants.G_MINDOUBLE def test_double_return(self): - self.assertAlmostEquals(self.MAX, TestGI.double_return()) + self.assertAlmostEquals(self.MAX, GIMarshallingTests.double_return()) def test_double_in(self): - TestGI.double_in(Number(self.MAX)) + GIMarshallingTests.double_in(Number(self.MAX)) - self.assertRaises(TypeError, TestGI.double_in, "self.MAX") + self.assertRaises(TypeError, GIMarshallingTests.double_in, "self.MAX") def test_double_out(self): - self.assertAlmostEquals(self.MAX, TestGI.double_out()) + self.assertAlmostEquals(self.MAX, GIMarshallingTests.double_out()) def test_double_inout(self): - self.assertAlmostEquals(self.MIN, TestGI.double_inout(Number(self.MAX))) + self.assertAlmostEquals(self.MIN, GIMarshallingTests.double_inout(Number(self.MAX))) class TestTimeT(unittest.TestCase): @@ -592,123 +592,123 @@ class TestTimeT(unittest.TestCase): DATETIME = datetime.fromtimestamp(1234567890) def test_time_t_return(self): - self.assertEquals(self.DATETIME, TestGI.time_t_return()) + self.assertEquals(self.DATETIME, GIMarshallingTests.time_t_return()) def test_time_t_in(self): - TestGI.time_t_in(self.DATETIME) + GIMarshallingTests.time_t_in(self.DATETIME) - self.assertRaises(TypeError, TestGI.time_t_in, "self.DATETIME") + self.assertRaises(TypeError, GIMarshallingTests.time_t_in, "self.DATETIME") def test_time_t_out(self): - self.assertEquals(self.DATETIME, TestGI.time_t_out()) + self.assertEquals(self.DATETIME, GIMarshallingTests.time_t_out()) def test_time_t_inout(self): - self.assertEquals(datetime.fromtimestamp(0), TestGI.time_t_inout(self.DATETIME)) + self.assertEquals(datetime.fromtimestamp(0), GIMarshallingTests.time_t_inout(self.DATETIME)) class TestGType(unittest.TestCase): def test_gtype_return(self): - self.assertEquals(gobject.TYPE_NONE, TestGI.gtype_return()) + self.assertEquals(gobject.TYPE_NONE, GIMarshallingTests.gtype_return()) def test_gtype_in(self): - TestGI.gtype_in(gobject.TYPE_NONE) + GIMarshallingTests.gtype_in(gobject.TYPE_NONE) - self.assertRaises(TypeError, TestGI.gtype_in, "gobject.TYPE_NONE") + self.assertRaises(TypeError, GIMarshallingTests.gtype_in, "gobject.TYPE_NONE") def test_gtype_out(self): - self.assertEquals(gobject.TYPE_NONE, TestGI.gtype_out()) + self.assertEquals(gobject.TYPE_NONE, GIMarshallingTests.gtype_out()) def test_gtype_inout(self): - self.assertEquals(gobject.TYPE_INT, TestGI.gtype_inout(gobject.TYPE_NONE)) + self.assertEquals(gobject.TYPE_INT, GIMarshallingTests.gtype_inout(gobject.TYPE_NONE)) class TestUtf8(unittest.TestCase): def test_utf8_none_return(self): - self.assertEquals(CONSTANT_UTF8, TestGI.utf8_none_return()) + self.assertEquals(CONSTANT_UTF8, GIMarshallingTests.utf8_none_return()) def test_utf8_full_return(self): - self.assertEquals(CONSTANT_UTF8, TestGI.utf8_full_return()) + self.assertEquals(CONSTANT_UTF8, GIMarshallingTests.utf8_full_return()) def test_utf8_none_in(self): - TestGI.utf8_none_in(CONSTANT_UTF8) + GIMarshallingTests.utf8_none_in(CONSTANT_UTF8) - self.assertRaises(TypeError, TestGI.utf8_none_in, CONSTANT_NUMBER) - self.assertRaises(TypeError, TestGI.utf8_none_in, None) + self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, CONSTANT_NUMBER) + self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, None) def test_utf8_full_in(self): - TestGI.utf8_full_in(CONSTANT_UTF8) + GIMarshallingTests.utf8_full_in(CONSTANT_UTF8) def test_utf8_none_out(self): - self.assertEquals(CONSTANT_UTF8, TestGI.utf8_none_out()) + self.assertEquals(CONSTANT_UTF8, GIMarshallingTests.utf8_none_out()) def test_utf8_full_out(self): - self.assertEquals(CONSTANT_UTF8, TestGI.utf8_full_out()) + self.assertEquals(CONSTANT_UTF8, GIMarshallingTests.utf8_full_out()) def test_utf8_none_inout(self): - self.assertEquals("", TestGI.utf8_none_inout(CONSTANT_UTF8)) + self.assertEquals("", GIMarshallingTests.utf8_none_inout(CONSTANT_UTF8)) def test_utf8_full_inout(self): - self.assertEquals("", TestGI.utf8_full_inout(CONSTANT_UTF8)) + self.assertEquals("", GIMarshallingTests.utf8_full_inout(CONSTANT_UTF8)) class TestArray(unittest.TestCase): def test_array_fixed_int_return(self): - self.assertEquals((-1, 0, 1, 2), TestGI.array_fixed_int_return()) + self.assertEquals((-1, 0, 1, 2), GIMarshallingTests.array_fixed_int_return()) def test_array_fixed_short_return(self): - self.assertEquals((-1, 0, 1, 2), TestGI.array_fixed_short_return()) + self.assertEquals((-1, 0, 1, 2), GIMarshallingTests.array_fixed_short_return()) def test_array_fixed_int_in(self): - TestGI.array_fixed_int_in(Sequence((-1, 0, 1, 2))) + GIMarshallingTests.array_fixed_int_in(Sequence((-1, 0, 1, 2))) - self.assertRaises(TypeError, TestGI.array_fixed_int_in, Sequence((-1, '0', 1, 2))) + self.assertRaises(TypeError, GIMarshallingTests.array_fixed_int_in, Sequence((-1, '0', 1, 2))) - self.assertRaises(TypeError, TestGI.array_fixed_int_in, 42) - self.assertRaises(TypeError, TestGI.array_fixed_int_in, None) + self.assertRaises(TypeError, GIMarshallingTests.array_fixed_int_in, 42) + self.assertRaises(TypeError, GIMarshallingTests.array_fixed_int_in, None) def test_array_fixed_short_in(self): - TestGI.array_fixed_short_in(Sequence((-1, 0, 1, 2))) + GIMarshallingTests.array_fixed_short_in(Sequence((-1, 0, 1, 2))) def test_array_fixed_out(self): - self.assertEquals((-1, 0, 1, 2), TestGI.array_fixed_out()) + self.assertEquals((-1, 0, 1, 2), GIMarshallingTests.array_fixed_out()) def test_array_fixed_inout(self): - self.assertEquals((2, 1, 0, -1), TestGI.array_fixed_inout((-1, 0, 1, 2))) + self.assertEquals((2, 1, 0, -1), GIMarshallingTests.array_fixed_inout((-1, 0, 1, 2))) def test_array_return(self): - self.assertEquals((-1, 0, 1, 2), TestGI.array_return()) + self.assertEquals((-1, 0, 1, 2), GIMarshallingTests.array_return()) def test_array_in(self): - TestGI.array_in(Sequence((-1, 0, 1, 2))) + GIMarshallingTests.array_in(Sequence((-1, 0, 1, 2))) def test_array_out(self): - self.assertEquals((-1, 0, 1, 2), TestGI.array_out()) + self.assertEquals((-1, 0, 1, 2), GIMarshallingTests.array_out()) def test_array_inout(self): - self.assertEquals((-2, -1, 0, 1, 2), TestGI.array_inout(Sequence((-1, 0, 1, 2)))) + self.assertEquals((-2, -1, 0, 1, 2), GIMarshallingTests.array_inout(Sequence((-1, 0, 1, 2)))) def test_method_array_in(self): - object_ = TestGI.Object() + object_ = GIMarshallingTests.Object() object_.method_array_in(Sequence((-1, 0, 1, 2))) def test_method_array_out(self): - object_ = TestGI.Object() + object_ = GIMarshallingTests.Object() self.assertEquals((-1, 0, 1, 2), object_.method_array_out()) def test_method_array_inout(self): - object_ = TestGI.Object() + object_ = GIMarshallingTests.Object() self.assertEquals((-2, -1, 0, 1, 2), object_.method_array_inout(Sequence((-1, 0, 1, 2)))) def test_method_array_return(self): - object_ = TestGI.Object() + object_ = GIMarshallingTests.Object() self.assertEquals((-1, 0, 1, 2), object_.method_array_return()) def test_array_fixed_out_struct(self): - struct1, struct2 = TestGI.array_fixed_out_struct() + struct1, struct2 = GIMarshallingTests.array_fixed_out_struct() self.assertEquals(7, struct1.long_) self.assertEquals(6, struct1.int8) @@ -716,265 +716,265 @@ class TestArray(unittest.TestCase): self.assertEquals(7, struct2.int8) def test_array_zero_terminated_return(self): - self.assertEquals(('0', '1', '2'), TestGI.array_zero_terminated_return()) + self.assertEquals(('0', '1', '2'), GIMarshallingTests.array_zero_terminated_return()) def test_array_zero_terminated_in(self): - TestGI.array_zero_terminated_in(Sequence(('0', '1', '2'))) + GIMarshallingTests.array_zero_terminated_in(Sequence(('0', '1', '2'))) def test_array_zero_terminated_out(self): - self.assertEquals(('0', '1', '2'), TestGI.array_zero_terminated_out()) + self.assertEquals(('0', '1', '2'), GIMarshallingTests.array_zero_terminated_out()) def test_array_zero_terminated_out(self): - self.assertEquals(('0', '1', '2'), TestGI.array_zero_terminated_out()) + self.assertEquals(('0', '1', '2'), GIMarshallingTests.array_zero_terminated_out()) def test_array_zero_terminated_inout(self): - self.assertEquals(('-1', '0', '1', '2'), TestGI.array_zero_terminated_inout(('0', '1', '2'))) + self.assertEquals(('-1', '0', '1', '2'), GIMarshallingTests.array_zero_terminated_inout(('0', '1', '2'))) class TestGList(unittest.TestCase): def test_glist_int_none_return(self): - self.assertEquals([-1, 0, 1, 2], TestGI.glist_int_none_return()) + self.assertEquals([-1, 0, 1, 2], GIMarshallingTests.glist_int_none_return()) def test_glist_utf8_none_return(self): - self.assertEquals(['0', '1', '2'], TestGI.glist_utf8_none_return()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.glist_utf8_none_return()) def test_glist_utf8_container_return(self): - self.assertEquals(['0', '1', '2'], TestGI.glist_utf8_container_return()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.glist_utf8_container_return()) def test_glist_utf8_full_return(self): - self.assertEquals(['0', '1', '2'], TestGI.glist_utf8_full_return()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.glist_utf8_full_return()) def test_glist_int_none_in(self): - TestGI.glist_int_none_in(Sequence((-1, 0, 1, 2))) + GIMarshallingTests.glist_int_none_in(Sequence((-1, 0, 1, 2))) - self.assertRaises(TypeError, TestGI.glist_int_none_in, Sequence((-1, '0', 1, 2))) + self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, Sequence((-1, '0', 1, 2))) - self.assertRaises(TypeError, TestGI.glist_int_none_in, 42) - self.assertRaises(TypeError, TestGI.glist_int_none_in, None) + self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, 42) + self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, None) def test_glist_utf8_none_in(self): - TestGI.glist_utf8_none_in(Sequence(('0', '1', '2'))) + GIMarshallingTests.glist_utf8_none_in(Sequence(('0', '1', '2'))) def test_glist_utf8_container_in(self): - TestGI.glist_utf8_container_in(Sequence(('0', '1', '2'))) + GIMarshallingTests.glist_utf8_container_in(Sequence(('0', '1', '2'))) def test_glist_utf8_full_in(self): - TestGI.glist_utf8_full_in(Sequence(('0', '1', '2'))) + GIMarshallingTests.glist_utf8_full_in(Sequence(('0', '1', '2'))) def test_glist_utf8_none_out(self): - self.assertEquals(['0', '1', '2'], TestGI.glist_utf8_none_out()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.glist_utf8_none_out()) def test_glist_utf8_container_out(self): - self.assertEquals(['0', '1', '2'], TestGI.glist_utf8_container_out()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.glist_utf8_container_out()) def test_glist_utf8_full_out(self): - self.assertEquals(['0', '1', '2'], TestGI.glist_utf8_full_out()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.glist_utf8_full_out()) def test_glist_utf8_none_inout(self): - self.assertEquals(['-2', '-1', '0', '1'], TestGI.glist_utf8_none_inout(Sequence(('0', '1', '2')))) + self.assertEquals(['-2', '-1', '0', '1'], GIMarshallingTests.glist_utf8_none_inout(Sequence(('0', '1', '2')))) def test_glist_utf8_container_inout(self): - self.assertEquals(['-2', '-1','0', '1'], TestGI.glist_utf8_container_inout(('0', '1', '2'))) + self.assertEquals(['-2', '-1','0', '1'], GIMarshallingTests.glist_utf8_container_inout(('0', '1', '2'))) def test_glist_utf8_full_inout(self): - self.assertEquals(['-2', '-1','0', '1'], TestGI.glist_utf8_full_inout(('0', '1', '2'))) + self.assertEquals(['-2', '-1','0', '1'], GIMarshallingTests.glist_utf8_full_inout(('0', '1', '2'))) class TestGSList(unittest.TestCase): def test_gslist_int_none_return(self): - self.assertEquals([-1, 0, 1, 2], TestGI.gslist_int_none_return()) + self.assertEquals([-1, 0, 1, 2], GIMarshallingTests.gslist_int_none_return()) def test_gslist_utf8_none_return(self): - self.assertEquals(['0', '1', '2'], TestGI.gslist_utf8_none_return()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.gslist_utf8_none_return()) def test_gslist_utf8_container_return(self): - self.assertEquals(['0', '1', '2'], TestGI.gslist_utf8_container_return()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.gslist_utf8_container_return()) def test_gslist_utf8_full_return(self): - self.assertEquals(['0', '1', '2'], TestGI.gslist_utf8_full_return()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.gslist_utf8_full_return()) def test_gslist_int_none_in(self): - TestGI.gslist_int_none_in(Sequence((-1, 0, 1, 2))) + GIMarshallingTests.gslist_int_none_in(Sequence((-1, 0, 1, 2))) - self.assertRaises(TypeError, TestGI.gslist_int_none_in, Sequence((-1, '0', 1, 2))) + self.assertRaises(TypeError, GIMarshallingTests.gslist_int_none_in, Sequence((-1, '0', 1, 2))) - self.assertRaises(TypeError, TestGI.gslist_int_none_in, 42) - self.assertRaises(TypeError, TestGI.gslist_int_none_in, None) + self.assertRaises(TypeError, GIMarshallingTests.gslist_int_none_in, 42) + self.assertRaises(TypeError, GIMarshallingTests.gslist_int_none_in, None) def test_gslist_utf8_none_in(self): - TestGI.gslist_utf8_none_in(Sequence(('0', '1', '2'))) + GIMarshallingTests.gslist_utf8_none_in(Sequence(('0', '1', '2'))) def test_gslist_utf8_container_in(self): - TestGI.gslist_utf8_container_in(Sequence(('0', '1', '2'))) + GIMarshallingTests.gslist_utf8_container_in(Sequence(('0', '1', '2'))) def test_gslist_utf8_full_in(self): - TestGI.gslist_utf8_full_in(Sequence(('0', '1', '2'))) + GIMarshallingTests.gslist_utf8_full_in(Sequence(('0', '1', '2'))) def test_gslist_utf8_none_out(self): - self.assertEquals(['0', '1', '2'], TestGI.gslist_utf8_none_out()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.gslist_utf8_none_out()) def test_gslist_utf8_container_out(self): - self.assertEquals(['0', '1', '2'], TestGI.gslist_utf8_container_out()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.gslist_utf8_container_out()) def test_gslist_utf8_full_out(self): - self.assertEquals(['0', '1', '2'], TestGI.gslist_utf8_full_out()) + self.assertEquals(['0', '1', '2'], GIMarshallingTests.gslist_utf8_full_out()) def test_gslist_utf8_none_inout(self): - self.assertEquals(['-2', '-1', '0', '1'], TestGI.gslist_utf8_none_inout(Sequence(('0', '1', '2')))) + self.assertEquals(['-2', '-1', '0', '1'], GIMarshallingTests.gslist_utf8_none_inout(Sequence(('0', '1', '2')))) def test_gslist_utf8_container_inout(self): - self.assertEquals(['-2', '-1','0', '1'], TestGI.gslist_utf8_container_inout(('0', '1', '2'))) + self.assertEquals(['-2', '-1','0', '1'], GIMarshallingTests.gslist_utf8_container_inout(('0', '1', '2'))) def test_gslist_utf8_full_inout(self): - self.assertEquals(['-2', '-1','0', '1'], TestGI.gslist_utf8_full_inout(('0', '1', '2'))) + self.assertEquals(['-2', '-1','0', '1'], GIMarshallingTests.gslist_utf8_full_inout(('0', '1', '2'))) class TestGHashTable(unittest.TestCase): def test_ghashtable_int_none_return(self): - self.assertEquals({-1: 1, 0: 0, 1: -1, 2: -2}, TestGI.ghashtable_int_none_return()) + self.assertEquals({-1: 1, 0: 0, 1: -1, 2: -2}, GIMarshallingTests.ghashtable_int_none_return()) def test_ghashtable_int_none_return(self): - self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, TestGI.ghashtable_utf8_none_return()) + self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, GIMarshallingTests.ghashtable_utf8_none_return()) def test_ghashtable_int_container_return(self): - self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, TestGI.ghashtable_utf8_container_return()) + self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, GIMarshallingTests.ghashtable_utf8_container_return()) def test_ghashtable_int_full_return(self): - self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, TestGI.ghashtable_utf8_full_return()) + self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, GIMarshallingTests.ghashtable_utf8_full_return()) def test_ghashtable_int_none_in(self): - TestGI.ghashtable_int_none_in({-1: 1, 0: 0, 1: -1, 2: -2}) + GIMarshallingTests.ghashtable_int_none_in({-1: 1, 0: 0, 1: -1, 2: -2}) - self.assertRaises(TypeError, TestGI.ghashtable_int_none_in, {-1: 1, '0': 0, 1: -1, 2: -2}) - self.assertRaises(TypeError, TestGI.ghashtable_int_none_in, {-1: 1, 0: '0', 1: -1, 2: -2}) + self.assertRaises(TypeError, GIMarshallingTests.ghashtable_int_none_in, {-1: 1, '0': 0, 1: -1, 2: -2}) + self.assertRaises(TypeError, GIMarshallingTests.ghashtable_int_none_in, {-1: 1, 0: '0', 1: -1, 2: -2}) - self.assertRaises(TypeError, TestGI.ghashtable_int_none_in, '{-1: 1, 0: 0, 1: -1, 2: -2}') - self.assertRaises(TypeError, TestGI.ghashtable_int_none_in, None) + self.assertRaises(TypeError, GIMarshallingTests.ghashtable_int_none_in, '{-1: 1, 0: 0, 1: -1, 2: -2}') + self.assertRaises(TypeError, GIMarshallingTests.ghashtable_int_none_in, None) def test_ghashtable_utf8_none_in(self): - TestGI.ghashtable_utf8_none_in({'-1': '1', '0': '0', '1': '-1', '2': '-2'}) + GIMarshallingTests.ghashtable_utf8_none_in({'-1': '1', '0': '0', '1': '-1', '2': '-2'}) def test_ghashtable_utf8_container_in(self): - TestGI.ghashtable_utf8_container_in({'-1': '1', '0': '0', '1': '-1', '2': '-2'}) + GIMarshallingTests.ghashtable_utf8_container_in({'-1': '1', '0': '0', '1': '-1', '2': '-2'}) def test_ghashtable_utf8_full_in(self): - TestGI.ghashtable_utf8_full_in({'-1': '1', '0': '0', '1': '-1', '2': '-2'}) + GIMarshallingTests.ghashtable_utf8_full_in({'-1': '1', '0': '0', '1': '-1', '2': '-2'}) def test_ghashtable_utf8_none_out(self): - self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, TestGI.ghashtable_utf8_none_out()) + self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, GIMarshallingTests.ghashtable_utf8_none_out()) def test_ghashtable_utf8_container_out(self): - self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, TestGI.ghashtable_utf8_container_out()) + self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, GIMarshallingTests.ghashtable_utf8_container_out()) def test_ghashtable_utf8_full_out(self): - self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, TestGI.ghashtable_utf8_full_out()) + self.assertEquals({'-1': '1', '0': '0', '1': '-1', '2': '-2'}, GIMarshallingTests.ghashtable_utf8_full_out()) def test_ghashtable_utf8_none_inout(self): self.assertEquals({'-1': '1', '0': '0', '1': '1'}, - TestGI.ghashtable_utf8_none_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'})) + GIMarshallingTests.ghashtable_utf8_none_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'})) def test_ghashtable_utf8_container_inout(self): self.assertEquals({'-1': '1', '0': '0', '1': '1'}, - TestGI.ghashtable_utf8_container_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'})) + GIMarshallingTests.ghashtable_utf8_container_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'})) def test_ghashtable_utf8_full_inout(self): self.assertEquals({'-1': '1', '0': '0', '1': '1'}, - TestGI.ghashtable_utf8_full_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'})) + GIMarshallingTests.ghashtable_utf8_full_inout({'-1': '1', '0': '0', '1': '-1', '2': '-2'})) class TestGValue(unittest.TestCase): def test_gvalue_return(self): - self.assertEquals(42, TestGI.gvalue_return()) + self.assertEquals(42, GIMarshallingTests.gvalue_return()) def test_gvalue_in(self): - TestGI.gvalue_in(42) - self.assertRaises(TypeError, TestGI.gvalue_in, None) + GIMarshallingTests.gvalue_in(42) + self.assertRaises(TypeError, GIMarshallingTests.gvalue_in, None) def test_gvalue_out(self): - self.assertEquals(42, TestGI.gvalue_out()) + self.assertEquals(42, GIMarshallingTests.gvalue_out()) def test_gvalue_inout(self): - self.assertEquals('42', TestGI.gvalue_inout(42)) + self.assertEquals('42', GIMarshallingTests.gvalue_inout(42)) class TestGClosure(unittest.TestCase): def test_gclosure_in(self): - TestGI.gclosure_in(lambda: 42) + GIMarshallingTests.gclosure_in(lambda: 42) - self.assertRaises(TypeError, TestGI.gclosure_in, 42) - self.assertRaises(TypeError, TestGI.gclosure_in, None) + self.assertRaises(TypeError, GIMarshallingTests.gclosure_in, 42) + self.assertRaises(TypeError, GIMarshallingTests.gclosure_in, None) class TestPointer(unittest.TestCase): def test_pointer_in_return(self): - self.assertEquals(TestGI.pointer_in_return(42), 42) + self.assertEquals(GIMarshallingTests.pointer_in_return(42), 42) class TestGEnum(unittest.TestCase): def test_enum(self): - self.assertTrue(issubclass(TestGI.Enum, gobject.GEnum)) - self.assertTrue(isinstance(TestGI.Enum.VALUE1, TestGI.Enum)) - self.assertTrue(isinstance(TestGI.Enum.VALUE2, TestGI.Enum)) - self.assertTrue(isinstance(TestGI.Enum.VALUE3, TestGI.Enum)) - self.assertEquals(42, TestGI.Enum.VALUE3) + self.assertTrue(issubclass(GIMarshallingTests.Enum, gobject.GEnum)) + self.assertTrue(isinstance(GIMarshallingTests.Enum.VALUE1, GIMarshallingTests.Enum)) + self.assertTrue(isinstance(GIMarshallingTests.Enum.VALUE2, GIMarshallingTests.Enum)) + self.assertTrue(isinstance(GIMarshallingTests.Enum.VALUE3, GIMarshallingTests.Enum)) + self.assertEquals(42, GIMarshallingTests.Enum.VALUE3) def test_enum_in(self): - TestGI.enum_in(TestGI.Enum.VALUE3) + GIMarshallingTests.enum_in(GIMarshallingTests.Enum.VALUE3) - self.assertRaises(TypeError, TestGI.enum_in, 42) - self.assertRaises(TypeError, TestGI.enum_in, 'TestGI.Enum.VALUE3') + self.assertRaises(TypeError, GIMarshallingTests.enum_in, 42) + self.assertRaises(TypeError, GIMarshallingTests.enum_in, 'GIMarshallingTests.Enum.VALUE3') def test_enum_out(self): - enum = TestGI.enum_out() - self.assertTrue(isinstance(enum, TestGI.Enum)) - self.assertEquals(enum, TestGI.Enum.VALUE3) + enum = GIMarshallingTests.enum_out() + self.assertTrue(isinstance(enum, GIMarshallingTests.Enum)) + self.assertEquals(enum, GIMarshallingTests.Enum.VALUE3) def test_enum_inout(self): - enum = TestGI.enum_inout(TestGI.Enum.VALUE3) - self.assertTrue(isinstance(enum, TestGI.Enum)) - self.assertEquals(enum, TestGI.Enum.VALUE1) + enum = GIMarshallingTests.enum_inout(GIMarshallingTests.Enum.VALUE3) + self.assertTrue(isinstance(enum, GIMarshallingTests.Enum)) + self.assertEquals(enum, GIMarshallingTests.Enum.VALUE1) class TestGFlags(unittest.TestCase): def test_flags(self): - self.assertTrue(issubclass(TestGI.Flags, gobject.GFlags)) - self.assertTrue(isinstance(TestGI.Flags.VALUE1, TestGI.Flags)) - self.assertTrue(isinstance(TestGI.Flags.VALUE2, TestGI.Flags)) - self.assertTrue(isinstance(TestGI.Flags.VALUE3, TestGI.Flags)) - self.assertEquals(1 << 1, TestGI.Flags.VALUE2) + self.assertTrue(issubclass(GIMarshallingTests.Flags, gobject.GFlags)) + self.assertTrue(isinstance(GIMarshallingTests.Flags.VALUE1, GIMarshallingTests.Flags)) + self.assertTrue(isinstance(GIMarshallingTests.Flags.VALUE2, GIMarshallingTests.Flags)) + self.assertTrue(isinstance(GIMarshallingTests.Flags.VALUE3, GIMarshallingTests.Flags)) + self.assertEquals(1 << 1, GIMarshallingTests.Flags.VALUE2) def test_flags_in(self): - TestGI.flags_in(TestGI.Flags.VALUE2) - TestGI.flags_in_zero(Number(0)) + GIMarshallingTests.flags_in(GIMarshallingTests.Flags.VALUE2) + GIMarshallingTests.flags_in_zero(Number(0)) - self.assertRaises(TypeError, TestGI.flags_in, 1 << 1) - self.assertRaises(TypeError, TestGI.flags_in, 'TestGI.Flags.VALUE2') + self.assertRaises(TypeError, GIMarshallingTests.flags_in, 1 << 1) + self.assertRaises(TypeError, GIMarshallingTests.flags_in, 'GIMarshallingTests.Flags.VALUE2') def test_flags_out(self): - flags = TestGI.flags_out() - self.assertTrue(isinstance(flags, TestGI.Flags)) - self.assertEquals(flags, TestGI.Flags.VALUE2) + flags = GIMarshallingTests.flags_out() + self.assertTrue(isinstance(flags, GIMarshallingTests.Flags)) + self.assertEquals(flags, GIMarshallingTests.Flags.VALUE2) def test_flags_inout(self): - flags = TestGI.flags_inout(TestGI.Flags.VALUE2) - self.assertTrue(isinstance(flags, TestGI.Flags)) - self.assertEquals(flags, TestGI.Flags.VALUE1) + flags = GIMarshallingTests.flags_inout(GIMarshallingTests.Flags.VALUE2) + self.assertTrue(isinstance(flags, GIMarshallingTests.Flags)) + self.assertEquals(flags, GIMarshallingTests.Flags.VALUE1) class TestStructure(unittest.TestCase): def test_simple_struct(self): - self.assertTrue(issubclass(TestGI.SimpleStruct, gobject.GPointer)) + self.assertTrue(issubclass(GIMarshallingTests.SimpleStruct, gobject.GPointer)) - struct = TestGI.SimpleStruct() - self.assertTrue(isinstance(struct, TestGI.SimpleStruct)) + struct = GIMarshallingTests.SimpleStruct() + self.assertTrue(isinstance(struct, GIMarshallingTests.SimpleStruct)) self.assertEquals(0, struct.long_) self.assertEquals(0, struct.int8) @@ -988,9 +988,9 @@ class TestStructure(unittest.TestCase): del struct def test_nested_struct(self): - struct = TestGI.NestedStruct() + struct = GIMarshallingTests.NestedStruct() - self.assertTrue(isinstance(struct.simple_struct, TestGI.SimpleStruct)) + self.assertTrue(isinstance(struct.simple_struct, GIMarshallingTests.SimpleStruct)) struct.simple_struct.long_ = 42 self.assertEquals(42, struct.simple_struct.long_) @@ -998,51 +998,51 @@ class TestStructure(unittest.TestCase): del struct def test_not_simple_struct(self): - self.assertRaises(TypeError, TestGI.NotSimpleStruct) + self.assertRaises(TypeError, GIMarshallingTests.NotSimpleStruct) def test_simple_struct_return(self): - struct = TestGI.simple_struct_return() + struct = GIMarshallingTests.simple_struct_return() - self.assertTrue(isinstance(struct, TestGI.SimpleStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.SimpleStruct)) self.assertEquals(6, struct.long_) self.assertEquals(7, struct.int8) del struct def test_simple_struct_in(self): - struct = TestGI.SimpleStruct() + struct = GIMarshallingTests.SimpleStruct() struct.long_ = 6 struct.int8 = 7 - TestGI.simple_struct_in(struct) + GIMarshallingTests.simple_struct_in(struct) del struct - struct = TestGI.NestedStruct() + struct = GIMarshallingTests.NestedStruct() - self.assertRaises(TypeError, TestGI.simple_struct_in, struct) + self.assertRaises(TypeError, GIMarshallingTests.simple_struct_in, struct) del struct - self.assertRaises(TypeError, TestGI.simple_struct_in, None) + self.assertRaises(TypeError, GIMarshallingTests.simple_struct_in, None) def test_simple_struct_out(self): - struct = TestGI.simple_struct_out() + struct = GIMarshallingTests.simple_struct_out() - self.assertTrue(isinstance(struct, TestGI.SimpleStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.SimpleStruct)) self.assertEquals(6, struct.long_) self.assertEquals(7, struct.int8) del struct def test_simple_struct_inout(self): - in_struct = TestGI.SimpleStruct() + in_struct = GIMarshallingTests.SimpleStruct() in_struct.long_ = 6 in_struct.int8 = 7 - out_struct = TestGI.simple_struct_inout(in_struct) + out_struct = GIMarshallingTests.simple_struct_inout(in_struct) - self.assertTrue(isinstance(out_struct, TestGI.SimpleStruct)) + self.assertTrue(isinstance(out_struct, GIMarshallingTests.SimpleStruct)) self.assertEquals(7, out_struct.long_) self.assertEquals(6, out_struct.int8) @@ -1050,7 +1050,7 @@ class TestStructure(unittest.TestCase): del out_struct def test_simple_struct_method(self): - struct = TestGI.SimpleStruct() + struct = GIMarshallingTests.SimpleStruct() struct.long_ = 6 struct.int8 = 7 @@ -1058,109 +1058,109 @@ class TestStructure(unittest.TestCase): del struct - self.assertRaises(TypeError, TestGI.SimpleStruct.method) + self.assertRaises(TypeError, GIMarshallingTests.SimpleStruct.method) def test_pointer_struct(self): - self.assertTrue(issubclass(TestGI.PointerStruct, gobject.GPointer)) + self.assertTrue(issubclass(GIMarshallingTests.PointerStruct, gobject.GPointer)) - struct = TestGI.PointerStruct() - self.assertTrue(isinstance(struct, TestGI.PointerStruct)) + struct = GIMarshallingTests.PointerStruct() + self.assertTrue(isinstance(struct, GIMarshallingTests.PointerStruct)) del struct def test_pointer_struct_return(self): - struct = TestGI.pointer_struct_return() + struct = GIMarshallingTests.pointer_struct_return() - self.assertTrue(isinstance(struct, TestGI.PointerStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.PointerStruct)) self.assertEquals(42, struct.long_) del struct def test_pointer_struct_in(self): - struct = TestGI.PointerStruct() + struct = GIMarshallingTests.PointerStruct() struct.long_ = 42 - TestGI.pointer_struct_in(struct) + GIMarshallingTests.pointer_struct_in(struct) del struct def test_pointer_struct_out(self): - struct = TestGI.pointer_struct_out() + struct = GIMarshallingTests.pointer_struct_out() - self.assertTrue(isinstance(struct, TestGI.PointerStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.PointerStruct)) self.assertEquals(42, struct.long_) del struct def test_pointer_struct_inout(self): - in_struct = TestGI.PointerStruct() + in_struct = GIMarshallingTests.PointerStruct() in_struct.long_ = 42 - out_struct = TestGI.pointer_struct_inout(in_struct) + out_struct = GIMarshallingTests.pointer_struct_inout(in_struct) - self.assertTrue(isinstance(out_struct, TestGI.PointerStruct)) + self.assertTrue(isinstance(out_struct, GIMarshallingTests.PointerStruct)) self.assertEquals(0, out_struct.long_) del in_struct del out_struct def test_boxed_struct(self): - self.assertTrue(issubclass(TestGI.BoxedStruct, gobject.GBoxed)) + self.assertTrue(issubclass(GIMarshallingTests.BoxedStruct, gobject.GBoxed)) - struct = TestGI.BoxedStruct() - self.assertTrue(isinstance(struct, TestGI.BoxedStruct)) + struct = GIMarshallingTests.BoxedStruct() + self.assertTrue(isinstance(struct, GIMarshallingTests.BoxedStruct)) self.assertEquals(0, struct.long_) del struct def test_boxed_struct_new(self): - struct = TestGI.BoxedStruct.new() - self.assertTrue(isinstance(struct, TestGI.BoxedStruct)) + struct = GIMarshallingTests.BoxedStruct.new() + self.assertTrue(isinstance(struct, GIMarshallingTests.BoxedStruct)) del struct def test_boxed_struct_copy(self): - struct = TestGI.BoxedStruct() + struct = GIMarshallingTests.BoxedStruct() new_struct = struct.copy() - self.assertTrue(isinstance(new_struct, TestGI.BoxedStruct)) + self.assertTrue(isinstance(new_struct, GIMarshallingTests.BoxedStruct)) del new_struct del struct def test_boxed_struct_return(self): - struct = TestGI.boxed_struct_return() + struct = GIMarshallingTests.boxed_struct_return() - self.assertTrue(isinstance(struct, TestGI.BoxedStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.BoxedStruct)) self.assertEquals(42, struct.long_) del struct def test_boxed_struct_in(self): - struct = TestGI.BoxedStruct() + struct = GIMarshallingTests.BoxedStruct() struct.long_ = 42 - TestGI.boxed_struct_in(struct) + GIMarshallingTests.boxed_struct_in(struct) del struct def test_boxed_struct_out(self): - struct = TestGI.boxed_struct_out() + struct = GIMarshallingTests.boxed_struct_out() - self.assertTrue(isinstance(struct, TestGI.BoxedStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.BoxedStruct)) self.assertEquals(42, struct.long_) del struct def test_boxed_struct_inout(self): - in_struct = TestGI.BoxedStruct() + in_struct = GIMarshallingTests.BoxedStruct() in_struct.long_ = 42 - out_struct = TestGI.boxed_struct_inout(in_struct) + out_struct = GIMarshallingTests.boxed_struct_inout(in_struct) - self.assertTrue(isinstance(out_struct, TestGI.BoxedStruct)) + self.assertTrue(isinstance(out_struct, GIMarshallingTests.BoxedStruct)) self.assertEquals(0, out_struct.long_) del in_struct @@ -1170,129 +1170,129 @@ class TestStructure(unittest.TestCase): class TestGObject(unittest.TestCase): def test_object(self): - self.assertTrue(issubclass(TestGI.Object, gobject.GObject)) + self.assertTrue(issubclass(GIMarshallingTests.Object, gobject.GObject)) - object_ = TestGI.Object() - self.assertTrue(isinstance(object_, TestGI.Object)) + object_ = GIMarshallingTests.Object() + self.assertTrue(isinstance(object_, GIMarshallingTests.Object)) self.assertEquals(object_.__grefcount__, 1) def test_object_new(self): - object_ = TestGI.Object.new(42) - self.assertTrue(isinstance(object_, TestGI.Object)) + object_ = GIMarshallingTests.Object.new(42) + self.assertTrue(isinstance(object_, GIMarshallingTests.Object)) self.assertEquals(object_.__grefcount__, 1) def test_object_int(self): - object_ = TestGI.Object(int = 42) + object_ = GIMarshallingTests.Object(int = 42) self.assertEquals(object_.int_, 42) # FIXME: Don't work yet. # object_.int_ = 0 # self.assertEquals(object_.int_, 0) def test_object_static_method(self): - TestGI.Object.static_method() + GIMarshallingTests.Object.static_method() def test_object_method(self): - TestGI.Object(int = 42).method() - self.assertRaises(TypeError, TestGI.Object.method, gobject.GObject()) - self.assertRaises(TypeError, TestGI.Object.method) + GIMarshallingTests.Object(int = 42).method() + self.assertRaises(TypeError, GIMarshallingTests.Object.method, gobject.GObject()) + self.assertRaises(TypeError, GIMarshallingTests.Object.method) def test_sub_object(self): - self.assertTrue(issubclass(TestGI.SubObject, TestGI.Object)) + self.assertTrue(issubclass(GIMarshallingTests.SubObject, GIMarshallingTests.Object)) - object_ = TestGI.SubObject() - self.assertTrue(isinstance(object_, TestGI.SubObject)) + object_ = GIMarshallingTests.SubObject() + self.assertTrue(isinstance(object_, GIMarshallingTests.SubObject)) def test_sub_object_new(self): - self.assertRaises(TypeError, TestGI.SubObject.new, 42) + self.assertRaises(TypeError, GIMarshallingTests.SubObject.new, 42) def test_sub_object_static_method(self): - object_ = TestGI.SubObject() + object_ = GIMarshallingTests.SubObject() object_.static_method() def test_sub_object_method(self): - object_ = TestGI.SubObject(int = 42) + object_ = GIMarshallingTests.SubObject(int = 42) object_.method() def test_sub_object_sub_method(self): - object_ = TestGI.SubObject() + object_ = GIMarshallingTests.SubObject() object_.sub_method() def test_sub_object_overwritten_method(self): - object_ = TestGI.SubObject() + object_ = GIMarshallingTests.SubObject() object_.overwritten_method() - self.assertRaises(TypeError, TestGI.SubObject.overwritten_method, TestGI.Object()) + self.assertRaises(TypeError, GIMarshallingTests.SubObject.overwritten_method, GIMarshallingTests.Object()) def test_sub_object_int(self): - object_ = TestGI.SubObject() + object_ = GIMarshallingTests.SubObject() self.assertEquals(object_.int_, 0) # FIXME: Don't work yet. # object_.int_ = 42 # self.assertEquals(object_.int_, 42) def test_object_none_return(self): - object_ = TestGI.object_none_return() - self.assertTrue(isinstance(object_, TestGI.Object)) + object_ = GIMarshallingTests.object_none_return() + self.assertTrue(isinstance(object_, GIMarshallingTests.Object)) self.assertEquals(object_.__grefcount__, 2) def test_object_full_return(self): - object_ = TestGI.object_full_return() - self.assertTrue(isinstance(object_, TestGI.Object)) + object_ = GIMarshallingTests.object_full_return() + self.assertTrue(isinstance(object_, GIMarshallingTests.Object)) self.assertEquals(object_.__grefcount__, 1) def test_object_none_in(self): - object_ = TestGI.Object(int = 42) - TestGI.object_none_in(object_) + object_ = GIMarshallingTests.Object(int = 42) + GIMarshallingTests.object_none_in(object_) self.assertEquals(object_.__grefcount__, 1) - object_ = TestGI.SubObject(int = 42) - TestGI.object_none_in(object_) + object_ = GIMarshallingTests.SubObject(int = 42) + GIMarshallingTests.object_none_in(object_) object_ = gobject.GObject() - self.assertRaises(TypeError, TestGI.object_none_in, object_) + self.assertRaises(TypeError, GIMarshallingTests.object_none_in, object_) - self.assertRaises(TypeError, TestGI.object_none_in, None) + self.assertRaises(TypeError, GIMarshallingTests.object_none_in, None) def test_object_full_in(self): - object_ = TestGI.Object(int = 42) - TestGI.object_full_in(object_) + object_ = GIMarshallingTests.Object(int = 42) + GIMarshallingTests.object_full_in(object_) self.assertEquals(object_.__grefcount__, 1) def test_object_none_out(self): - object_ = TestGI.object_none_out() - self.assertTrue(isinstance(object_, TestGI.Object)) + object_ = GIMarshallingTests.object_none_out() + self.assertTrue(isinstance(object_, GIMarshallingTests.Object)) self.assertEquals(object_.__grefcount__, 2) - new_object = TestGI.object_none_out() + new_object = GIMarshallingTests.object_none_out() self.assertTrue(new_object is object_) def test_object_full_out(self): - object_ = TestGI.object_full_out() - self.assertTrue(isinstance(object_, TestGI.Object)) + object_ = GIMarshallingTests.object_full_out() + self.assertTrue(isinstance(object_, GIMarshallingTests.Object)) self.assertEquals(object_.__grefcount__, 1) def test_object_none_inout(self): - object_ = TestGI.Object(int = 42) - new_object = TestGI.object_none_inout(object_) + object_ = GIMarshallingTests.Object(int = 42) + new_object = GIMarshallingTests.object_none_inout(object_) - self.assertTrue(isinstance(new_object, TestGI.Object)) + self.assertTrue(isinstance(new_object, GIMarshallingTests.Object)) self.assertFalse(object_ is new_object) self.assertEquals(object_.__grefcount__, 1) self.assertEquals(new_object.__grefcount__, 2) - new_new_object = TestGI.object_none_inout(object_) + new_new_object = GIMarshallingTests.object_none_inout(object_) self.assertTrue(new_new_object is new_object) - TestGI.object_none_inout(TestGI.SubObject(int = 42)) + GIMarshallingTests.object_none_inout(GIMarshallingTests.SubObject(int = 42)) def test_object_full_inout(self): - object_ = TestGI.Object(int = 42) - new_object = TestGI.object_full_inout(object_) + object_ = GIMarshallingTests.Object(int = 42) + new_object = GIMarshallingTests.object_full_inout(object_) - self.assertTrue(isinstance(new_object, TestGI.Object)) + self.assertTrue(isinstance(new_object, GIMarshallingTests.Object)) self.assertFalse(object_ is new_object) @@ -1301,15 +1301,15 @@ class TestGObject(unittest.TestCase): # FIXME: Doesn't actually return the same object. # def test_object_inout_same(self): -# object_ = TestGI.Object() -# new_object = TestGI.object_full_inout(object_) +# object_ = GIMarshallingTests.Object() +# new_object = GIMarshallingTests.object_full_inout(object_) # self.assertTrue(object_ is new_object) # self.assertEquals(object_.__grefcount__, 1) class TestPythonGObject(unittest.TestCase): - class Object(TestGI.Object): + class Object(GIMarshallingTests.Object): __gtype_name__ = "Object" def method(self): @@ -1317,7 +1317,7 @@ class TestPythonGObject(unittest.TestCase): pass def test_object(self): - self.assertTrue(issubclass(self.Object, TestGI.Object)) + self.assertTrue(issubclass(self.Object, GIMarshallingTests.Object)) object_ = self.Object(int = 42) self.assertTrue(isinstance(object_, self.Object)) @@ -1329,10 +1329,10 @@ class TestPythonGObject(unittest.TestCase): class TestMultiOutputArgs(unittest.TestCase): def test_int_out_out(self): - self.assertEquals((6, 7), TestGI.int_out_out()) + self.assertEquals((6, 7), GIMarshallingTests.int_out_out()) def test_int_return_out(self): - self.assertEquals((6, 7), TestGI.int_return_out()) + self.assertEquals((6, 7), GIMarshallingTests.int_return_out()) # Interface @@ -1340,33 +1340,33 @@ class TestMultiOutputArgs(unittest.TestCase): class TestInterfaces(unittest.TestCase): def test_wrapper(self): - self.assertTrue(issubclass(TestGI.Interface, gobject.GInterface)) - self.assertEquals(TestGI.Interface.__gtype__.name, 'TestGIInterface') - self.assertRaises(NotImplementedError, TestGI.Interface) + self.assertTrue(issubclass(GIMarshallingTests.Interface, gobject.GInterface)) + self.assertEquals(GIMarshallingTests.Interface.__gtype__.name, 'GIMarshallingTestsInterface') + self.assertRaises(NotImplementedError, GIMarshallingTests.Interface) def test_implementation(self): - class TestInterfaceImpl(gobject.GObject, TestGI.Interface): + class TestInterfaceImpl(gobject.GObject, GIMarshallingTests.Interface): __gtype_name__ = 'TestInterfaceImpl' def __init__(self): gobject.GObject.__init__(self) - self.assertTrue(issubclass(TestInterfaceImpl, TestGI.Interface)) + self.assertTrue(issubclass(TestInterfaceImpl, GIMarshallingTests.Interface)) instance = TestInterfaceImpl() - self.assertTrue(isinstance(instance, TestGI.Interface)) + self.assertTrue(isinstance(instance, GIMarshallingTests.Interface)) class TestOverrides(unittest.TestCase): def test_constant(self): - self.assertEquals(TestGI.OVERRIDES_CONSTANT, 7) + self.assertEquals(GIMarshallingTests.OVERRIDES_CONSTANT, 7) def test_struct(self): # Test that the constructor has been overridden. - struct = TestGI.OverridesStruct(42) + struct = GIMarshallingTests.OverridesStruct(42) - self.assertTrue(isinstance(struct, TestGI.OverridesStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.OverridesStruct)) # Test that the method has been overridden. self.assertEquals(6, struct.method()) @@ -1374,27 +1374,27 @@ class TestOverrides(unittest.TestCase): del struct # Test that the overrides wrapper has been registered. - struct = TestGI.overrides_struct_return() + struct = GIMarshallingTests.overrides_struct_return() - self.assertTrue(isinstance(struct, TestGI.OverridesStruct)) + self.assertTrue(isinstance(struct, GIMarshallingTests.OverridesStruct)) del struct def test_object(self): # Test that the constructor has been overridden. - object_ = TestGI.OverridesObject(42) + object_ = GIMarshallingTests.OverridesObject(42) - self.assertTrue(isinstance(object_, TestGI.OverridesObject)) + self.assertTrue(isinstance(object_, GIMarshallingTests.OverridesObject)) # Test that the alternate constructor has been overridden. - object_ = TestGI.OverridesObject.new(42) + object_ = GIMarshallingTests.OverridesObject.new(42) - self.assertTrue(isinstance(object_, TestGI.OverridesObject)) + self.assertTrue(isinstance(object_, GIMarshallingTests.OverridesObject)) # Test that the method has been overridden. self.assertEquals(6, object_.method()) # Test that the overrides wrapper has been registered. - object_ = TestGI.overrides_object_return() + object_ = GIMarshallingTests.overrides_object_return() - self.assertTrue(isinstance(object_, TestGI.OverridesObject)) + self.assertTrue(isinstance(object_, GIMarshallingTests.OverridesObject)) |