From c2c41bbf0a6c1d0210dee854217e140cb07fc134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 9 Jul 2021 12:38:44 +0200 Subject: [PATCH] tests/kms-utils: Add some basic 16:16 fixed tests Part-of: --- src/tests/kms-utils-unit-tests.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tests/kms-utils-unit-tests.c b/src/tests/kms-utils-unit-tests.c index ae5bb5c81..324166d68 100644 --- a/src/tests/kms-utils-unit-tests.c +++ b/src/tests/kms-utils-unit-tests.c @@ -21,6 +21,7 @@ #include #include "backends/native/meta-kms-utils.h" +#include "backends/native/meta-kms-update.h" typedef struct { drmModeModeInfo drm_mode; @@ -137,11 +138,22 @@ meta_test_kms_refresh_rate (void) } } +static void +meta_test_kms_update_fixed16 (void) +{ + g_assert_cmpint (meta_fixed_16_from_int (12345), ==, 809041920); + g_assert_cmpint (meta_fixed_16_to_int (809041920), ==, 12345); + g_assert_cmpint (meta_fixed_16_from_int (-12345), ==, -809041920); + g_assert_cmpint (meta_fixed_16_to_int (-809041920), ==, -12345); +} + static void init_kms_utils_tests (void) { g_test_add_func ("/backends/native/kms/refresh-rate", meta_test_kms_refresh_rate); + g_test_add_func ("/backends/native/kms/update/fixed16", + meta_test_kms_update_fixed16); } int