mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
monitor-unit-tests: Add tests with dynamic orientation changes
Verify monitors disposition when we have rotation changes coming from MetaOrientationManager, using our mock dbus implementation. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1233>
This commit is contained in:
parent
d0a9dfefc8
commit
d5f397977e
@ -112,6 +112,7 @@ void meta_backend_destroy (MetaBackend *backend);
|
|||||||
|
|
||||||
void meta_backend_prepare_shutdown (MetaBackend *backend);
|
void meta_backend_prepare_shutdown (MetaBackend *backend);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
|
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);
|
||||||
|
|
||||||
ClutterSeat * meta_backend_get_default_seat (MetaBackend *bakcend);
|
ClutterSeat * meta_backend_get_default_seat (MetaBackend *bakcend);
|
||||||
@ -123,6 +124,7 @@ MetaIdleManager * meta_backend_get_idle_manager (MetaBackend *backend);
|
|||||||
|
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
|
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
|
||||||
|
META_EXPORT_TEST
|
||||||
MetaOrientationManager * meta_backend_get_orientation_manager (MetaBackend *backend);
|
MetaOrientationManager * meta_backend_get_orientation_manager (MetaBackend *backend);
|
||||||
MetaCursorTracker * meta_backend_get_cursor_tracker (MetaBackend *backend);
|
MetaCursorTracker * meta_backend_get_cursor_tracker (MetaBackend *backend);
|
||||||
MetaCursorRenderer * meta_backend_get_cursor_renderer_for_device (MetaBackend *backend,
|
MetaCursorRenderer * meta_backend_get_cursor_renderer_for_device (MetaBackend *backend,
|
||||||
|
@ -305,6 +305,7 @@ MetaLogicalMonitor *meta_monitor_manager_get_logical_monitor_neighbor (MetaMonit
|
|||||||
|
|
||||||
MetaMonitor * meta_monitor_manager_get_primary_monitor (MetaMonitorManager *manager);
|
MetaMonitor * meta_monitor_manager_get_primary_monitor (MetaMonitorManager *manager);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
MetaMonitor * meta_monitor_manager_get_laptop_panel (MetaMonitorManager *manager);
|
MetaMonitor * meta_monitor_manager_get_laptop_panel (MetaMonitorManager *manager);
|
||||||
|
|
||||||
MetaMonitor * meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager,
|
MetaMonitor * meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager,
|
||||||
|
@ -81,6 +81,100 @@ meta_backend_test_create_monitor_manager (MetaBackend *backend,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClutterInputDevice *
|
||||||
|
meta_backend_test_add_test_device (MetaBackendTest *backend_test,
|
||||||
|
const char *name,
|
||||||
|
ClutterInputDeviceType device_type,
|
||||||
|
int n_buttons)
|
||||||
|
{
|
||||||
|
g_autoptr (GList) devices = NULL;
|
||||||
|
MetaBackend *backend = META_BACKEND (backend_test);
|
||||||
|
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||||
|
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
|
||||||
|
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||||
|
ClutterInputDevice *device;
|
||||||
|
ClutterEvent *event;
|
||||||
|
const char *product_id;
|
||||||
|
bool has_cursor = TRUE;
|
||||||
|
|
||||||
|
switch (device_type)
|
||||||
|
{
|
||||||
|
case CLUTTER_POINTER_DEVICE:
|
||||||
|
product_id = "MetaTestPointer";
|
||||||
|
break;
|
||||||
|
case CLUTTER_KEYBOARD_DEVICE:
|
||||||
|
product_id = "MetaTestKeyboard";
|
||||||
|
has_cursor = FALSE;
|
||||||
|
break;
|
||||||
|
case CLUTTER_EXTENSION_DEVICE:
|
||||||
|
product_id = "MetaTestExtension";
|
||||||
|
has_cursor = FALSE;
|
||||||
|
break;
|
||||||
|
case CLUTTER_JOYSTICK_DEVICE:
|
||||||
|
product_id = "MetaTestJoystick";
|
||||||
|
break;
|
||||||
|
case CLUTTER_TABLET_DEVICE:
|
||||||
|
product_id = "MetaTestTablet";
|
||||||
|
break;
|
||||||
|
case CLUTTER_TOUCHPAD_DEVICE:
|
||||||
|
product_id = "MetaTestTouchpad";
|
||||||
|
break;
|
||||||
|
case CLUTTER_TOUCHSCREEN_DEVICE:
|
||||||
|
product_id = "MetaTestTouchscreen";
|
||||||
|
break;
|
||||||
|
case CLUTTER_PEN_DEVICE:
|
||||||
|
product_id = "MetaTestPen";
|
||||||
|
break;
|
||||||
|
case CLUTTER_ERASER_DEVICE:
|
||||||
|
product_id = "MetaTestEraser";
|
||||||
|
break;
|
||||||
|
case CLUTTER_CURSOR_DEVICE:
|
||||||
|
product_id = "MetaTestCursor";
|
||||||
|
break;
|
||||||
|
case CLUTTER_PAD_DEVICE:
|
||||||
|
product_id = "MetaTestPad";
|
||||||
|
has_cursor = FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
|
device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE,
|
||||||
|
"name", name,
|
||||||
|
"device-type", CLUTTER_TOUCHSCREEN_DEVICE,
|
||||||
|
"seat", seat,
|
||||||
|
"has-cursor", has_cursor,
|
||||||
|
"backend", clutter_backend,
|
||||||
|
"vendor-id", "MetaTest",
|
||||||
|
"product-id", product_id,
|
||||||
|
"n-buttons", n_buttons,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
event = clutter_event_new (CLUTTER_DEVICE_ADDED);
|
||||||
|
clutter_event_set_device (event, device);
|
||||||
|
clutter_event_set_stage (event, stage);
|
||||||
|
clutter_event_put (event);
|
||||||
|
clutter_event_free (event);
|
||||||
|
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_backend_test_remove_device (MetaBackendTest *backend_test,
|
||||||
|
ClutterInputDevice *device)
|
||||||
|
{
|
||||||
|
MetaBackend *backend = META_BACKEND (backend_test);
|
||||||
|
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||||
|
ClutterEvent *event;
|
||||||
|
|
||||||
|
event = clutter_event_new (CLUTTER_DEVICE_REMOVED);
|
||||||
|
clutter_event_set_device (event, device);
|
||||||
|
clutter_event_set_stage (event, stage);
|
||||||
|
clutter_event_put (event);
|
||||||
|
clutter_event_free (event);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_backend_test_class_init (MetaBackendTestClass *klass)
|
meta_backend_test_class_init (MetaBackendTestClass *klass)
|
||||||
{
|
{
|
||||||
|
@ -34,4 +34,15 @@ void meta_backend_test_set_is_lid_closed (MetaBackendTest *backend_test,
|
|||||||
META_EXPORT
|
META_EXPORT
|
||||||
MetaGpu * meta_backend_test_get_gpu (MetaBackendTest *backend_test);
|
MetaGpu * meta_backend_test_get_gpu (MetaBackendTest *backend_test);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
ClutterInputDevice * meta_backend_test_add_test_device (MetaBackendTest *backend,
|
||||||
|
const char *name,
|
||||||
|
ClutterInputDeviceType device_type,
|
||||||
|
int n_buttons);
|
||||||
|
|
||||||
|
META_EXPORT_TEST
|
||||||
|
void meta_backend_test_remove_device (MetaBackendTest *backend,
|
||||||
|
ClutterInputDevice *device);
|
||||||
|
|
||||||
|
|
||||||
#endif /* META_BACKEND_TEST_H */
|
#endif /* META_BACKEND_TEST_H */
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user