[mutter] tests/color-management: Move some utility functions higher up



commit b29604c3f8d29b44644135239fd6570bd385781e
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Sep 3 15:48:11 2022 +0200

    tests/color-management: Move some utility functions higher up
    
    That means they'll be re-usable without having to declare them on top.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2611>

 src/tests/color-management-tests.c | 114 ++++++++++++++++++-------------------
 1 file changed, 57 insertions(+), 57 deletions(-)
---
diff --git a/src/tests/color-management-tests.c b/src/tests/color-management-tests.c
index e8c0480949..d1aaec69fc 100644
--- a/src/tests/color-management-tests.c
+++ b/src/tests/color-management-tests.c
@@ -148,6 +148,63 @@ get_colord_mock_proxy (void)
   return proxy;
 }
 
+static void
+wait_for_profile_assigned (MetaColorDevice *color_device,
+                           const char      *profile_id)
+{
+  while (TRUE)
+    {
+      MetaColorProfile *color_profile;
+
+      color_profile = meta_color_device_get_assigned_profile (color_device);
+      if (color_profile &&
+          g_strcmp0 (meta_color_profile_get_id (color_profile),
+                     profile_id) == 0)
+        break;
+
+      g_main_context_iteration (NULL, TRUE);
+    }
+}
+
+static void
+on_device_updated (MetaColorDevice *color_device,
+                   gboolean        *run)
+{
+  *run = FALSE;
+}
+
+static void
+wait_for_device_updated (MetaColorDevice *color_device)
+{
+  gulong handler_id;
+  gboolean run = TRUE;
+
+  handler_id = g_signal_connect (color_device, "updated",
+                                 G_CALLBACK (on_device_updated),
+                                 &run);
+  while (run)
+    g_main_context_iteration (NULL, TRUE);
+
+  g_signal_handler_disconnect (color_device, handler_id);
+}
+
+static void
+assert_gamma_array (uint16_t *expected,
+                    uint16_t *values,
+                    size_t    size)
+{
+  size_t i;
+
+  for (i = 0; i < size; i++)
+    {
+      if (expected[i] != values[i])
+        {
+          g_error ("Expected %hu at but got %hu at index %zu",
+                   expected[i], values[i], i);
+        }
+    }
+}
+
 static void
 set_colord_device_profiles (const char  *cd_device_id,
                             const char **cd_profile_ids,
@@ -682,63 +739,6 @@ meta_test_color_management_profile_efivar (void)
   unlink (efivar_path);
 }
 
-static void
-wait_for_profile_assigned (MetaColorDevice *color_device,
-                           const char      *profile_id)
-{
-  while (TRUE)
-    {
-      MetaColorProfile *color_profile;
-
-      color_profile = meta_color_device_get_assigned_profile (color_device);
-      if (color_profile &&
-          g_strcmp0 (meta_color_profile_get_id (color_profile),
-                     profile_id) == 0)
-        break;
-
-      g_main_context_iteration (NULL, TRUE);
-    }
-}
-
-static void
-on_device_updated (MetaColorDevice *color_device,
-                   gboolean        *run)
-{
-  *run = FALSE;
-}
-
-static void
-wait_for_device_updated (MetaColorDevice *color_device)
-{
-  gulong handler_id;
-  gboolean run = TRUE;
-
-  handler_id = g_signal_connect (color_device, "updated",
-                                 G_CALLBACK (on_device_updated),
-                                 &run);
-  while (run)
-    g_main_context_iteration (NULL, TRUE);
-
-  g_signal_handler_disconnect (color_device, handler_id);
-}
-
-static void
-assert_gamma_array (uint16_t *expected,
-                    uint16_t *values,
-                    size_t    size)
-{
-  size_t i;
-
-  for (i = 0; i < size; i++)
-    {
-      if (expected[i] != values[i])
-        {
-          g_error ("Expected %hu at but got %hu at index %zu",
-                   expected[i], values[i], i);
-        }
-    }
-}
-
 static void
 meta_test_color_management_night_light_calibrated (void)
 {


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