[gegl-gtk] tests: Test processing of the GeglNode against ViewHelper, not the widget



commit c36634c1a83da8a0ed6141c503c7a8b83fe35970
Author: Jon Nordby <jononor gmail com>
Date:   Mon Jun 18 23:17:04 2012 +0200

    tests: Test processing of the GeglNode against ViewHelper, not the widget
    
    All the logic is in ViewHelper, so no reason to pretend this tests
    the widget parts of GeglGtkView.

 tests/test-view-helper.c |   40 ++++++++++++++++++++++++++++++++++++++++
 tests/test-view.c        |   43 -------------------------------------------
 2 files changed, 40 insertions(+), 43 deletions(-)
---
diff --git a/tests/test-view-helper.c b/tests/test-view-helper.c
index 29ab377..ad7b3ac 100644
--- a/tests/test-view-helper.c
+++ b/tests/test-view-helper.c
@@ -66,6 +66,45 @@ teardown_helper_test(ViewHelperTest *test)
 }
 
 
+static void
+computed_event(GeglNode      *node,
+               GeglRectangle *rect,
+               gpointer       data)
+{
+    gboolean *got_computed = (gboolean *)data;
+    *got_computed = TRUE;
+}
+
+/* Test that the GeglNode is processed when invalidated. */
+static void
+test_processing(void)
+{
+    ViewHelperTest test;
+    gboolean got_computed_event = FALSE;
+    GeglRectangle invalidated_rect = {0, 0, 128, 128};
+
+    setup_helper_test(&test);
+    /* Setup will invalidate the node, make sure those events are processed. */
+    while (gtk_events_pending()) {
+        gtk_main_iteration();
+    }
+    gegl_node_process(test.out);
+
+    g_signal_connect(test.out, "computed",
+                     G_CALLBACK(computed_event),
+                     &got_computed_event);
+
+    g_signal_emit_by_name(test.out, "invalidated", &invalidated_rect, NULL);
+
+    g_timeout_add(300, test_utils_quit_gtk_main, NULL);
+    gtk_main();
+
+    /* FIXME: test that the computed events span the invalidated area */
+    g_assert(got_computed_event);
+
+    teardown_helper_test(&test);
+}
+
 typedef struct {
     gboolean needs_redraw_called;
     GeglRectangle *expected_result;
@@ -132,6 +171,7 @@ main(int argc, char **argv)
     gegl_init(&argc, &argv);
     g_test_init(&argc, &argv, NULL);
 
+    g_test_add_func("/widgets/view/helper/processing", test_processing);
     g_test_add_func("/widgets/view/helper/redraw-on-computed", test_redraw_on_computed);
 
     retval = g_test_run();
diff --git a/tests/test-view.c b/tests/test-view.c
index d3cad19..60dd975 100644
--- a/tests/test-view.c
+++ b/tests/test-view.c
@@ -83,48 +83,6 @@ test_sanity(void)
     teardown_widget_test(&test);
 }
 
-
-static void
-computed_event(GeglNode      *node,
-               GeglRectangle *rect,
-               gpointer       data)
-{
-    gboolean *got_computed = (gboolean *)data;
-    *got_computed = TRUE;
-}
-
-/* Test that the GeglNode is processed when invalidated. */
-static void
-test_processing(void)
-{
-    ViewWidgetTest test;
-    gboolean got_computed_event = FALSE;
-    GeglRectangle invalidated_rect = {0, 0, 128, 128};
-
-    setup_widget_test(&test);
-    /* Setup will invalidate the node, make sure those events are processed. */
-    while (gtk_events_pending()) {
-        gtk_main_iteration();
-    }
-    gegl_node_process(test.out);
-
-    g_signal_connect(test.out, "computed",
-                     G_CALLBACK(computed_event),
-                     &got_computed_event);
-
-    g_signal_emit_by_name(test.out, "invalidated", &invalidated_rect, NULL);
-
-    g_timeout_add(300, test_utils_quit_gtk_main, NULL);
-    gtk_main();
-
-    /* FIXME: test that the computed events span the invalidated area */
-    g_assert(got_computed_event);
-
-    teardown_widget_test(&test);
-}
-
-
-
 /* TODO:
  * - Test redraw with translation
  * - Test redraw with scaling
@@ -155,7 +113,6 @@ main(int argc, char **argv)
     g_test_init(&argc, &argv, NULL);
 
     g_test_add_func("/widgets/view/sanity", test_sanity);
-    g_test_add_func("/widgets/view/processing", test_processing);
 
     retval = g_test_run();
     gegl_exit();



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