tests: Add MetaOrientationManager tests via SensorsProxy mock

Create a test system bus and use it to run all the tests, add a mock
SensorsProxy (via dbusmock template) server that implements the
net.hadess.SensorProxy interface.

To make testing easier, the service is created on request of a proxy for
it, whose lifetime controls the mock service lifetime as well.
This is done using a further mock service that is used to manage the
others, using python-dbusmock to simplify the handling.

Add basic tests for the orientation manager.

As per the usage dbusmock, we're now launching all the tests under such
wrapper, so that local dbus environment won't ever considered, and
there's no risk that it may affect the tests results both locally and in
CI.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1233>
This commit is contained in:
Marco Trevisan (Treviño)
2020-05-04 19:22:35 +02:00
committed by Jonas Ådahl
parent 58fb865a7c
commit bf54a16f92
14 changed files with 912 additions and 3 deletions

View File

@ -24,6 +24,8 @@
#include <glib-object.h>
#include "core/util-private.h"
typedef enum
{
META_ORIENTATION_UNDEFINED,
@ -35,11 +37,15 @@ typedef enum
#define META_N_ORIENTATIONS (META_ORIENTATION_RIGHT_UP + 1)
#define META_TYPE_ORIENTATION_MANAGER (meta_orientation_manager_get_type ())
META_EXPORT_TEST
G_DECLARE_FINAL_TYPE (MetaOrientationManager, meta_orientation_manager,
META, ORIENTATION_MANAGER, GObject)
META_EXPORT_TEST
MetaOrientation meta_orientation_manager_get_orientation (MetaOrientationManager *self);
META_EXPORT_TEST
gboolean meta_orientation_manager_has_accelerometer (MetaOrientationManager *self);
#endif /* META_ORIENTATION_MANAGER_H */