Commit Graph

36 Commits

Author SHA1 Message Date
Ryan Lortie
829464a3c7 test default GSimpleAction activation
Test the default handling of the "activate" signal on GSimpleAction.

https://bugzilla.gnome.org/show_bug.cgi?id=722503
2014-01-21 15:15:38 -05:00
Matthias Clasen
5ab9e21d7a Improve test coverage for GPropertyAction 2013-12-21 13:22:00 -05:00
Matthias Clasen
97a06b4252 Improve GSimpleActionGroup test coverage
Add a case that overwrites an existing action.
2013-11-28 21:53:53 -05:00
Matthias Clasen
36a42ab0a5 Add tests for new GAction api
g_action_name_is_valid and g_action_parse_detailed_name are
now covered.
2013-11-27 22:48:06 -05:00
Matthias Clasen
0250d185b1 Fix warnings in a the actions test
The actions test tests the GSimpleActionGroup API. Maybe this
should be moved to use GActionMap, but for now, just disable
the deprecations.

There was also one test that wasn't actually hooked up, so
do that as well.
2013-11-23 21:28:40 -05:00
Ryan Lortie
f77e121650 add GPropertyAction
Add a new type of GAction that represents the value of a property on an
object.  As an example, this might be used on the "visible-child-name"
property of a GtkStack.

https://bugzilla.gnome.org/show_bug.cgi?id=703270
2013-07-11 12:35:45 -04:00
Ryan Lortie
8cddb54659 gaction: add parser for detailed action names
Expand and formalise the syntax for detailed action names, adding a
well-documented (and tested) public parser API for them.

Port the only GLib-based user of detailed action names to the new API:
g_menu_item_set_detailed_action().  The users in Gtk+ will also be
ported soon.

https://bugzilla.gnome.org/show_bug.cgi?id=688954
2013-04-01 16:53:54 -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
Dan Winship
568f737708 gio/tests: port some stuff to g_test_expect_message()
https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-09-03 08:40:14 -04:00
Pavel Vasin
b2d848e3cb gio/tests/actions: test for bug679509 2012-08-06 10:08:11 -04:00
Colin Walters
130c249eac Fix previous commit 2012-06-25 19:37:05 -04:00
Colin Walters
b837cdde69 gio/tests/actions: Plug a memory leak 2012-06-25 18:14:10 -04:00
Matthias Clasen
642e89f356 Improve GActionGroup test coverage 2012-06-04 06:04:27 -04:00
Xavier Claessens
415a8d81f6 Use GTestDBus in all GDBus unit tests
To make port easier, this rewrites dbus-sessionbus.c using a
GTestDBus singleton internally.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-19 10:07:39 +02:00
David Zeuthen
a6f83d73e5 Revert "Add GTestDBus object"
This reverts commit 1b5f70b5b0.
2012-04-18 13:47:51 -04:00
Xavier Claessens
1b5f70b5b0 Add GTestDBus object
This is a helper to write unit tests using a private dbus-daemon.

session_bus_up/down() are now just wrappers around a GTestDBus singleton.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-18 11:19:13 -04:00
Cosimo Cecchi
7cf50ceb85 tests: fix GAction test for headless run 2012-03-06 22:11:22 -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
a6366dc289 GDBusActionGroup: make API just like GDBusMenuModel
Have one simple _get() API that returns the group immediately, in an
empty state.  The group is initialised on the first attempt to interact
with it.

Leave a secret 'back door' for GApplication to do a blocking
initialisation.
2011-12-08 18:07:47 -05:00
Ryan Lortie
0fdd9985bb GDBusActionGroup: drop ability to 'inject'
Also drop the GDBusActionGroupFlags that were only meant to facilitate
injection-based usage.
2011-12-08 18:05:15 -05:00
Ryan Lortie
14900d37f4 action exporter: clarify threading situation
Exporting can only be done relative to a particular given main context
and all interaction with the action group must be on that same context.

Fix up the implementation so that the user can specify that context with
the normal (thread default) mechanism and document the limitation on the
API.

Adjust the testcase to adhere to the documentation limitations.  It
passes now.
2011-12-08 18:05:15 -05:00
Matthias Clasen
f1a403e809 Add a test for multithreaded action group exporter use 2011-12-08 18:05:14 -05:00
Ryan Lortie
f7886d6adb Action group exporter: clean up the API
Make it look more like a typical GDBusConnection API with integer
registration ID and corresponding unexport call.  Kill the 'query' call.
2011-12-08 18:05:14 -05:00
Matthias Clasen
ad09498fa7 Expand dbus action group tests
The new tests check that activation and state changes propagate
back.
2011-12-08 18:05:13 -05:00
Matthias Clasen
22c9d20b7a Add some dbus action group tests 2011-12-08 18:05:13 -05:00
Ryan Lortie
e6a25caa82 actions: merge testcases change_state and entries
Since we have support for change_state in GActionEntry now.
2011-06-29 16:20:52 +01:00
Ryan Lortie
d5915a4be3 Add testcase for GSimpleAction::change-state 2011-06-29 16:20:52 +01:00
Ryan Lortie
5978a6edb5 Add a test case for GActionEntry 2011-06-29 16:20:52 +01:00
Ryan Lortie
5ff65d8695 Make 4 incompatible changes to the GAction API
This commit represents an API break to GAction in the following ways:

  - the 'set_state' entry in the GActionInterface vtable has been
    renamed to 'change_state'.  The number and order of vtable items has
    not otherwise changed.

  - g_action_set_state() has been renamed to g_action_change_state() to
    match the updated vtable entry.

  - the "state" property of the GAction interface has been changed to
    read-only to reflect the fact that g_action_set_state() no longer
    exists.

  - GSimpleActionClass has been hidden.  GSimpleAction can no longer be
    subclassed.

>> Rationale

g_action_set_state() has never been a true setter in the sense that
calling it will update the value of the "state" property.  It has always
been closer to "request 'state' to be changed to this value" with
semantics defined by the implementor of the interface.  This is why the
equivalent method in GActionGroup had its name changed from 'set' to
'change'.  This change makes the two interfaces more consistent and
removes any implication about the effect that calling set_state() should
have on the 'state' property.

>> Impact

This incompatible API break was undertaken only because I strongly
suspect that it will go entirely unnoticed.  If the break actually
affects anybody, then we will accommodate them (possibly going as far as
to revert this commit entirely).

The virtual table change only impacts implementors of GAction.  I
strongly suspect that this is nobody (except for GSimpleAction).

The hiding of GSimpleActionClass only impacts impacts subclasses of
GSimpleAction.  I strongly suspect that none of these exist.

The changing of the property to be read-only only affects people who
were trying to change the state by using GObject properties.  I strongly
suspect that this is nobody at all.

The removal of the g_action_set_state() call is the most dangerous, but
I still suspect that it will impact nobody outside of GLib.  If anybody
is impacted by this change then, at their request, I will reintroduce
the API as a deprecated alias for g_action_change_state().
2011-06-29 11:38:21 +01:00
Ryan Lortie
d6ac6c1850 Rename methods on GActionGroup to include 'action'
Makes explicit the fact that you are interacting with the individual
action rather than the group and removes potential namespace conflicts
with classes implementing the interface (like g_application_activate()
vs g_application_activate_action()).
2010-10-19 01:16:46 +02:00
Ryan Lortie
846b0b3466 GAction is now an interface
the new class GSimpleAction is the implementation half
2010-08-30 19:26:37 +02:00
Ryan Lortie
6cd62920bb GActionGroup is now an interface
- make GAction.get_state() return a reference
 - fix some leaks/warnings in the tests
 - fix signal propagation in GSimpleActionGroup
2010-08-30 19:26:37 +02:00
Matthias Clasen
892f9b6458 Improve test coverage for actions and action groups 2010-08-21 19:18:40 -04:00
Ryan Lortie
5b38bc5ad5 Simplify/fix state logic in GAction, test it. 2010-08-21 17:35:32 -04:00
Ryan Lortie
5db9e5ad58 add GSimpleActionGroup
and a simple test
2010-08-18 02:18:54 -04:00
Ryan Lortie
8014e9c6e6 add testcase for GAction
fix some small bugs it found
2010-08-18 01:55:48 -04:00