Commit Graph

269 Commits

Author SHA1 Message Date
Stef Walter
5339950e25 threadtests: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:26:04 +01:00
Stef Walter
ac6d35b4df enums: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:25:53 +01:00
Stef Walter
b88f992c6e boxed: Fix double free in boxed unit tests
https://bugzilla.gnome.org/show_bug.cgi?id=711782
2013-11-11 07:20:09 +01:00
Stef Walter
27da0799b8 signals: Fix memory leaks in signals unit tests
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2013-11-06 10:14:57 +01:00
Stef Walter
b49344c1d3 qdata: Fix leak in qdata unit tests
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2013-11-06 10:14:30 +01:00
Dan Winship
0d62eb467f gobject: forbid finalization-during-construction
If a constructor() implementation created an object but then unreffed
it rather than returning it, that object would get left on the
construction_objects list, which would cause problems later when that
memory location got reused by another object.

"Fix" this by making it fail intentionally, and add a test for it (and
for the normal, working singleton case).

https://bugzilla.gnome.org/show_bug.cgi?id=661576
2013-10-22 11:01:15 -04:00
Dan Winship
8e17040c15 Fix overloading of "source" and "target" terminology in GBinding
GBindingTransformFunc called its arguments "source_value" and
"target_value", but in the transform_from function of a bidirectional
binding, "source_value" comes from the target object, and
"target_value" comes from the source object, which quickly gets
confusing if you need to use g_binding_get_source(), etc, in the
function.

Of course developers can call their transform function arguments
whatever they want, but many will copy from the headers/docs to start
out, so use less confusing names here ("from_value" and "to_value").

Also, fix the documentation to describe the bidirectional case
correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=709440
2013-10-06 14:24:43 -04:00
Matthias Clasen
0e9f9867fa Start using TAP
Convert {glib,gobject,gio}/tests to use the automake TAP driver
and test harness instead of gtester. To do so, we add a glib-tap.mk
that provides the same interface as glib.mk, except for the
reporting and coverage testing functionality. Eventually, we may
want to replace glib.mk with it. I've not yet converted the
toplevel tests/ directory, since it mixes gtestutils tests with
other binaries.

https://bugzilla.gnome.org/show_bug.cgi?id=692125
2013-08-17 17:25:58 -04:00
Dan Winship
f550c0dc9d update .gitignores 2013-08-17 10:35:13 -04:00
Nick Schermer
4b334ef8f1 gobject: Handle ref_count==0 in notify_by_pspec
Just like g_object_notify, check for a zero ref_count in
g_object_notify_by_pspec and leave if it is 0.

This allows using functions in ->finalize() that possibly also
notify a property change on the object.  Previously,
this resulted in an error from g_object_ref.

https://bugzilla.gnome.org/show_bug.cgi?id=705570
2013-08-14 18:11:05 +01:00
Colin Walters
d9e01e0c37 tests/closure: Send SIGUSR1 only to our pid
Otherwise in e.g. the gnome-ostree integrationtest system, we
end up sending SIGUSR1 to the *entire session*, which triggers
various badness in untested debugging paths from gnome-session.
2013-07-22 15:14:34 +01:00
Colin Walters
00f5c63621 tests/closure: Use correct prototype for signal callback
This test worked when compiled without optimization, but fails with
-O2.  Presumably we just happened to find the GMainLoop off the stack
somewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=704267
2013-07-22 09:34:24 -04:00
Dan Winship
88ab63155d gobject/tests/closure: fix on win32
(The g_closure_unref() was wrong, but was not causing errors on linux
for some reason.)

https://bugzilla.gnome.org/show_bug.cgi?id=704447
2013-07-21 20:50:11 +01:00
Colin Walters
35e331b869 tests/closure: Fix invalid unref
The closure is floating, g_source_set_closure() will claim the
ref, so we do not need to unref it.
2013-07-21 19:42:34 +01:00
Dan Winship
72a7e824d6 gsourceclosure: fix idle/timeout/signal closures, add child watch support
And add a test for all source types.

https://bugzilla.gnome.org/show_bug.cgi?id=704267
2013-07-17 21:41:45 -04:00
Emmanuele Bassi
54cc43630d Rename the generated private data getter function
As it turns out, we have examples of internal functions called
type_name_get_private() in the wild (especially among older libraries),
so we need to use a name for the per-instance private data getter
function that hopefully won't conflict with anything.
2013-06-24 15:43:04 +01:00
Emmanuele Bassi
d3dec6ec80 Allow registering instance private data during get_type()
For static types, it should be possible to register a private data
structure right when we are registering the type, i.e. from the
get_type() implementation. By allowing this, we can take advantage of
the existing type definition macros to cut down the amount of code
necessary (as well as the knowledge baggage) when creating a new type.

The main issue with this new feature is that it cannot be mixed with the
old idiomatic way of adding private instance data by calling a function
in the middle of the class_init() implementation, as that imposes the
additional constraint of initializing the whole type hierarchy in order
to retrieve the offset of the private data in the GTypeInstance
allocation.

For this reason we are going to follow a two-step process; in the first
step, we are going to introduce the new (semi-private) API to register
the intent to add private instance data from within the get_type()
implementation, and hide it behind a macro; at the same time, the
G_DEFINE_TYPE_EXTENDED macro is going to be modified so that it will
register the private instance data if the macro was used, using a new
(semi-private) function as well. Once we have migrated all our code, we
will make the first new function perform the actual private data
registration, and turn the second new function into a no-op. This should
guarantee a transparent migration of existing code to the new idiomatic
form.

https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-06-24 14:18:01 +01:00
Colin Walters
18702168e1 gobject/tests: Add missing build dependency 2013-06-17 13:05:11 -04:00
Emmanuele Bassi
910732ea7e tests/binding: Ensure that the binding goes away
Use weak pointers so that we can check that the GBinding instance goes
away when it should.

https://bugzilla.gnome.org/show_bug.cgi?id=698018
2013-06-12 11:24:55 +01:00
Emmanuele Bassi
25a3c8720c binding: Make unbind() release the reference on GBinding
The automatic memory management of GBinding is not optimal for high
order languages with garbage collectors semantics. If we leave the
binding instance inert but still referenced it will be leaked, so one
solution that does not throw away the baby of C convenience with the
bathwater of language bindability is to have unbind() perform an
implicit unref().

Hopefully, C developers will read the documentation and especially the
note that says that after calling unbind() the reference count on the
GBinding instance is decreased.

https://bugzilla.gnome.org/show_bug.cgi?id=698018
2013-06-12 11:24:55 +01:00
Ryan Lortie
f9eb9eed10 Rework the build system for a new tests approach
Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
2013-05-31 23:12:15 -04:00
Ryan Lortie
da478acd3c Remove G_TEST_DATA= from installed .test files
This is no longer needed with the new test data file finding stuff.

https://bugzilla.gnome.org/show_bug.cgi?id=549783
2013-05-29 09:03:32 -04:00
Matthias Clasen
07168724d7 Improve signal test coverage 2013-05-29 08:37:19 -04:00
Matthias Clasen
a9abbb3192 Improve test coverage in gobject/
Lines:          6631    8862    74.8 %
Functions:      747     893     83.7 %
2013-05-29 08:37:08 -04:00
Colin Walters
0b167b0ae9 build: Fix usage of %.test again
We actually need the first dependency because it includes the
final executable name.  Rather, fix the original bug by using
the variable $(EXEEXT).
2013-05-24 22:16:44 +01:00
Colin Walters
5088c705ac tests: Drop unnecessary % from .test pattern match rule
On Windows, the executables will have .exe, so this won't
match.  Furthermore, they aren't actually dependent on the
executable to build.
2013-05-24 16:30:21 -04:00
Matthias Clasen
f66016261a Make gobject tests installable
This makes the gobject tests run as part of the ostree integration
tests.
2013-05-19 21:49:51 -04:00
Dan Winship
e3d1869ee3 tests: port from g_test_trap_subprocess() to g_test_trap_fork()
https://bugzilla.gnome.org/show_bug.cgi?id=679683
2013-05-13 12:10:52 -04:00
Emmanuele Bassi
a360b314aa binding: Add an explicit unbind()
Higher order languages with garbage collection can have issues releasing
a binding, as they do not control the last reference being dropped on
the binding, source, or target instances.

https://bugzilla.gnome.org/show_bug.cgi?id=698018
2013-05-02 15:50:21 -07:00
Ryan Lortie
c18462b580 GParamSpec: add g_param_spec_get_default_value()
The way of getting the default value out of a GParamSpec is to allocate
a GValue, initialise it, then call g_param_spec_set_default() to set the
default value into that GValue.

This is exactly how we handle setting the default value for all of the
construct properties that were not explicitly passed to g_object_new().

Instead of doing the alloc/init/store on all construct properties on
every call to g_object_new(), we can cache those GValues in the private
data of the GParamSpec itself and reuse them.

This patch does not actually make that change to g_object_new() yet, but
it adds the API to GParamSpec so that a future patch to GObject can make
the change.

https://bugzilla.gnome.org/show_bug.cgi?id=698056
2013-04-23 14:39:09 -04:00
Colin Walters
156b14cde5 build: Add --disable-compile-warnings
Some (broken) toolchains for example trip up
-Werror=missing-prototypes in system headers.  This patch allows
people to skip the formerly hardcoded "baseline" warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=694757
2013-02-27 08:34:01 -05:00
Matthias Clasen
ab328469f5 Silence automake
automake doesn't like INCLUDES anymore.
2013-02-02 22:54:15 -05:00
Ryan Lortie
c2055f22f4 gtype: disallow adding interfaces after the fact
Add a check to prevent adding an interface to a class that has already
had its class_init done.

This is an incompatible change but it is suspected that there are not
many users of this functionality.  Two known exceptions are pygobject
(fixed in bug 686149) and our own testsuite (affected tests have been
temporarily disabled by this patch).

Once we confirm that nobody else is using this functionality we can
remove a rather large amount of code for dealing with this case.

https://bugzilla.gnome.org/show_bug.cgi?id=687659
2013-01-04 21:20:04 +01:00
Rico Tzschichholz
efa7b5f1e7 Revert "gtype: disallow adding interfaces after the fact"
This reverts commit d6a075b0d8.
2013-01-04 20:25:46 +01:00
Matthias Clasen
0178402c6d Revert "tests: port from g_test_trap_subprocess() to g_test_trap_fork()"
This reverts commit ea06ec8063.
2012-12-19 15:20:37 -05:00
Dan Winship
ea06ec8063 tests: port from g_test_trap_subprocess() to g_test_trap_fork()
(or, in a few cases, to g_test_expect_message())

https://bugzilla.gnome.org/show_bug.cgi?id=679683
2012-12-19 14:35:10 -05:00
Ryan Lortie
5df1edaf70 gtype: disallow adding interfaces after the fact
Add a check to prevent adding an interface to a class that has already
had its class_init done.

This is an incompatible change but it is suspected that there are not
many users of this functionality.  Two known exceptions are pygobject
(fixed in bug 686149) and our own testsuite (affected tests have been
temporarily disabled by this patch).

Once we confirm that nobody else is using this functionality we can
remove a rather large amount of code for dealing with this case.

https://bugzilla.gnome.org/show_bug.cgi?id=687659
2012-12-18 21:37:07 +01:00
Rico Tzschichholz
d1ab41c940 Revert "gtype: disallow adding interfaces after the fact"
This reverts commit d6a075b0d8.
2012-12-18 21:23:13 +01:00
Ryan Lortie
d6a075b0d8 gtype: disallow adding interfaces after the fact
Add a check to prevent adding an interface to a class that has already
had its class_init done.

This is an incompatible change but it is suspected that there are not
many users of this functionality.  Two known exceptions are pygobject
(fixed in bug 686149) and our own testsuite (affected tests have been
temporarily disabled by this patch).

Once we confirm that nobody else is using this functionality we can
remove a rather large amount of code for dealing with this case.

https://bugzilla.gnome.org/show_bug.cgi?id=687659
2012-11-05 13:20:28 -05:00
Colin Walters
8e59d8602c Use (void) for no parameters, not ()
This ensures we build with -Werror=missing-parameter-type.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:02 -04:00
Colin Walters
84475e4320 build: Prototype GType accessors for private classes
Otherwise we fail to build with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:02 -04:00
Colin Walters
f6da43f56c build: Ensure we #include header files for glib-genmarshal code
Otherwise we fail with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:01 -04:00
Colin Walters
4447d5ce11 tests/signals: Disable large enumeration value test that is failing on PPC64
Basically due to a combination of va_args semantics around
signed/unsigned ints, this test case fails on ppc64.  At the moment,
we have as yet to find any real-world consumer with such a large
enumeration value.

Unfortunately, the possible fixes for this are extremely invasive;
we would have to define a new enum API.

Given both of these facts, we believe it makes the most sense at the
current time to simply not test this. If we at a later time determine
there is such a real-world consumer, we can look at doing the
necessary fixes.

https://bugzilla.gnome.org/show_bug.cgi?id=686662
2012-10-31 17:45:21 -04:00
Ryan Lortie
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Ryan Lortie
66b0d95f0b [gsignal] Fix closure invalidation
If the closure is invalidated we drop the ref on the signal handler
node, but if the signal is currently being dispatched, the ref could be
held elsewhere.

Flag that we no longer have an outstanding invalidation handler so that
we don't try to unregister ourselves when the other ref drops.

Add a testcase that catches this situation.
2012-10-09 11:40:45 -04:00
Dan Winship
4d1b0d46db update .gitignore 2012-09-03 08:56:10 -04:00
Dan Winship
03be681e08 gobject/tests: plug leaks
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:36:10 -04:00
Dan Winship
e0cba35d41 gobject/tests: use g_test_expect_messages()
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:36:10 -04:00
Matthias Clasen
d80d70458a Add a threaded test for g_object_replace_data
This is the threaded atomic add test from glib/tests/atomic.c,
redone using qdata instead of an atomic int to store the values.
2012-09-02 15:10:20 -04:00
Matthias Clasen
2fa77fb76c Add some tests for new object data api
These are non-threaded, but the do test dup and destroy somewhat.

https://bugzilla.gnome.org/show_bug.cgi?id=682849
2012-09-02 15:09:13 -04:00
Matthias Clasen
58f0173149 Add tests for signal convenience api 2012-04-23 08:20:22 -04:00
Matthias Clasen
e62102dbc5 Add tests for toggle reference and qdata 2012-04-23 08:20:22 -04:00
Matthias Clasen
8b618eb7f1 Improve test coverage in gobject/tests
This is just making sure that we execute property getters/setters.
2012-04-23 08:20:21 -04:00
Matthias Clasen
ee29e49684 binding: Improve test coverage 2012-04-08 10:24:52 -04:00
Chun-wei Fan
24fa2ee53c gobject/tests/signals.c: Remove C99ism
Declare variables in start of block.
2012-04-05 15:46:34 +08:00
Matthias Clasen
bebbc69081 Improve boxed test coverage
This commit add basic tests for all GLib types that are registered
as boxed types.
2012-04-01 23:08:42 -04:00
Erik van Pienbroek
7b939efa6f Use native glib-genmarshal when cross-compiling
The ability to cross-compile glib got broken after the
merge of the 'signal-performance' branch as the assumption
was made that the generated glib-genmarshal can be executed
on the host (which isn't valid when cross-compiling).

Fixed this by using the just-built glib-genmarshal for normal
compilations and the native (host) glib-genmarshal when doing a
cross-compilation as was also done in several other areas of GLib

Tested for host=x86_64-unknown-linux-gnu, target=x86_64-unknown-linux-gnu
and host=x86_64-unknown-linux-gnu, target=i686-w64-mingw32

https://bugzilla.gnome.org/show_bug.cgi?id=671676
2012-03-09 08:24:28 +01:00
Alexander Larsson
f3fb42cfaf Merge branch 'signal-performance' 2012-03-05 12:29:45 +01:00
Matthias Clasen
1426a8ca07 Fix binding properties of the same object
This problem was pointed out in bug 639873.
The patch here is based on Matt Barnes patch,
I've added a testcase as well.
2012-03-04 20:49:04 -05:00
Emmanuele Bassi
d10f79a196 build: Fix rules for marshalers.[ch] 2012-03-02 17:06:36 +00:00
Alexander Larsson
3d52ee999a Add more tests for signal emissions 2012-03-02 17:13:04 +01:00
Emmanuele Bassi
817d992abc value array: Annotate with versioned deprecation
https://bugzilla.gnome.org/show_bug.cgi?id=670542
2012-02-27 00:00:05 -05:00
Rui Matos
9ff09f34cf gvaluetransform: Fix an infinite loop with GFlagsValue sets with the 0 value
Transforming a GValue holding flags from a GFlagsValue set that includes the 0
value (no flag bits set) into a string would loop until exhausting all the
available memory.

https://bugzilla.gnome.org/show_bug.cgi?id=670557
2012-02-22 12:17:38 +01:00
Matthias Clasen
b01af10c86 Remove a check that triggers deprecation warnings 2012-01-30 14:06:22 -05:00
Emmanuele Bassi
0ac9ab4e27 Deprecate GValueArray
The GValueArray type was added in a time, during the Jurassic era or so,
when GArray did not have a representable GType. The GValueArray API has
various issues as well:

  - it doesn't match the other GLib array types;
  - it is not reference counted;
  - the structure is fully exposed on the stack, so it cannot be
    extended to add reference counting;
  - it cannot be forcibly resized.

The nice thing is that now we have a GArray type that can replace in
full GValueArray, so we can deprecate the latter, and reduce the
complexity in GLib, application code, and bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=667228
2012-01-24 23:37:24 -05:00
Simon McVittie
254efaf85e Skip tests of incorrect property usage under gtester -m no-undefined
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666116
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2012-01-05 15:47:26 +00:00
Simon McVittie
146aa7aa17 Add regression test for GWeakRef used to cache a singleton
https://bugzilla.gnome.org/show_bug.cgi?id=548954
2012-01-02 12:23:21 -05:00
Simon McVittie
fa5ff39559 Add deterministic tests for the API of GWeakRef
These don't address the thread-safety, but do address basic use.

https://bugzilla.gnome.org/show_bug.cgi?id=548954
2012-01-02 12:23:18 -05:00
Simon McVittie
fa4792c35e various tests: do not provoke SIGTRAP with -m no-undefined
Some of the GLib tests deliberately provoke warnings (or even fatal
errors) in a forked child. Normally, this is fine, but under valgrind
it's somewhat undesirable. We do want to follow fork(), so we can check
for leaks in child processes that exit gracefully; but we don't want to
be told about "leaks" in processes that are crashing, because there'd
be no point in cleaning those up anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=666116
2011-12-27 17:51:09 -05:00
Ryan Lortie
557da16507 GObject: do checks on interface property install
Add some checks to g_object_interface_install_property() similar to
those in g_object_class_install_property().

https://bugzilla.gnome.org/show_bug.cgi?id=666616
2011-12-20 19:45:57 -05:00
Ryan Lortie
b237187109 GObject: require READ or WRITE on property install
g_object_class_install_property() currently lets you install properties
that are neither readable nor writable.  Add a check to prevent that.

https://bugzilla.gnome.org/show_bug.cgi?id=666616
2011-12-20 19:43:21 -05:00
Ryan Lortie
4e793c2eef GObject: allow G_PARAM_CONSTRUCT on any override
We were previously preventing implementations of an interface from
specifying G_PARAM_CONSTRUCT for a property of that interface if the
interface didn't specify it itself (or was readonly).

This is something that should only interest the implementation, so we
remove this restriction.

This allows 6 new possible override scenarios:

 - writable                 -> writable/construct
 - writable                 -> readwrite/construct
 - readwrite                -> readwrite/construct
 - writable/construct-only  -> writable/construct
 - writable/construct-only  -> readwrite/construct
 - readwrite/construct-only -> readwrite/construct

and we update the testcase to reflect this.

https://bugzilla.gnome.org/show_bug.cgi?id=666616
2011-12-20 19:40:44 -05:00
Ryan Lortie
b3b9f82206 GObject: add test for interface property overrides
Add a testcase to check all possibilities for overriding a property
specified on an interface from an implementation of that interface,
changing the type and flags.

https://bugzilla.gnome.org/show_bug.cgi?id=666616
2011-12-20 19:18:26 -05:00
Ryan Lortie
a2e9318d4a two test fixes for ARM
First, some ARM systems are not fast enough to meet the 30 second
deadline in gwakeuptest.c, so increase that to 60.

Second, we have some signed/unsigned woes in the gparam transform tests.
2011-12-14 09:33:30 -05:00
Simon McVittie
29f2ced8eb various GLib tests: plug memory leaks
These don't really matter, since it's test code, but they do obscure
real leaks in the library.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
Acked-by: Matthias Clasen <mclasen@redhat.com>
2011-12-14 12:40:16 +00:00
Javier Jardón
108480b7ba gobject: Use G_VALUE_INIT 2011-10-18 17:12:33 +01:00
Ryan Lortie
38e8ecd62a more 'static' adding in testcases
No dead code found this time...
2011-10-16 21:41:15 -04:00
Ryan Lortie
430c5635f2 g_thread_new: never fail
Remove the GError argument from g_thread_new() and abort on failure.
Introduce g_thread_try() for those who want to handle failure.
2011-10-13 01:00:57 -04:00
Ryan Lortie
015f4b4513 thread: nuke the concept of 'joinable'
And remove the 'joinable' argument from g_thread_new() and
g_thread_new_full().

Change the wording in the docs.  Clarify expectations for
(deprecated) g_thread_create().
2011-10-13 00:43:33 -04:00
Matthias Clasen
daede1dc27 Disable deprecations where appropriate in tests 2011-10-12 00:48:18 -04:00
Ryan Lortie
6f343ca548 Remove g_mutex_new()/g_cond_new() in testcases
These were the last users of the dynamic allocation API.

Keep the uses in glib/tests/mutex.c since this is actually meant to test
the API (which has to continue working, even if it is deprecated).

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 19:35:27 -04:00
Dan Williams
6feff14f19 tests: add signal marshalling return tests for int/uint
https://bugzilla.gnome.org/show_bug.cgi?id=659881
2011-09-28 11:01:53 -05:00
Dan Williams
a343904596 tests: fix generic closure marshalling tests
We're testing enums here, not flags, so we need to make sure
we're trying to send enums through the marshalling.

https://bugzilla.gnome.org/show_bug.cgi?id=659881
2011-09-28 11:01:39 -05:00
Dan Williams
adf7e0740c tests: Add some return value torture testcases for the generic marshaller
Ensure that ENUM types are properly marshalled back from libffi types
to glib types, which was failing on ppc64.

https://bugzilla.gnome.org/show_bug.cgi?id=659881
2011-09-28 11:01:14 -05:00
Colin Walters
f42fe6cdc0 gvalue: Add explicitly signed g_value_get_schar() and g_value_set_schar()
The documentation for G_TYPE_CHAR says:

"The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed
 integer."

However the return value for g_value_get_char() was just "char" which
in C has an unspecified signedness; on e.g. x86 it's signed (which
matches the GType), but on e.g. PowerPC or ARM, it's not.

We can't break the old API, so we need to suck it up and add new API.
Port most internal users, but keep some tests of the old API too.

https://bugzilla.gnome.org/show_bug.cgi?id=659870
2011-09-22 20:05:38 -04:00
Colin Walters
1df8160fa6 tests: Add a some torture test cases for the generic marshaller
In particular this has a test case for a G_TYPE_ENUM which we were
running into a failure on ppc64.

https://bugzilla.gnome.org/show_bug.cgi?id=659881
2011-09-22 18:51:43 -04:00
Ryan Lortie
804e3ba4dd gitignore tweaks 2011-07-22 15:47:24 +02:00
Matthias Clasen
436dbe7744 Don't test negative values in ulong conversions
This is failing on 32bit build slaves.
2011-07-10 21:57:45 -04:00
Matthias Clasen
5db5a46c3d Add tests for GValueArray 2011-06-23 00:05:18 -04:00
Matthias Clasen
f4da19daa6 Improve test coverage for GValue transformations 2011-06-23 00:05:18 -04:00
Dan Winship
bdc23c44e8 Fix compiler warnings 2011-05-02 11:50:23 -04:00
Ryan Lortie
7a752e0817 Improve .gitignore 2011-03-31 15:51:01 +05:30
Christian Persch
61b0e1c8d4 Add G_SIGNAL_MUST_COLLECT
In some cases, signal arguments have to be collected, even if there are i
no signal handlers connected (e.g. for GVariant parameters, where collection
consumes a floating variant).

Based on a patch by Christian Persch.

Bug #643624.
2011-03-15 01:32:22 -04:00
Matthias Clasen
2c0a8ff4dc Add a testcase for bug 637738 2011-02-18 23:46:09 -05:00
Matthias Clasen
f1a88e7e42 More GValue conversion tests 2011-02-14 19:20:44 -05:00
Matthias Clasen
cfe8ec429a Vary the order of unreffing dest and src
For slightly better test coverage.
2011-02-14 19:20:44 -05:00
Matthias Clasen
309f5f978b Improve test coverage
Various test additions, mainly in GObject
2011-02-13 23:49:19 -05:00
Matthias Clasen
bf1027f826 Move ifaceproperties test to gobject/tests/ 2010-12-27 23:49:12 -05:00
Jonas Holmberg
dec8323b4b gobject: added property test
Added test for setting properties with g_object_new.
2010-11-28 18:27:47 -05:00
Ryan Lortie
1a1fc130ec New function: g_clear_object()
By analogy to g_clear_error, takes a pass-by-reference GObject reference
and, if non-%NULL, unrefs it and sets it equal to %NULL.

Bug #620263.
2010-11-08 18:21:51 -05:00
Emmanuele Bassi
9cd43d7a4c gobject: Add install_properties()
Since we added g_object_notify_by_pspec(), an efficient way to install
and notify properties relies on storing the GParamSpec pointers inside
a static arrays, like we do for signal identifiers.

Instead of multiple calls to g_object_class_install_property(), we
should have a single function to take the static array of GParamSpecs
and iterate it.

https://bugzilla.gnome.org/show_bug.cgi?id=626919

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-13 12:34:53 +01:00
Matthias Clasen
e02571e93b Add bug references to some tests 2010-08-13 21:23:23 -04:00
Ryan Lortie
b3b7ea8e22 Replace -I with $(glib_INCLUDES) and friends
Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.
2010-08-06 13:10:34 -04:00
paul
9f6faaffb6 Add $(top_builddir)/glib to includes
This is required to find glibconfig.h during srcdir != builddir builds
2010-08-05 09:08:34 -04:00
Emmanuele Bassi
4bc9654c63 binding: Add a default marshaller for the closure API
The g_object_bind_property_with_closures() function should set a
marshaller if the two GClosures don't have one already. This simplifies
the caller code and avoids duplication.

We need to add a new marshaller to the gmarshal.list matching the
signature of the GBindingTransformFunc function.
2010-08-04 01:09:28 +01:00
Emmanuele Bassi
90f7f171e6 binding: Add G_BINDING_INVERT_BOOLEAN
Since GSettings got the same functionality and flag in commit ca3b7b75b
GBinding should also have the ability to automatically invert a boolean
value without requiring a custom transformation function.
2010-08-03 10:29:50 +01:00
Emmanuele Bassi
3be3ad61d1 binding: Add a closure-based variant of bind_property_full()
Since using the function pointer version muddles the memory management
requirements of language bindings, we should implement a GClosure-based
variant on top of g_object_bind_property_full().

https://bugzilla.gnome.org/show_bug.cgi?id=622278
2010-08-03 09:51:49 +01:00
Benjamin Otte
24161d9c46 binding: Cast to avoid compiler warning 2010-07-22 21:56:20 +02:00
Matthias Clasen
c2997efb66 Add some more checks to the binding tests 2010-07-05 23:13:18 -04:00
Emmanuele Bassi
f587cb57f2 binding: Add SYNC_CREATE to the flags
When creating a binding between two object properties we might want to
automatically synchronize the two values at the moment of the binding
creation, instead of waiting for the next change.

The G_BINDING_SYNC_CREATE flag does exactly what it says on the tin.

https://bugzilla.gnome.org/show_bug.cgi?id=622281
2010-06-23 15:19:24 +01:00
Emmanuele Bassi
f72f65643f tests: Add a chain binding
Test the case with a chain like A → B, B → C, and what happens when
switching to a direct A → C link.

https://bugzilla.gnome.org/show_bug.cgi?id=621782
2010-06-16 14:56:59 +01:00
Emmanuele Bassi
6d1d9cf1b5 gobject: Add GBinding
GBinding is a simple, opaque object that represents a binding between a
property on a GObject instance (source) and property on another GObject
instance (target).

https://bugzilla.gnome.org/show_bug.cgi?id=348080
2010-06-15 16:06:18 +01:00
Alberto Garcia
7693b0af44 [tests] Remove C++ style comments
It makes the IBM XL C Compiler (the 'native' non-free compiler
on the AIX 5.3 and 6.1 platform) stop compiling with syntax error.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=581300

Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-01-20 18:58:32 +01:00
Dan Winship
f74c0e257f update .gitignores 2009-12-18 12:27:36 +01:00
Dan Winship
91d96350a7 Add G_DEFINE_INTERFACE
This is a macro similar to G_DEFINE_TYPE but it lets you define
interfaces rather than classes.

For discussion, see bug #320482
2009-12-01 10:44:42 +01:00
Edward Hervey
83ee0d947d gobject/tests: New test for dynamic class creation/destruction
Starts 100 threads which ref/unref a dynamic class to test the recent
changes to class init/uninit.
2009-11-30 20:52:33 +01:00
Ryan Lortie
920f3bffb3 Bug 549771 – improved .gitignore for glib
2007-09-02  Ryan Lortie  <desrt@desrt.ca>

        Bug 549771 – improved .gitignore for glib

        * docs/reference/.gitignore:
        * docs/reference/gio/.gitignore:
        * docs/reference/gobject/tmpl/.gitignore:
        * gio/.gitignore:
        * gio/tests/.gitignore:
        * glib/.gitignore:
        * glib/libcharset/.gitignore:
        * glib/tests/.gitignore:
        * gmodule/.gitignore:
        * gobject/.gitignore:
        * gobject/tests/.gitignore:
        * po/.gitignore:
        * tests/.gitignore: new files
        * .gitignore: remove 'build' (since it's part of glib now), add more
        useful things.


svn path=/trunk/; revision=7432
2008-09-02 18:40:39 +00:00
13:34:01 Tim Janik
6908da5a57 added race condition tester from Michael Meeks with a couple fixes so it's
2008-06-10 13:34:01  Tim Janik  <timj@imendio.com>

        * tests/threadtests.c: added race condition tester from Michael Meeks
        with a couple fixes so it's not triggering development warnings. From:
        Bug 537555 - GObject instantiation not thread safe ...


svn path=/trunk/; revision=6983
2008-06-10 11:35:46 +00:00
18:41:22 Tim Janik
fcee4e1931 integrate tests/.
2008-02-05 18:41:22  Tim Janik  <timj@imendio.com>

        * Makefile.am: integrate tests/.

        * tests/: new directory for libgobject tests.

        * tests/Makefile.am: build and run threadtests.

        * tests/threadtests.c: test multi-threaded initializers for
        object classes and interfaces.



svn path=/trunk/; revision=6452
2008-02-05 17:42:09 +00:00