mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
tests: Make it easier to keep track of where we are
The monitor orientation tests do a lot of things in sequence. Replace some of the comments with g_test_message() so that the log from a failed test gives us a better idea of how far we got. Signed-off-by: Simon McVittie <smcv@debian.org> Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2049>
This commit is contained in:
parent
27ce84962a
commit
838d5656c3
@ -2853,8 +2853,7 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
|
|||||||
check_monitor_configuration (&test_case.expect));
|
check_monitor_configuration (&test_case.expect));
|
||||||
check_monitor_test_clients_state ();
|
check_monitor_test_clients_state ();
|
||||||
|
|
||||||
/* External monitor connected */
|
g_test_message ("External monitor connected");
|
||||||
|
|
||||||
test_case.setup.n_outputs = 2;
|
test_case.setup.n_outputs = 2;
|
||||||
test_case.expect.n_outputs = 2;
|
test_case.expect.n_outputs = 2;
|
||||||
test_case.expect.n_monitors = 2;
|
test_case.expect.n_monitors = 2;
|
||||||
@ -2870,8 +2869,7 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
|
|||||||
check_monitor_configuration (&test_case.expect));
|
check_monitor_configuration (&test_case.expect));
|
||||||
check_monitor_test_clients_state ();
|
check_monitor_test_clients_state ();
|
||||||
|
|
||||||
/* Lid closed */
|
g_test_message ("Lid closed");
|
||||||
|
|
||||||
test_case.expect.monitors[0].current_mode = -1;
|
test_case.expect.monitors[0].current_mode = -1;
|
||||||
test_case.expect.logical_monitors[0].monitors[0] = 1,
|
test_case.expect.logical_monitors[0].monitors[0] = 1,
|
||||||
test_case.expect.n_logical_monitors = 1;
|
test_case.expect.n_logical_monitors = 1;
|
||||||
@ -2895,8 +2893,7 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
|
|||||||
* 4) Open lid
|
* 4) Open lid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Lid opened */
|
g_test_message ("Lid opened");
|
||||||
|
|
||||||
test_case.expect.monitors[0].current_mode = 0;
|
test_case.expect.monitors[0].current_mode = 0;
|
||||||
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
||||||
test_case.expect.logical_monitors[1].monitors[0] = 1,
|
test_case.expect.logical_monitors[1].monitors[0] = 1,
|
||||||
@ -2913,8 +2910,7 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
|
|||||||
check_monitor_configuration (&test_case.expect));
|
check_monitor_configuration (&test_case.expect));
|
||||||
check_monitor_test_clients_state ();
|
check_monitor_test_clients_state ();
|
||||||
|
|
||||||
/* External monitor disconnected */
|
g_test_message ("External monitor disconnected");
|
||||||
|
|
||||||
test_case.setup.n_outputs = 1;
|
test_case.setup.n_outputs = 1;
|
||||||
test_case.expect.n_outputs = 1;
|
test_case.expect.n_outputs = 1;
|
||||||
test_case.expect.n_monitors = 1;
|
test_case.expect.n_monitors = 1;
|
||||||
@ -2929,8 +2925,7 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
|
|||||||
check_monitor_configuration (&test_case.expect));
|
check_monitor_configuration (&test_case.expect));
|
||||||
check_monitor_test_clients_state ();
|
check_monitor_test_clients_state ();
|
||||||
|
|
||||||
/* Lid closed */
|
g_test_message ("Lid closed");
|
||||||
|
|
||||||
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
||||||
test_case.expect.n_logical_monitors = 1;
|
test_case.expect.n_logical_monitors = 1;
|
||||||
test_case.expect.screen_width = 1024;
|
test_case.expect.screen_width = 1024;
|
||||||
@ -2943,8 +2938,7 @@ meta_test_monitor_lid_closed_with_hotplugged_external (void)
|
|||||||
check_monitor_configuration (&test_case.expect));
|
check_monitor_configuration (&test_case.expect));
|
||||||
check_monitor_test_clients_state ();
|
check_monitor_test_clients_state ();
|
||||||
|
|
||||||
/* Lid opened */
|
g_test_message ("Lid opened");
|
||||||
|
|
||||||
test_setup = create_monitor_test_setup (&test_case.setup,
|
test_setup = create_monitor_test_setup (&test_case.setup,
|
||||||
MONITOR_TEST_FLAG_NO_STORED);
|
MONITOR_TEST_FLAG_NO_STORED);
|
||||||
meta_backend_test_set_is_lid_closed (META_BACKEND_TEST (backend), FALSE);
|
meta_backend_test_set_is_lid_closed (META_BACKEND_TEST (backend), FALSE);
|
||||||
@ -3556,6 +3550,7 @@ meta_sensors_proxy_reset (MetaSensorsProxyMock *proxy)
|
|||||||
MetaOrientationManager *orientation_manager =
|
MetaOrientationManager *orientation_manager =
|
||||||
meta_backend_get_orientation_manager (backend);
|
meta_backend_get_orientation_manager (backend);
|
||||||
|
|
||||||
|
g_test_message ("Resetting proxy");
|
||||||
meta_sensors_proxy_mock_set_orientation (proxy,
|
meta_sensors_proxy_mock_set_orientation (proxy,
|
||||||
META_ORIENTATION_NORMAL);
|
META_ORIENTATION_NORMAL);
|
||||||
wait_for_orientation (orientation_manager, META_ORIENTATION_NORMAL, NULL);
|
wait_for_orientation (orientation_manager, META_ORIENTATION_NORMAL, NULL);
|
||||||
@ -3878,6 +3873,7 @@ meta_test_monitor_orientation_initial_rotated (void)
|
|||||||
MetaOrientation orientation;
|
MetaOrientation orientation;
|
||||||
unsigned int times_signalled = 0;
|
unsigned int times_signalled = 0;
|
||||||
|
|
||||||
|
g_test_message ("%s", G_STRFUNC);
|
||||||
orientation_mock = meta_sensors_proxy_mock_get ();
|
orientation_mock = meta_sensors_proxy_mock_get ();
|
||||||
touch_device = meta_test_add_touch_device (backend);
|
touch_device = meta_test_add_touch_device (backend);
|
||||||
orientation = META_ORIENTATION_LEFT_UP;
|
orientation = META_ORIENTATION_LEFT_UP;
|
||||||
@ -3984,6 +3980,7 @@ meta_test_monitor_orientation_initial_rotated_no_touch_mode (void)
|
|||||||
MetaOrientation orientation;
|
MetaOrientation orientation;
|
||||||
unsigned int times_signalled = 0;
|
unsigned int times_signalled = 0;
|
||||||
|
|
||||||
|
g_test_message ("%s", G_STRFUNC);
|
||||||
orientation_mock = meta_sensors_proxy_mock_get ();
|
orientation_mock = meta_sensors_proxy_mock_get ();
|
||||||
orientation = META_ORIENTATION_LEFT_UP;
|
orientation = META_ORIENTATION_LEFT_UP;
|
||||||
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
||||||
@ -4098,6 +4095,7 @@ meta_test_monitor_orientation_initial_stored_rotated (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_test_message ("%s", G_STRFUNC);
|
||||||
orientation_mock = meta_sensors_proxy_mock_get ();
|
orientation_mock = meta_sensors_proxy_mock_get ();
|
||||||
touch_device = meta_test_add_touch_device (backend);
|
touch_device = meta_test_add_touch_device (backend);
|
||||||
orientation = META_ORIENTATION_RIGHT_UP;
|
orientation = META_ORIENTATION_RIGHT_UP;
|
||||||
@ -4115,6 +4113,7 @@ meta_test_monitor_orientation_initial_stored_rotated (void)
|
|||||||
check_monitor_configuration_per_orientation (
|
check_monitor_configuration_per_orientation (
|
||||||
&test_case.expect, 0, orientation, 960, 540));
|
&test_case.expect, 0, orientation, 960, 540));
|
||||||
|
|
||||||
|
g_test_message ("Closing lid");
|
||||||
meta_backend_test_set_is_lid_closed (META_BACKEND_TEST (backend), TRUE);
|
meta_backend_test_set_is_lid_closed (META_BACKEND_TEST (backend), TRUE);
|
||||||
meta_monitor_manager_lid_is_closed_changed (monitor_manager);
|
meta_monitor_manager_lid_is_closed_changed (monitor_manager);
|
||||||
|
|
||||||
@ -4123,6 +4122,7 @@ meta_test_monitor_orientation_initial_stored_rotated (void)
|
|||||||
check_monitor_configuration_per_orientation (
|
check_monitor_configuration_per_orientation (
|
||||||
&test_case.expect, 0, orientation, 960, 540));
|
&test_case.expect, 0, orientation, 960, 540));
|
||||||
|
|
||||||
|
g_test_message ("Rotating to left-up");
|
||||||
orientation = META_ORIENTATION_LEFT_UP;
|
orientation = META_ORIENTATION_LEFT_UP;
|
||||||
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
||||||
wait_for_orientation (orientation_manager, orientation, ×_signalled);
|
wait_for_orientation (orientation_manager, orientation, ×_signalled);
|
||||||
@ -4137,8 +4137,10 @@ meta_test_monitor_orientation_initial_stored_rotated (void)
|
|||||||
&test_case.expect, 0, orientation, 960, 540));
|
&test_case.expect, 0, orientation, 960, 540));
|
||||||
|
|
||||||
/* When no touch device is available, the orientation change is ignored */
|
/* When no touch device is available, the orientation change is ignored */
|
||||||
|
g_test_message ("Removing touch device");
|
||||||
meta_backend_test_remove_device (META_BACKEND_TEST (backend), touch_device);
|
meta_backend_test_remove_device (META_BACKEND_TEST (backend), touch_device);
|
||||||
|
|
||||||
|
g_test_message ("Rotating to right-up");
|
||||||
orientation = META_ORIENTATION_RIGHT_UP;
|
orientation = META_ORIENTATION_RIGHT_UP;
|
||||||
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
||||||
wait_for_orientation (orientation_manager, orientation, ×_signalled);
|
wait_for_orientation (orientation_manager, orientation, ×_signalled);
|
||||||
@ -4248,6 +4250,7 @@ meta_test_monitor_orientation_initial_stored_rotated_no_touch (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_test_message ("%s", G_STRFUNC);
|
||||||
orientation_mock = meta_sensors_proxy_mock_get ();
|
orientation_mock = meta_sensors_proxy_mock_get ();
|
||||||
orientation = META_ORIENTATION_RIGHT_UP;
|
orientation = META_ORIENTATION_RIGHT_UP;
|
||||||
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
meta_sensors_proxy_mock_set_orientation (orientation_mock, orientation);
|
||||||
@ -4265,6 +4268,7 @@ meta_test_monitor_orientation_initial_stored_rotated_no_touch (void)
|
|||||||
&test_case.expect, 0, META_ORIENTATION_NORMAL,
|
&test_case.expect, 0, META_ORIENTATION_NORMAL,
|
||||||
960, 540));
|
960, 540));
|
||||||
|
|
||||||
|
g_test_message ("Closing lid");
|
||||||
meta_backend_test_set_is_lid_closed (META_BACKEND_TEST (backend), TRUE);
|
meta_backend_test_set_is_lid_closed (META_BACKEND_TEST (backend), TRUE);
|
||||||
meta_monitor_manager_lid_is_closed_changed (monitor_manager);
|
meta_monitor_manager_lid_is_closed_changed (monitor_manager);
|
||||||
|
|
||||||
@ -4371,6 +4375,7 @@ meta_test_monitor_orientation_changes (void)
|
|||||||
MetaOrientation i;
|
MetaOrientation i;
|
||||||
unsigned int times_signalled = 0;
|
unsigned int times_signalled = 0;
|
||||||
|
|
||||||
|
g_test_message ("%s", G_STRFUNC);
|
||||||
orientation_mock = meta_sensors_proxy_mock_get ();
|
orientation_mock = meta_sensors_proxy_mock_get ();
|
||||||
touch_device = meta_test_add_touch_device (backend);
|
touch_device = meta_test_add_touch_device (backend);
|
||||||
test_setup = create_monitor_test_setup (&test_case.setup,
|
test_setup = create_monitor_test_setup (&test_case.setup,
|
||||||
@ -4432,6 +4437,7 @@ meta_test_monitor_orientation_changes (void)
|
|||||||
initial_config);
|
initial_config);
|
||||||
|
|
||||||
/* When no touch device is available, the orientation changes are ignored */
|
/* When no touch device is available, the orientation changes are ignored */
|
||||||
|
g_test_message ("Removing touch device");
|
||||||
meta_backend_test_remove_device (META_BACKEND_TEST (backend), touch_device);
|
meta_backend_test_remove_device (META_BACKEND_TEST (backend), touch_device);
|
||||||
|
|
||||||
for (i = META_N_ORIENTATIONS - 1; i > META_ORIENTATION_UNDEFINED; i--)
|
for (i = META_N_ORIENTATIONS - 1; i > META_ORIENTATION_UNDEFINED; i--)
|
||||||
@ -4594,6 +4600,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
MetaOrientation i;
|
MetaOrientation i;
|
||||||
unsigned int times_signalled = 0;
|
unsigned int times_signalled = 0;
|
||||||
|
|
||||||
|
g_test_message ("%s", G_STRFUNC);
|
||||||
orientation_mock = meta_sensors_proxy_mock_get ();
|
orientation_mock = meta_sensors_proxy_mock_get ();
|
||||||
touch_device = meta_test_add_touch_device (backend);
|
touch_device = meta_test_add_touch_device (backend);
|
||||||
|
|
||||||
@ -4631,7 +4638,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
g_assert_cmpuint (times_signalled, <=, 1);
|
g_assert_cmpuint (times_signalled, <=, 1);
|
||||||
check_monitor_configuration (&test_case.expect);
|
check_monitor_configuration (&test_case.expect);
|
||||||
|
|
||||||
/* External monitor connected */
|
g_test_message ("External monitor connected");
|
||||||
test_case.setup.n_outputs = 2;
|
test_case.setup.n_outputs = 2;
|
||||||
test_case.expect.n_outputs = 2;
|
test_case.expect.n_outputs = 2;
|
||||||
test_case.expect.n_monitors = 2;
|
test_case.expect.n_monitors = 2;
|
||||||
@ -4664,7 +4671,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
g_assert_cmpuint (times_signalled, <=, 1);
|
g_assert_cmpuint (times_signalled, <=, 1);
|
||||||
check_monitor_configuration (&test_case.expect);
|
check_monitor_configuration (&test_case.expect);
|
||||||
|
|
||||||
/* Lid closed */
|
g_test_message ("Lid closed");
|
||||||
test_case.expect.monitors[0].current_mode = -1;
|
test_case.expect.monitors[0].current_mode = -1;
|
||||||
test_case.expect.logical_monitors[0].monitors[0] = 1,
|
test_case.expect.logical_monitors[0].monitors[0] = 1,
|
||||||
test_case.expect.n_logical_monitors = 1;
|
test_case.expect.n_logical_monitors = 1;
|
||||||
@ -4701,7 +4708,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
* 2) Disconnect external monitor
|
* 2) Disconnect external monitor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Lid opened */
|
g_test_message ("Lid opened");
|
||||||
test_case.expect.monitors[0].current_mode = 0;
|
test_case.expect.monitors[0].current_mode = 0;
|
||||||
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
||||||
test_case.expect.logical_monitors[1].monitors[0] = 1,
|
test_case.expect.logical_monitors[1].monitors[0] = 1,
|
||||||
@ -4718,7 +4725,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
|
|
||||||
for (i = META_N_ORIENTATIONS - 1; i > META_ORIENTATION_UNDEFINED; i--)
|
for (i = META_N_ORIENTATIONS - 1; i > META_ORIENTATION_UNDEFINED; i--)
|
||||||
{
|
{
|
||||||
/* Closing lid */
|
g_test_message ("Closing lid");
|
||||||
test_case.expect.monitors[0].current_mode = -1;
|
test_case.expect.monitors[0].current_mode = -1;
|
||||||
test_case.expect.logical_monitors[0].monitors[0] = 1,
|
test_case.expect.logical_monitors[0].monitors[0] = 1,
|
||||||
test_case.expect.n_logical_monitors = 1;
|
test_case.expect.n_logical_monitors = 1;
|
||||||
@ -4737,7 +4744,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
g_assert_cmpuint (times_signalled, <=, 1);
|
g_assert_cmpuint (times_signalled, <=, 1);
|
||||||
check_monitor_configuration (&test_case.expect);
|
check_monitor_configuration (&test_case.expect);
|
||||||
|
|
||||||
/* Open the lid */
|
g_test_message ("Opening lid");
|
||||||
test_case.expect.monitors[0].current_mode = 0;
|
test_case.expect.monitors[0].current_mode = 0;
|
||||||
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
test_case.expect.logical_monitors[0].monitors[0] = 0,
|
||||||
test_case.expect.logical_monitors[1].monitors[0] = 1,
|
test_case.expect.logical_monitors[1].monitors[0] = 1,
|
||||||
@ -4760,7 +4767,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
check_monitor_configuration_per_orientation (
|
check_monitor_configuration_per_orientation (
|
||||||
&test_case.expect, 0, i, 1024, 768));
|
&test_case.expect, 0, i, 1024, 768));
|
||||||
|
|
||||||
/* External monitor disconnected */
|
g_test_message ("External monitor disconnected");
|
||||||
test_case.setup.n_outputs = 1;
|
test_case.setup.n_outputs = 1;
|
||||||
test_case.expect.n_outputs = 1;
|
test_case.expect.n_outputs = 1;
|
||||||
test_case.expect.n_monitors = 1;
|
test_case.expect.n_monitors = 1;
|
||||||
@ -4774,7 +4781,7 @@ meta_test_monitor_orientation_changes_with_hotplugging (void)
|
|||||||
check_monitor_configuration_per_orientation (
|
check_monitor_configuration_per_orientation (
|
||||||
&test_case.expect, 0, i, 1024, 768));
|
&test_case.expect, 0, i, 1024, 768));
|
||||||
|
|
||||||
/* External monitor connected */
|
g_test_message ("External monitor connected");
|
||||||
test_case.setup.n_outputs = 2;
|
test_case.setup.n_outputs = 2;
|
||||||
test_case.expect.n_outputs = 2;
|
test_case.expect.n_outputs = 2;
|
||||||
test_case.expect.n_monitors = 2;
|
test_case.expect.n_monitors = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user