test: Add intersection tests

This commit is contained in:
Leo Li 2024-05-27 13:27:28 -04:00
parent ef868e4abe
commit 17a558d3e0
2 changed files with 31 additions and 0 deletions

View file

@ -63,6 +63,8 @@ tests = {
'change-alpha',
'set-alpha-from-opaque',
'set-alpha-from-transparent',
'change-position-same-intersection',
'change-position-different-intersection',
'unset-alpha-to-opaque',
'unset-alpha-to-transparent',
'change-in-fence-fd',

View file

@ -294,6 +294,33 @@ run_unset_alpha_to_transparent(struct context *ctx)
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == NULL);
}
static void
run_change_position_same_intersection(struct context *ctx)
{
first_commit(ctx);
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
liftoff_layer_set_property(ctx->other_layer, "CRTC_X", 1);
second_commit(ctx, true);
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
}
static void
run_change_position_different_intersection(struct context *ctx)
{
first_commit(ctx);
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
liftoff_layer_set_property(ctx->other_layer, "CRTC_X", 2000);
liftoff_layer_set_property(ctx->other_layer, "CRTC_Y", 2000);
second_commit(ctx, false);
assert(liftoff_mock_plane_get_layer(ctx->mock_plane) == ctx->layer);
}
static void
run_change_in_fence_fd(struct context *ctx)
{
@ -334,6 +361,8 @@ static const struct test_case tests[] = {
{ .name = "change-alpha", .run = run_change_alpha },
{ .name = "set-alpha-from-opaque", .run = run_set_alpha_from_opaque },
{ .name = "set-alpha-from-transparent", .run = run_set_alpha_from_transparent },
{ .name = "change-position-same-intersection", .run = run_change_position_same_intersection },
{ .name = "change-position-different-intersection", .run = run_change_position_different_intersection },
{ .name = "unset-alpha-to-opaque", .run = run_unset_alpha_to_opaque },
{ .name = "unset-alpha-to-transparent", .run = run_unset_alpha_to_transparent },
{ .name = "change-in-fence-fd", .run = run_change_in_fence_fd },