diff options
author | Arthur Grillo <arthurgrillo@riseup.net> | 2023-04-19 02:01:44 +0300 |
---|---|---|
committer | Maíra Canal <mairacanal@riseup.net> | 2023-04-24 22:33:24 +0300 |
commit | 881e2a9cc11fb53b1de10d951a11a69d23035bbf (patch) | |
tree | 4b8a2fe451b8b5f6551815990692fb65f1e53c7c /drivers/gpu | |
parent | 1f01f2247e3c4ed55c96afccd0072cd31793c604 (diff) | |
download | linux-881e2a9cc11fb53b1de10d951a11a69d23035bbf.tar.xz |
drm/tests: Add test cases for drm_rect_calc_vscale()
Insert parameterized test for the drm_rect_calc_vscale() to ensure
correctness and prevent future regressions. Besides the test for the
usual case, tests the exceptions.
It uses the same struct from drm_rect_calc_hscale().
Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230418230146.461129-4-arthurgrillo@riseup.net
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/tests/drm_rect_test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tests/drm_rect_test.c b/drivers/gpu/drm/tests/drm_rect_test.c index aae682ad9ee1..fd89e62ad2cb 100644 --- a/drivers/gpu/drm/tests/drm_rect_test.c +++ b/drivers/gpu/drm/tests/drm_rect_test.c @@ -414,6 +414,17 @@ static void drm_test_rect_calc_hscale(struct kunit *test) KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); } +static void drm_test_rect_calc_vscale(struct kunit *test) +{ + const struct drm_rect_scale_case *params = test->param_value; + int scaling_factor; + + scaling_factor = drm_rect_calc_vscale(¶ms->src, ¶ms->dst, + params->min_range, params->max_range); + + KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); +} + static struct kunit_case drm_rect_tests[] = { KUNIT_CASE(drm_test_rect_clip_scaled_div_by_zero), KUNIT_CASE(drm_test_rect_clip_scaled_not_clipped), @@ -421,6 +432,7 @@ static struct kunit_case drm_rect_tests[] = { KUNIT_CASE(drm_test_rect_clip_scaled_signed_vs_unsigned), KUNIT_CASE_PARAM(drm_test_rect_intersect, drm_rect_intersect_gen_params), KUNIT_CASE_PARAM(drm_test_rect_calc_hscale, drm_rect_scale_gen_params), + KUNIT_CASE_PARAM(drm_test_rect_calc_vscale, drm_rect_scale_gen_params), { } }; |