diff options
author | Florian Müllner <fmuellner@gnome.org> | 2021-07-19 00:01:24 +0200 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2021-07-19 00:03:33 +0200 |
commit | 952865a86ebb08f97263cfdbfe38b7adc20e4560 (patch) | |
tree | 1f9347628656210b03ceee4fae83beb21491d1eb /src/tests/clutter/interactive/test-path-constraint.c | |
parent | 7862f143937e43dca0513af3a24dabfb4d0db4fc (diff) | |
download | mutter-master.tar.gz |
Replace contents with redirect messagemaster
The default development branch is now `main`. This commit only exists
on `master` to point people towards that.
See https://gitlab.gnome.org/GNOME/glib/-/issues/2348 for details.
Diffstat (limited to 'src/tests/clutter/interactive/test-path-constraint.c')
-rw-r--r-- | src/tests/clutter/interactive/test-path-constraint.c | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/src/tests/clutter/interactive/test-path-constraint.c b/src/tests/clutter/interactive/test-path-constraint.c deleted file mode 100644 index baa1ea790..000000000 --- a/src/tests/clutter/interactive/test-path-constraint.c +++ /dev/null @@ -1,138 +0,0 @@ -#include <stdlib.h> -#include <gmodule.h> -#include <clutter/clutter.h> - -#include "tests/clutter-test-utils.h" - -#define PATH_DESCRIPTION \ - "M 0, 0 " \ - "L 0, 300 " \ - "L 300, 300 " \ - "L 300, 0 " \ - "L 0, 0" - -static gboolean toggled = FALSE; - -int -test_path_constraint_main (int argc, - char *argv[]); - -static gboolean -on_button_press (ClutterActor *actor, - const ClutterEvent *event, - gpointer dummy G_GNUC_UNUSED) -{ - if (!toggled) - clutter_actor_animate (actor, CLUTTER_EASE_OUT_CUBIC, 500, - "@constraints.path.offset", 1.0, - NULL); - else - clutter_actor_animate (actor, CLUTTER_EASE_OUT_CUBIC, 500, - "@constraints.path.offset", 0.0, - NULL); - - toggled = !toggled; - - return TRUE; -} - -static gchar * -node_to_string (const ClutterPathNode *node) -{ - GString *buffer = g_string_sized_new (256); - gsize len = 0, i; - - switch (node->type) - { - case CLUTTER_PATH_MOVE_TO: - g_string_append (buffer, "move-to "); - len = 1; - break; - - case CLUTTER_PATH_LINE_TO: - g_string_append (buffer, "line-to "); - len = 1; - break; - - case CLUTTER_PATH_CURVE_TO: - g_string_append (buffer, "curve-to "); - len = 3; - break; - - case CLUTTER_PATH_CLOSE: - g_string_append (buffer, "close"); - len = 0; - break; - - default: - break; - } - - for (i = 0; i < len; i++) - { - if (i == 0) - g_string_append (buffer, "[ "); - - g_string_append_printf (buffer, "[ %d, %d ]", - node->points[i].x, - node->points[i].y); - - if (i == len - 1) - g_string_append (buffer, " ]"); - } - - return g_string_free (buffer, FALSE); -} - -static void -on_node_reached (ClutterPathConstraint *constraint, - ClutterActor *actor, - guint index_) -{ - ClutterPath *path = clutter_path_constraint_get_path (constraint); - ClutterPathNode node; - gchar *str; - - clutter_path_get_node (path, index_, &node); - - str = node_to_string (&node); - g_print ("Node %d reached: %s\n", index_, str); - g_free (str); -} - -G_MODULE_EXPORT int -test_path_constraint_main (int argc, - char *argv[]) -{ - ClutterActor *stage, *rect; - ClutterPath *path; - ClutterColor rect_color = { 0xcc, 0x00, 0x00, 0xff }; - - clutter_test_init (&argc, &argv); - - stage = clutter_test_get_stage (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Path Constraint"); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_test_quit), NULL); - - path = clutter_path_new (); - clutter_path_set_description (path, PATH_DESCRIPTION); - - rect = clutter_actor_new (); - clutter_actor_set_background_color (rect, &rect_color); - clutter_actor_set_size (rect, 128, 128); - clutter_actor_set_reactive (rect, TRUE); - clutter_actor_add_constraint_with_name (rect, "path", clutter_path_constraint_new (path, 0.0)); - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); - - g_signal_connect (rect, "button-press-event", G_CALLBACK (on_button_press), NULL); - g_signal_connect (clutter_actor_get_constraint (rect, "path"), - "node-reached", - G_CALLBACK (on_node_reached), - NULL); - - clutter_actor_show (stage); - - clutter_test_main (); - - return EXIT_SUCCESS; -} |