[gegl] tests, examples: replace use of dont-cache with cache-policy



commit e7035da486f21e3f7aca8e179383d0b555457220
Author: Ell <ell_se yahoo com>
Date:   Thu Feb 21 13:03:45 2019 -0500

    tests, examples: replace use of dont-cache with cache-policy
    
    In tests/ and examples/, replace the use of the deprecated
    GeglNode::dont-cache property with GeglNode::cache-policy.

 examples/sdl-draw.c                 |  2 +-
 examples/simple-graph.py            |  2 +-
 tests/simple/test-node-properties.c | 32 ++++++++++++++++----------------
 3 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/examples/sdl-draw.c b/examples/sdl-draw.c
index 2e306b9f0..0ff635192 100644
--- a/examples/sdl-draw.c
+++ b/examples/sdl-draw.c
@@ -84,7 +84,7 @@ init_main_context (SDL_Surface *main_window, MainContext *context)
   GeglColor  *color2 = gegl_color_new ("rgb(0.6, 0.6, 0.6)");
   GeglBuffer *paint_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, 0, 0), babl_format ("RGBA float"));
 
-  g_object_set (ptn, "dont-cache", TRUE, NULL);
+  g_object_set (ptn, "cache-policy", GEGL_CACHE_POLICY_NEVER, NULL);
 
   /* Our graph represents a single drawing layer over a fixed background */
   background_node = gegl_node_new_child (ptn,
diff --git a/examples/simple-graph.py b/examples/simple-graph.py
index 68d87c14b..3b155f878 100755
--- a/examples/simple-graph.py
+++ b/examples/simple-graph.py
@@ -9,7 +9,7 @@ if __name__ == '__main__':
   ptn = Gegl.Node()
   
   # Disable caching on all child nodes
-  ptn.set_property("dont-cache", True)
+  ptn.set_property("cache-policy", Gegl.CachePolicy.NEVER)
   
   # Create our background buffer. A gegl:color node would
   # make more sense, we just use a buffer here as an example.
diff --git a/tests/simple/test-node-properties.c b/tests/simple/test-node-properties.c
index 382b0bb2c..80760d2a5 100644
--- a/tests/simple/test-node-properties.c
+++ b/tests/simple/test-node-properties.c
@@ -26,14 +26,14 @@
 
 int main(int argc, char *argv[])
 {
-  int           result = SUCCESS;
-  GeglNode     *graph  = NULL;
-  GeglNode     *node   = NULL;
-  GeglColor    *color  = NULL;
-  double        x      = -5;
-  double        y      = -5;
-  char         *name   = NULL;
-  gboolean      cache  = TRUE;
+  int              result       = SUCCESS;
+  GeglNode        *graph        = NULL;
+  GeglNode        *node         = NULL;
+  GeglColor       *color        = NULL;
+  double           x            = -5;
+  double           y            = -5;
+  char            *name         = NULL;
+  GeglCachePolicy  cache_policy = GEGL_CACHE_POLICY_AUTO;
 
   /* Init */
   gegl_init (&argc, &argv);
@@ -146,39 +146,39 @@ int main(int argc, char *argv[])
   gegl_node_set (node,
                  "operation", "gegl:translate",
                  "name", "Brian",
-                 "dont-cache", FALSE,
+                 "cache-policy", GEGL_CACHE_POLICY_ALWAYS,
                  NULL);
   
   gegl_node_get (node,
                  "name", &name,
-                 "dont-cache", &cache,
+                 "cache-policy", &cache_policy,
                  NULL);
 
   if (!(!strcmp (name, "Brian") &&
-        cache == FALSE))
+        cache_policy == GEGL_CACHE_POLICY_ALWAYS))
     {
       result = FAILURE;
       printf ("name:  %s\n", name);
-      printf ("cache: %d\n", cache); 
+      printf ("cache-policy: %d\n", cache_policy); 
       goto abort;
     }
 
   gegl_node_set (node,
-                 "dont-cache", TRUE,
+                 "cache-policy", GEGL_CACHE_POLICY_NEVER,
                  "name", "Steve",
                  NULL);
 
   gegl_node_get (node,
                  "name", &name,
-                 "dont-cache", &cache,
+                 "cache-policy", &cache_policy,
                  NULL);
 
   if (!(!strcmp (name, "Steve") &&
-        cache == TRUE))
+        cache_policy == GEGL_CACHE_POLICY_NEVER))
     {
       result = FAILURE;
       printf ("name: %s\n", name);
-      printf ("cache: %d\n", cache);
+      printf ("cache-policy: %d\n", cache_policy);
       goto abort;
     }
 


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