Merge branch 'fix-gestures-test' into 'master'

Fix gestures test

See merge request GNOME/gtk!1406
This commit is contained in:
Matthias Clasen 2020-02-10 15:57:54 +00:00
commit b38eb6eab4

View File

@ -437,9 +437,9 @@ test_phases (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -493,9 +493,9 @@ test_mixed (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -550,9 +550,9 @@ test_early_exit (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -601,9 +601,9 @@ test_claim_capture (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -648,8 +648,8 @@ test_claim_target (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -695,8 +695,8 @@ test_claim_bubble (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_CLAIMED);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -749,8 +749,8 @@ test_early_claim_capture (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -806,8 +806,8 @@ test_late_claim_capture (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -867,10 +867,8 @@ test_group (void)
add_gesture (B, "b3", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (C, "c4", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (A, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -920,8 +918,8 @@ test_gestures_outside_grab (void)
add_gesture (B, "b2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (A, "a2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -977,8 +975,8 @@ test_gestures_inside_grab (void)
add_gesture (B, "b2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (A, "a2", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_NONE);
gtk_widget_get_allocation (A, &allocation);
point_update (&mouse_state, A, allocation.width / 2, allocation.height / 2);
gtk_widget_get_allocation (B, &allocation);
point_update (&mouse_state, A, allocation.x, allocation.y);
point_press (&mouse_state, A, 1);
g_assert_cmpstr (str->str, ==,
@ -996,8 +994,7 @@ test_gestures_inside_grab (void)
/* Update with the grab under effect */
g_string_erase (str, 0, str->len);
point_update (&mouse_state, A, (allocation.width / 2),
(allocation.height / 2));
point_update (&mouse_state, A, allocation.x, allocation.y);
g_assert_cmpstr (str->str, ==,
"b1 updated, "
"c1 updated, "
@ -1034,10 +1031,10 @@ test_multitouch_on_single (void)
add_gesture (A, "a1", GTK_PHASE_CAPTURE, str, GTK_EVENT_SEQUENCE_NONE);
add_gesture (B, "b1", GTK_PHASE_CAPTURE, str, GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (B, &allocation);
/* First touch down */
point_update (&touch_state[0], A, allocation.width / 2, allocation.height / 2);
point_update (&touch_state[0], A, allocation.x, allocation.y);
point_press (&touch_state[0], A, 1);
g_assert_cmpstr (str->str, ==,
@ -1047,8 +1044,7 @@ test_multitouch_on_single (void)
/* Second touch down */
g_string_erase (str, 0, str->len);
point_update (&touch_state[1], A, (allocation.width / 2),
(allocation.height / 2));
point_update (&touch_state[1], A, allocation.x, allocation.y);
point_press (&touch_state[1], A, 1);
g_assert_cmpstr (str->str, ==,
@ -1084,17 +1080,16 @@ test_multitouch_activation (void)
str = g_string_new ("");
add_mt_gesture (C, "c1", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (B, &allocation);
/* First touch down */
point_update (&touch_state[0], A, allocation.width / 2, allocation.height / 2);
point_update (&touch_state[0], A, allocation.x, allocation.y);
point_press (&touch_state[0], A, 1);
g_assert_cmpstr (str->str, ==, "");
/* Second touch down */
point_update (&touch_state[1], A, (allocation.width / 2),
(allocation.height / 2));
point_update (&touch_state[1], A, allocation.x, allocation.y);
point_press (&touch_state[1], A, 1);
g_assert_cmpstr (str->str, ==,
@ -1111,8 +1106,7 @@ test_multitouch_activation (void)
/* A third touch down triggering again action */
g_string_erase (str, 0, str->len);
point_update (&touch_state[2], A, (allocation.width / 2),
(allocation.height / 2));
point_update (&touch_state[2], A, allocation.x, allocation.y);
point_press (&touch_state[2], A, 1);
g_assert_cmpstr (str->str, ==,
@ -1163,10 +1157,10 @@ test_multitouch_interaction (void)
g = add_gesture (A, "a1", GTK_PHASE_CAPTURE, str, GTK_EVENT_SEQUENCE_CLAIMED);
add_mt_gesture (C, "c1", GTK_PHASE_BUBBLE, str, GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_get_allocation (A, &allocation);
gtk_widget_get_allocation (B, &allocation);
/* First touch down, a1 claims the sequence */
point_update (&touch_state[0], A, allocation.width / 2, allocation.height / 2);
point_update (&touch_state[0], A, allocation.x, allocation.y);
point_press (&touch_state[0], A, 1);
g_assert_cmpstr (str->str, ==,
@ -1175,8 +1169,7 @@ test_multitouch_interaction (void)
/* Second touch down, a1 denies and c1 takes over */
g_string_erase (str, 0, str->len);
point_update (&touch_state[1], A, (allocation.width / 2),
(allocation.height / 2));
point_update (&touch_state[1], A, allocation.x, allocation.y);
point_press (&touch_state[1], A, 1);
/* Denying sequences in touch-excess situation is a responsibility of the caller */
@ -1191,8 +1184,7 @@ test_multitouch_interaction (void)
/* Move first point, only c1 should update */
g_string_erase (str, 0, str->len);
point_update (&touch_state[0], A, (allocation.width / 2),
(allocation.height / 2));
point_update (&touch_state[0], A, allocation.x, allocation.y);
g_assert_cmpstr (str->str, ==,
"c1 updated");
@ -1206,8 +1198,7 @@ test_multitouch_interaction (void)
/* A third touch down triggering again action on c1 */
g_string_erase (str, 0, str->len);
point_update (&touch_state[2], A, (allocation.width / 2),
(allocation.height / 2));
point_update (&touch_state[2], A, allocation.x, allocation.y);
point_press (&touch_state[2], A, 1);
g_assert_cmpstr (str->str, ==,