[mutter] tests/kms-utils: Add some basic 16:16 fixed tests



commit c2c41bbf0a6c1d0210dee854217e140cb07fc134
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Jul 9 12:38:44 2021 +0200

    tests/kms-utils: Add some basic 16:16 fixed tests
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1927>

 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 ae5bb5c818..324166d684 100644
--- a/src/tests/kms-utils-unit-tests.c
+++ b/src/tests/kms-utils-unit-tests.c
@@ -21,6 +21,7 @@
 #include <glib.h>
 
 #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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]