tests/kms-utils: Add some basic 16:16 fixed tests

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1927>
This commit is contained in:
Jonas Ådahl 2021-07-09 12:38:44 +02:00 committed by Marge Bot
parent 021a401bc8
commit c2c41bbf0a

View File

@ -21,6 +21,7 @@
#include <glib.h> #include <glib.h>
#include "backends/native/meta-kms-utils.h" #include "backends/native/meta-kms-utils.h"
#include "backends/native/meta-kms-update.h"
typedef struct { typedef struct {
drmModeModeInfo drm_mode; 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 static void
init_kms_utils_tests (void) init_kms_utils_tests (void)
{ {
g_test_add_func ("/backends/native/kms/refresh-rate", g_test_add_func ("/backends/native/kms/refresh-rate",
meta_test_kms_refresh_rate); meta_test_kms_refresh_rate);
g_test_add_func ("/backends/native/kms/update/fixed16",
meta_test_kms_update_fixed16);
} }
int int