boxes: Move Rectangle.is_adjacent_to to Mtk

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
This commit is contained in:
Bilal Elmoussaoui
2024-01-06 19:40:18 +01:00
committed by Marge Bot
parent fcc8cfff11
commit 6f9e75b6f2
8 changed files with 62 additions and 63 deletions

View File

@ -200,36 +200,6 @@ meta_test_util_later_schedule_from_later (void)
g_assert_cmpint (data.state, ==, META_TEST_LATER_FINISHED);
}
static void
meta_test_adjacent_to (void)
{
MtkRectangle base = { .x = 10, .y = 10, .width = 10, .height = 10 };
MtkRectangle adjacent[] = {
{ .x = 20, .y = 10, .width = 10, .height = 10 },
{ .x = 0, .y = 10, .width = 10, .height = 10 },
{ .x = 0, .y = 1, .width = 10, .height = 10 },
{ .x = 20, .y = 19, .width = 10, .height = 10 },
{ .x = 10, .y = 20, .width = 10, .height = 10 },
{ .x = 10, .y = 0, .width = 10, .height = 10 },
};
MtkRectangle not_adjacent[] = {
{ .x = 0, .y = 0, .width = 10, .height = 10 },
{ .x = 20, .y = 20, .width = 10, .height = 10 },
{ .x = 21, .y = 10, .width = 10, .height = 10 },
{ .x = 10, .y = 21, .width = 10, .height = 10 },
{ .x = 10, .y = 5, .width = 10, .height = 10 },
{ .x = 11, .y = 10, .width = 10, .height = 10 },
{ .x = 19, .y = 10, .width = 10, .height = 10 },
};
unsigned int i;
for (i = 0; i < G_N_ELEMENTS (adjacent); i++)
g_assert (meta_rectangle_is_adjacent_to (&base, &adjacent[i]));
for (i = 0; i < G_N_ELEMENTS (not_adjacent); i++)
g_assert (!meta_rectangle_is_adjacent_to (&base, &not_adjacent[i]));
}
static void
init_tests (void)
{
@ -237,8 +207,6 @@ init_tests (void)
g_test_add_func ("/util/meta-later/schedule-from-later",
meta_test_util_later_schedule_from_later);
g_test_add_func ("/core/boxes/adjacent-to", meta_test_adjacent_to);
init_monitor_store_tests ();
init_monitor_config_migration_tests ();
init_boxes_tests ();