Commit Graph

33 Commits

Author SHA1 Message Date
Tomasz Miąsko
0679bd2732 tests: Fix data race in gmenumodel test
Synchronize access to server_connection.
2019-03-05 15:14:58 +01:00
Tomasz Miąsko
9347c7630f tests: Fix GRand leak in GMenuModel tests 2018-11-01 12:14:09 +01:00
Simon McVittie
8fef0a9cd3 gmenumodel test: Wait for the expected events to happen
Previously, we waited an arbitrary 100ms or 200ms and then asserted
that the events had happened, but that might fail if the machine is
slow or heavily loaded.

We still wait for an arbitrary time for negative tests (asserting
that no more signals are received) because we don't have any way
to do better here.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884661

https://bugzilla.gnome.org/show_bug.cgi?id=791744
2017-12-18 18:56:35 +00:00
Simon McVittie
ea159a9e1a gmenumodel test: If something goes wrong, don't wait forever
I'm about to add some loops that would otherwise wait indefinitely.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884661

https://bugzilla.gnome.org/show_bug.cgi?id=791744
2017-12-18 18:56:35 +00:00
Daiki Ueno
c71098ddab tests/gmenumodel: Add test cases using peer-to-peer D-Bus connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Matthias Clasen
dc496ac764 Add a test for GMenuAttributeIter 2014-06-05 08:04:47 -04:00
Matthias Clasen
dcf5dea922 Improve GMenuModel test coverage 2013-06-02 01:44:15 -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
Lars Uebernickel
07fadc7932 GMenuModel: add test for the new GMenuItem API 2012-08-20 16:26:25 -04:00
Matthias Clasen
eeb5140ad2 Improve GMenu test coverage 2012-06-04 06:04:28 -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
David Zeuthen
9dce93514e GMenuModel: Don't leak GDBusConnection in test
See https://bugzilla.gnome.org/show_bug.cgi?id=672985#c89

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-18 13:33:00 -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
Matthias Clasen
6a57bf1243 Make the dbus menu tests independent from the session bus
With this change,
DBUS_SESSION_BUS_ADDRESS= make check
succeed here.
2012-04-08 10:24:50 -04:00
Ryan Lortie
2a90aba068 Drop the GMenu markup functions
The parser has been moved into Gtk in a modified form and the printer
was never really useful anyway (except for debugging/testing).
2012-01-25 21:05:27 -05:00
Matthias Clasen
f077127d01 Add a test for ids on submenu and section elements
The test checks that menus which are created via
<submenu id=...> or <section id=...> end up in the objects
hash table.
2011-12-24 22:59:10 -05:00
Matthias Clasen
b386d9ffb7 Add another menu parser test
This one concerns itself with objects.
2011-12-14 00:10:34 -05:00
Ryan Lortie
25ffde957c menu threaded test: run the mainloop after export
GDBusConnection now dispatches GDestroyNotify calls back to the
mainloop.  Adding an idle to the mainloop is O(n) in the number of idles
already there.  We therefore need to periodically empty the mainloop to
avoid quadratic behaviour with a very large 'n'.
2011-12-08 18:05:15 -05:00
Ryan Lortie
1c036cb9f5 Rename GMenuProxy to GDBusMenuModel
This improves consistency with GDBusActionGroup.
2011-12-08 18:05:15 -05:00
Matthias Clasen
328bf4616a Add testcase for threaded menu exporter use
This currently fails
2011-12-08 18:05:14 -05:00
Ryan Lortie
ef8c443092 menumodel test: don't get stuck in a loop
Sometimes randa and randb end up having the same state, causing them to
return the same stream of 'random numbers'.  This is a problem for the
testcase that is looping to find unequal menus.

If we find ourselves in this state, throw one of the random generators
away and recreate it so we have a better chance of getting some unequal
menus.
2011-12-08 18:05:14 -05:00
Ryan Lortie
cfbc1b5a4b Menu model exporter: clean up the API
Give it the same treatment as the exporter for GActionGroup just got.

There is a wart here: the exporter attempt to re-enter GDBusConnection
when it is freed in order to cancel outstanding name watches.
GDBusConnection holds its own lock while calling the destroy notify, so
the attempt at reentrancy results in a deadlock.

We have a workaround to deal with that for now...
2011-12-08 18:05:14 -05:00
Ryan Lortie
a0a94cd6c6 menu tests: keep mirror of proxy
Create a 'mirror' model of the proxy for the testcase.  In addition to
testing that the proxy model emits the proper signals this also keeps
the proxy alive (by holding references to it from the mirror).

The previous code would create the submenu proxies and destroy them
right away (from the recursive step in the equality comparison
functions).  This means that the subscription would go out over D-Bus
and the proxy would be destroyed before it returned.  Keeping the model
alive allows it to be actually updated.
2011-12-08 18:05:13 -05:00
Matthias Clasen
5718804e58 Some more assertions 2011-12-08 18:05:13 -05:00
Matthias Clasen
2cf4866e33 Avoid cross-talk between tests
Each test needs to remove the sources that it attaches
to the default main context, or else things will work
fine in isolation, but go bad in a full test run.
2011-12-08 18:05:13 -05:00
Matthias Clasen
ff833ccac9 Remove unused variable 2011-12-08 18:05:13 -05:00
Matthias Clasen
500f8fbac5 Add a test for menu subscriptions 2011-12-08 18:05:13 -05:00
Matthias Clasen
0f88b7af33 Add some tests for links 2011-12-08 18:05:13 -05:00
Matthias Clasen
0760bf5850 Add parser roundtrip tests 2011-12-08 18:05:13 -05:00
Matthias Clasen
db34b1aebe Rename exporter APIs
There are no public 'exporter' objects, so don't allude to them
in the function names. At the same time, we want to make it clear
that these functions are D-Bus specific.

The new APIs are
g_action_group_dbus_export_start
g_action_group_dbus_export_query
g_action_group_dbus_export_stop
g_menu_model_dbus_export_start
g_menu_model_dbus_export_query
g_menu_model_dbus_export_stop
2011-12-08 18:05:12 -05:00
Ryan Lortie
6dfb9d583f Add GMenuModel testcases 2011-12-08 18:05:12 -05:00