[gtk/wip/otte/lottie: 3/3] ottie: Add a snapshot test




commit 3c64a2c5b91166fb2ec4558044d5e2cdd83f1680
Author: Benjamin Otte <otte redhat com>
Date:   Sun Dec 20 00:18:14 2020 +0100

    ottie: Add a snapshot test

 testsuite/meson.build                              |   1 +
 testsuite/ottie/meson.build                        |  35 +++
 testsuite/ottie/snapshot.c                         | 181 +++++++++++++++
 .../snapshot/trim-0-to-100-shows-everything.0.node |  16 ++
 .../snapshot/trim-0-to-100-shows-everything.lottie | 222 ++++++++++++++++++
 .../trim-0-to-200-shows-everything-once.lottie     | 222 ++++++++++++++++++
 .../ottie/snapshot/trim-equal-is-empty.0.node      |   0
 .../ottie/snapshot/trim-equal-is-empty.lottie      | 247 +++++++++++++++++++++
 .../ottie/snapshot/trim-offset-rotates.0.node      |  18 ++
 .../ottie/snapshot/trim-offset-rotates.lottie      | 222 ++++++++++++++++++
 .../snapshot/trim-startend-does-minmax.0.node      |  16 ++
 .../snapshot/trim-startend-does-minmax.lottie      | 222 ++++++++++++++++++
 12 files changed, 1402 insertions(+)
---
diff --git a/testsuite/meson.build b/testsuite/meson.build
index 4ef7cced9a..0e1c57fae4 100644
--- a/testsuite/meson.build
+++ b/testsuite/meson.build
@@ -56,6 +56,7 @@ subdir('performance')
 subdir('gdk')
 subdir('gsk')
 subdir('gtk')
+subdir('ottie')
 subdir('css')
 subdir('a11y')
 subdir('tools')
diff --git a/testsuite/ottie/meson.build b/testsuite/ottie/meson.build
new file mode 100644
index 0000000000..f2065ec73b
--- /dev/null
+++ b/testsuite/ottie/meson.build
@@ -0,0 +1,35 @@
+testexecdir = join_paths(installed_test_bindir, 'gsk')
+testdatadir = join_paths(installed_test_datadir, 'gsk')
+
+snapshot = executable(
+  'snapshot',
+  ['snapshot.c'],
+  dependencies: libgtk_dep,
+  c_args: common_cflags,
+  install: get_option('install-tests'),
+  install_dir: testexecdir
+)
+
+snapshot_tests = [
+  [ 'trim-equal-is-empty', 0 ],
+  [ 'trim-0-to-100-shows-everything', 0 ],
+  [ 'trim-0-to-200-shows-everything-once', 0 ],
+  [ 'trim-startend-does-minmax', 0 ],
+  [ 'trim-offset-rotates', 0 ],
+]
+
+foreach test : snapshot_tests
+  test('snapshot-' + test[0], snapshot,
+    args: [
+      '--time=' + test[1].to_string(),
+      join_paths(meson.current_source_dir(), 'snapshot', test[0] + '.lottie'),
+      join_paths(meson.current_source_dir(), 'snapshot', test[0] + '.' + test[1].to_string() + '.node'),
+    ],
+    env: [
+      'GTK_A11Y=test',
+      'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
+      'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
+    ],
+    suite: [ 'ottie'],
+  )
+endforeach
diff --git a/testsuite/ottie/snapshot.c b/testsuite/ottie/snapshot.c
new file mode 100644
index 0000000000..e56c03213f
--- /dev/null
+++ b/testsuite/ottie/snapshot.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright © 2020 Benjamin Otte
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#include "config.h"
+
+#include <ottie/ottie.h>
+#include <gtk/gtk.h>
+
+static int
+usage (void)
+{
+  g_print ("Usage:\n"
+           "snapshot [OPTION…] TEST REFERENCE\n"
+           "  Compare a snapshot of TEST to the REFERENCE.\n"
+           "  --time=[timestamp]  Forward to [timestamp] seconds\n"
+           "\n");
+
+  return 1;
+}
+             
+static GBytes *
+diff_with_file (const char  *file1,
+                GBytes      *input,
+                GError     **error)
+{
+  GSubprocess *process;
+  GBytes *output;
+
+  process = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE
+                              | G_SUBPROCESS_FLAGS_STDOUT_PIPE,
+                              error,
+                              "diff", "-u", file1, "-", NULL);
+  if (process == NULL)
+    return NULL;
+
+  if (!g_subprocess_communicate (process,
+                                 input,
+                                 NULL,
+                                 &output,
+                                 NULL,
+                                 error))
+    {
+      g_object_unref (process);
+      return NULL;
+    }
+
+  if (!g_subprocess_get_successful (process) &&
+      /* this is the condition when the files differ */
+      !(g_subprocess_get_if_exited (process) && g_subprocess_get_exit_status (process) == 1))
+    {
+      g_clear_pointer (&output, g_bytes_unref);
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "The `diff' process exited with error status %d",
+                   g_subprocess_get_exit_status (process));
+    }
+
+  g_object_unref (process);
+
+  return output;
+}
+
+static gboolean
+test (const char *testfile,
+      const char *reffile,
+      gint64      timestamp)
+{
+  OttieCreation *ottie;
+  OttiePaintable *paintable;
+  GtkSnapshot *snapshot;
+  GskRenderNode *node;
+  GBytes *bytes, *diff;
+  GError *error = NULL;
+
+  ottie = ottie_creation_new_for_filename (testfile);
+  if (ottie == NULL)
+    {
+      g_printerr ("Someone figure out error handling for loading ottie files.\n");
+      return FALSE;
+    }
+  while (ottie_creation_is_loading (ottie))
+    g_main_context_iteration (NULL, TRUE);
+
+  paintable = ottie_paintable_new (ottie);
+  ottie_paintable_set_timestamp (paintable, round (timestamp * G_USEC_PER_SEC));
+
+  snapshot = gtk_snapshot_new ();
+  gdk_paintable_snapshot (GDK_PAINTABLE (paintable),
+                          snapshot,
+                          ottie_creation_get_width (ottie),
+                          ottie_creation_get_height (ottie));
+  node = gtk_snapshot_free_to_node (snapshot);
+  if (node != NULL)
+    {
+      bytes = gsk_render_node_serialize (node);
+      gsk_render_node_unref (node);
+    }
+  else
+    bytes = g_bytes_new_static ("", 0);
+
+  diff = diff_with_file (reffile, bytes, &error);
+
+  g_bytes_unref (bytes);
+  g_object_unref (paintable);
+
+  if (diff == NULL)
+    {
+      g_printerr ("Error diffing: %s\n", error->message);
+      g_clear_error (&error);
+      return FALSE;
+    }
+
+  if (diff && g_bytes_get_size (diff) > 0)
+    {
+      g_print ("Resulting file doesn't match reference:\n%s\n",
+               (const char *) g_bytes_get_data (diff, NULL));
+      g_bytes_unref (diff);
+      return FALSE;
+    }
+
+  g_bytes_unref (diff);
+  return TRUE;
+}
+
+int
+main (int argc, char **argv)
+{
+  guint timestamp = 0;
+  int result;
+
+  gtk_test_init (&argc, &argv);
+
+  argc--;
+  argv++;
+
+  while (TRUE)
+    {
+      if (argc == 0)
+        return usage();
+
+      if (strncmp (argv[0], "--time=", strlen ("--time=")) == 0)
+        {
+          timestamp = atof (argv[0] + strlen ("--time="));
+        }
+      else
+        break;
+
+      argc--;
+      argv++;
+    }
+  
+  if (argc % 2 != 0)
+    return usage ();
+
+  result = 0;
+  for (int i = 0; i < argc / 2; i++)
+    {
+      if (!test (argv[2 * i],
+                 argv[2 * i + 1],
+                 round (timestamp * G_USEC_PER_SEC)))
+        result++;
+    }
+
+  return result;
+}
+
diff --git a/testsuite/ottie/snapshot/trim-0-to-100-shows-everything.0.node 
b/testsuite/ottie/snapshot/trim-0-to-100-shows-everything.0.node
new file mode 100644
index 0000000000..a88e67ee39
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-0-to-100-shows-everything.0.node
@@ -0,0 +1,16 @@
+clip {
+  child: stroke {
+    child: color {
+      bounds: -30 0 160 100;
+      color: rgb(0,255,0);
+    }
+    path: "\
+M 20 50\
+C 40 50, 60 50, 80 50";
+    line-width: 10;
+    line-cap: square;
+    line-join: miter;
+    miter-limit: 10;
+  }
+  clip: 0 0 100 100;
+}
diff --git a/testsuite/ottie/snapshot/trim-0-to-100-shows-everything.lottie 
b/testsuite/ottie/snapshot/trim-0-to-100-shows-everything.lottie
new file mode 100644
index 0000000000..ecd4718832
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-0-to-100-shows-everything.lottie
@@ -0,0 +1,222 @@
+{
+  "v" : "5.1.8",
+  "fr" : 2,
+  "ip" : 0,
+  "op" : 60,
+  "w" : 100,
+  "h" : 100,
+  "nm" : "Spinner",
+  "ddd" : 0,
+  "assets" : [],
+  "layers" : [
+    {
+      "ddd" : 0,
+      "ind" : 1,
+      "ty" : 4,
+      "nm" : "spinner Outlines",
+      "sr" : 1,
+      "ks" : {
+        "o" : {
+          "a" : 0,
+          "k" : 100,
+          "ix" : 11
+        },
+        "r" : {
+          "a" : 0,
+          "k" : 0,
+          "ix" : 10
+        },
+        "p" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 2
+        },
+        "a" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 1
+        },
+        "s" : {
+          "a" : 0,
+          "k" : [
+            100,
+            100,
+            100
+          ],
+          "ix" : 6
+        }
+      },
+      "ao" : 0,
+      "shapes" : [
+        {
+          "ty" : "gr",
+          "it" : [
+            {
+              "ind" : 0,
+              "ty" : "sh",
+              "ix" : 1,
+              "ks" : {
+                "a" : 0,
+                "k" : {
+                  "i" : [
+                    [
+                      -20,
+                      0
+                    ],
+                    [
+                      -20,
+                      0
+                    ]
+                  ],
+                  "o" : [
+                    [
+                      20,
+                      0
+                    ],
+                    [
+                      20,
+                      0
+                    ]
+                  ],
+                  "v" : [
+                    [
+                      20,
+                      50
+                    ],
+                    [
+                      80,
+                      50
+                    ]
+                  ],
+                  "c" : false
+                },
+                "ix" : 2
+              },
+              "nm" : "Path 1",
+              "mn" : "ADBE Vector Shape - Group",
+              "hd" : false
+            },
+            {
+              "ty" : "tm",
+              "s" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 1
+              },
+              "e" : {
+                "a" : 0,
+                "k": 100,
+                "ix" : 2
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 3
+              },
+              "m" : 1,
+              "ix" : 2,
+              "nm" : "Trim Paths 1",
+              "mn" : "ADBE Vector Filter - Trim",
+              "hd" : false
+            },
+            {
+              "ty" : "st",
+              "c" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  1,
+                  0
+                ],
+                "ix" : 3
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 4
+              },
+              "w" : {
+                "a" : 0,
+                "k" : 10,
+                "ix" : 5
+              },
+              "lc" : 3,
+              "lj" : 1,
+              "ml" : 10,
+              "nm" : "Stroke 1",
+              "mn" : "ADBE Vector Graphic - Stroke",
+              "hd" : false
+            },
+            {
+              "ty" : "tr",
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 2
+              },
+              "a" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 1
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                  100,
+                  100
+                ],
+                "ix" : 3
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 6
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 7
+              },
+              "sk" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 4
+              },
+              "sa" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 5
+              },
+              "nm" : "Transform"
+            }
+          ],
+          "nm" : "Group 1",
+          "np" : 3,
+          "cix" : 2,
+          "ix" : 1,
+          "mn" : "ADBE Vector Group",
+          "hd" : false
+        }
+      ],
+      "ip" : 0,
+      "op" : 60.0000024438501,
+      "st" : 0,
+      "bm" : 0
+    }
+  ],
+  "markers" : []
+}
diff --git a/testsuite/ottie/snapshot/trim-0-to-200-shows-everything-once.lottie 
b/testsuite/ottie/snapshot/trim-0-to-200-shows-everything-once.lottie
new file mode 100644
index 0000000000..506b5778e2
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-0-to-200-shows-everything-once.lottie
@@ -0,0 +1,222 @@
+{
+  "v" : "5.1.8",
+  "fr" : 2,
+  "ip" : 0,
+  "op" : 60,
+  "w" : 100,
+  "h" : 100,
+  "nm" : "Spinner",
+  "ddd" : 0,
+  "assets" : [],
+  "layers" : [
+    {
+      "ddd" : 0,
+      "ind" : 1,
+      "ty" : 4,
+      "nm" : "spinner Outlines",
+      "sr" : 1,
+      "ks" : {
+        "o" : {
+          "a" : 0,
+          "k" : 100,
+          "ix" : 11
+        },
+        "r" : {
+          "a" : 0,
+          "k" : 0,
+          "ix" : 10
+        },
+        "p" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 2
+        },
+        "a" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 1
+        },
+        "s" : {
+          "a" : 0,
+          "k" : [
+            100,
+            100,
+            100
+          ],
+          "ix" : 6
+        }
+      },
+      "ao" : 0,
+      "shapes" : [
+        {
+          "ty" : "gr",
+          "it" : [
+            {
+              "ind" : 0,
+              "ty" : "sh",
+              "ix" : 1,
+              "ks" : {
+                "a" : 0,
+                "k" : {
+                  "i" : [
+                    [
+                      -20,
+                      0
+                    ],
+                    [
+                      -20,
+                      0
+                    ]
+                  ],
+                  "o" : [
+                    [
+                      20,
+                      0
+                    ],
+                    [
+                      20,
+                      0
+                    ]
+                  ],
+                  "v" : [
+                    [
+                      20,
+                      50
+                    ],
+                    [
+                      80,
+                      50
+                    ]
+                  ],
+                  "c" : false
+                },
+                "ix" : 2
+              },
+              "nm" : "Path 1",
+              "mn" : "ADBE Vector Shape - Group",
+              "hd" : false
+            },
+            {
+              "ty" : "tm",
+              "s" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 1
+              },
+              "e" : {
+                "a" : 0,
+                "k": 100,
+                "ix" : 2
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 3
+              },
+              "m" : 1,
+              "ix" : 2,
+              "nm" : "Trim Paths 1",
+              "mn" : "ADBE Vector Filter - Trim",
+              "hd" : false
+            },
+            {
+              "ty" : "st",
+              "c" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  1,
+                  0
+                ],
+                "ix" : 3
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 40,
+                "ix" : 4
+              },
+              "w" : {
+                "a" : 0,
+                "k" : 10,
+                "ix" : 5
+              },
+              "lc" : 3,
+              "lj" : 1,
+              "ml" : 10,
+              "nm" : "Stroke 1",
+              "mn" : "ADBE Vector Graphic - Stroke",
+              "hd" : false
+            },
+            {
+              "ty" : "tr",
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 2
+              },
+              "a" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 1
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                  100,
+                  100
+                ],
+                "ix" : 3
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 6
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 7
+              },
+              "sk" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 4
+              },
+              "sa" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 5
+              },
+              "nm" : "Transform"
+            }
+          ],
+          "nm" : "Group 1",
+          "np" : 3,
+          "cix" : 2,
+          "ix" : 1,
+          "mn" : "ADBE Vector Group",
+          "hd" : false
+        }
+      ],
+      "ip" : 0,
+      "op" : 60.0000024438501,
+      "st" : 0,
+      "bm" : 0
+    }
+  ],
+  "markers" : []
+}
diff --git a/testsuite/ottie/snapshot/trim-equal-is-empty.0.node 
b/testsuite/ottie/snapshot/trim-equal-is-empty.0.node
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/testsuite/ottie/snapshot/trim-equal-is-empty.lottie 
b/testsuite/ottie/snapshot/trim-equal-is-empty.lottie
new file mode 100644
index 0000000000..c4cb56c80a
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-equal-is-empty.lottie
@@ -0,0 +1,247 @@
+{
+  "v" : "5.1.8",
+  "fr" : 2,
+  "ip" : 0,
+  "op" : 60,
+  "w" : 100,
+  "h" : 100,
+  "nm" : "Spinner",
+  "ddd" : 0,
+  "assets" : [],
+  "layers" : [
+    {
+      "ddd" : 0,
+      "ind" : 1,
+      "ty" : 4,
+      "nm" : "spinner Outlines",
+      "sr" : 1,
+      "ks" : {
+        "o" : {
+          "a" : 0,
+          "k" : 100,
+          "ix" : 11
+        },
+        "r" : {
+          "a" : 0,
+          "k" : 0,
+          "ix" : 10
+        },
+        "p" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 2
+        },
+        "a" : {
+          "a" : 0,
+          "k" : [
+            160,
+            284,
+            0
+          ],
+          "ix" : 1
+        },
+        "s" : {
+          "a" : 0,
+          "k" : [
+            100,
+            100,
+            100
+          ],
+          "ix" : 6
+        }
+      },
+      "ao" : 0,
+      "shapes" : [
+        {
+          "ty" : "gr",
+          "it" : [
+            {
+              "ind" : 0,
+              "ty" : "sh",
+              "ix" : 1,
+              "ks" : {
+                "a" : 0,
+                "k" : {
+                  "i" : [
+                    [
+                      0,
+                      19.882000000000001
+                    ],
+                    [
+                      19.882000000000001,
+                      0
+                    ],
+                    [
+                      0,
+                      -19.882000000000001
+                    ],
+                    [
+                      -19.882000000000001,
+                      0
+                    ]
+                  ],
+                  "o" : [
+                    [
+                      0,
+                      -19.882000000000001
+                    ],
+                    [
+                      -19.882000000000001,
+                      0
+                    ],
+                    [
+                      0,
+                      19.882000000000001
+                    ],
+                    [
+                      19.882000000000001,
+                      0
+                    ]
+                  ],
+                  "v" : [
+                    [
+                      36,
+                      0
+                    ],
+                    [
+                      0,
+                      -36
+                    ],
+                    [
+                      -36,
+                      0
+                    ],
+                    [
+                      0,
+                      36
+                    ]
+                  ],
+                  "c" : true
+                },
+                "ix" : 2
+              },
+              "nm" : "Path 1",
+              "mn" : "ADBE Vector Shape - Group",
+              "hd" : false
+            },
+            {
+              "ty" : "tm",
+              "s" : {
+                "a" : 0,
+                "k" : 90,
+                "ix" : 1
+              },
+              "e" : {
+                "a" : 0,
+                "k": 90,
+                "ix" : 2
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 3
+              },
+              "m" : 1,
+              "ix" : 2,
+              "nm" : "Trim Paths 1",
+              "mn" : "ADBE Vector Filter - Trim",
+              "hd" : false
+            },
+            {
+              "ty" : "st",
+              "c" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  1,
+                  0,
+                  1
+                ],
+                "ix" : 3
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 4
+              },
+              "w" : {
+                "a" : 0,
+                "k" : 10,
+                "ix" : 5
+              },
+              "lc" : 3,
+              "lj" : 1,
+              "ml" : 10,
+              "nm" : "Stroke 1",
+              "mn" : "ADBE Vector Graphic - Stroke",
+              "hd" : false
+            },
+            {
+              "ty" : "tr",
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  160,
+                  284
+                ],
+                "ix" : 2
+              },
+              "a" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 1
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                  100,
+                  100
+                ],
+                "ix" : 3
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 6
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 7
+              },
+              "sk" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 4
+              },
+              "sa" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 5
+              },
+              "nm" : "Transform"
+            }
+          ],
+          "nm" : "Group 1",
+          "np" : 3,
+          "cix" : 2,
+          "ix" : 1,
+          "mn" : "ADBE Vector Group",
+          "hd" : false
+        }
+      ],
+      "ip" : 0,
+      "op" : 60.0000024438501,
+      "st" : 0,
+      "bm" : 0
+    }
+  ],
+  "markers" : []
+}
diff --git a/testsuite/ottie/snapshot/trim-offset-rotates.0.node 
b/testsuite/ottie/snapshot/trim-offset-rotates.0.node
new file mode 100644
index 0000000000..31d3889d14
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-offset-rotates.0.node
@@ -0,0 +1,18 @@
+clip {
+  child: stroke {
+    child: color {
+      bounds: -30 0 160 100;
+      color: rgb(0,255,0);
+    }
+    path: "\
+M 77 50\
+C 78 50, 79 50, 80 50\
+M 20 50\
+C 21 50, 22 50, 23 50";
+    line-width: 10;
+    line-cap: square;
+    line-join: miter;
+    miter-limit: 10;
+  }
+  clip: 0 0 100 100;
+}
diff --git a/testsuite/ottie/snapshot/trim-offset-rotates.lottie 
b/testsuite/ottie/snapshot/trim-offset-rotates.lottie
new file mode 100644
index 0000000000..a669546728
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-offset-rotates.lottie
@@ -0,0 +1,222 @@
+{
+  "v" : "5.1.8",
+  "fr" : 2,
+  "ip" : 0,
+  "op" : 60,
+  "w" : 100,
+  "h" : 100,
+  "nm" : "Spinner",
+  "ddd" : 0,
+  "assets" : [],
+  "layers" : [
+    {
+      "ddd" : 0,
+      "ind" : 1,
+      "ty" : 4,
+      "nm" : "spinner Outlines",
+      "sr" : 1,
+      "ks" : {
+        "o" : {
+          "a" : 0,
+          "k" : 100,
+          "ix" : 11
+        },
+        "r" : {
+          "a" : 0,
+          "k" : 0,
+          "ix" : 10
+        },
+        "p" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 2
+        },
+        "a" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 1
+        },
+        "s" : {
+          "a" : 0,
+          "k" : [
+            100,
+            100,
+            100
+          ],
+          "ix" : 6
+        }
+      },
+      "ao" : 0,
+      "shapes" : [
+        {
+          "ty" : "gr",
+          "it" : [
+            {
+              "ind" : 0,
+              "ty" : "sh",
+              "ix" : 1,
+              "ks" : {
+                "a" : 0,
+                "k" : {
+                  "i" : [
+                    [
+                      20,
+                      0
+                    ],
+                    [
+                      -20,
+                      0
+                    ]
+                  ],
+                  "o" : [
+                    [
+                      20,
+                      0
+                    ],
+                    [
+                      -20,
+                      0
+                    ]
+                  ],
+                  "v" : [
+                    [
+                      20,
+                      50
+                    ],
+                    [
+                      80,
+                      50
+                    ]
+                  ],
+                  "c" : false
+                },
+                "ix" : 2
+              },
+              "nm" : "Path 1",
+              "mn" : "ADBE Vector Shape - Group",
+              "hd" : false
+            },
+            {
+              "ty" : "tm",
+              "s" : {
+                "a" : 0,
+                "k" : 45,
+                "ix" : 1
+              },
+              "e" : {
+                "a" : 0,
+                "k": 55,
+                "ix" : 2
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 180,
+                "ix" : 3
+              },
+              "m" : 1,
+              "ix" : 2,
+              "nm" : "Trim Paths 1",
+              "mn" : "ADBE Vector Filter - Trim",
+              "hd" : false
+            },
+            {
+              "ty" : "st",
+              "c" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  1,
+                  0
+                ],
+                "ix" : 3
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 4
+              },
+              "w" : {
+                "a" : 0,
+                "k" : 10,
+                "ix" : 5
+              },
+              "lc" : 3,
+              "lj" : 1,
+              "ml" : 10,
+              "nm" : "Stroke 1",
+              "mn" : "ADBE Vector Graphic - Stroke",
+              "hd" : false
+            },
+            {
+              "ty" : "tr",
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 2
+              },
+              "a" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 1
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                  100,
+                  100
+                ],
+                "ix" : 3
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 6
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 7
+              },
+              "sk" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 4
+              },
+              "sa" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 5
+              },
+              "nm" : "Transform"
+            }
+          ],
+          "nm" : "Group 1",
+          "np" : 3,
+          "cix" : 2,
+          "ix" : 1,
+          "mn" : "ADBE Vector Group",
+          "hd" : false
+        }
+      ],
+      "ip" : 0,
+      "op" : 60.0000024438501,
+      "st" : 0,
+      "bm" : 0
+    }
+  ],
+  "markers" : []
+}
diff --git a/testsuite/ottie/snapshot/trim-startend-does-minmax.0.node 
b/testsuite/ottie/snapshot/trim-startend-does-minmax.0.node
new file mode 100644
index 0000000000..15b1d8b973
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-startend-does-minmax.0.node
@@ -0,0 +1,16 @@
+clip {
+  child: stroke {
+    child: color {
+      bounds: -3 0 106 100;
+      color: rgb(0,255,0);
+    }
+    path: "\
+M 47 50\
+C 49 50, 51 50, 53 50";
+    line-width: 10;
+    line-cap: square;
+    line-join: miter;
+    miter-limit: 10;
+  }
+  clip: 0 0 100 100;
+}
diff --git a/testsuite/ottie/snapshot/trim-startend-does-minmax.lottie 
b/testsuite/ottie/snapshot/trim-startend-does-minmax.lottie
new file mode 100644
index 0000000000..cdf1a965d9
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-startend-does-minmax.lottie
@@ -0,0 +1,222 @@
+{
+  "v" : "5.1.8",
+  "fr" : 2,
+  "ip" : 0,
+  "op" : 60,
+  "w" : 100,
+  "h" : 100,
+  "nm" : "Spinner",
+  "ddd" : 0,
+  "assets" : [],
+  "layers" : [
+    {
+      "ddd" : 0,
+      "ind" : 1,
+      "ty" : 4,
+      "nm" : "spinner Outlines",
+      "sr" : 1,
+      "ks" : {
+        "o" : {
+          "a" : 0,
+          "k" : 100,
+          "ix" : 11
+        },
+        "r" : {
+          "a" : 0,
+          "k" : 0,
+          "ix" : 10
+        },
+        "p" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 2
+        },
+        "a" : {
+          "a" : 0,
+          "k" : [
+            50,
+            50,
+            0
+          ],
+          "ix" : 1
+        },
+        "s" : {
+          "a" : 0,
+          "k" : [
+            100,
+            100,
+            100
+          ],
+          "ix" : 6
+        }
+      },
+      "ao" : 0,
+      "shapes" : [
+        {
+          "ty" : "gr",
+          "it" : [
+            {
+              "ind" : 0,
+              "ty" : "sh",
+              "ix" : 1,
+              "ks" : {
+                "a" : 0,
+                "k" : {
+                  "i" : [
+                    [
+                      20,
+                      0
+                    ],
+                    [
+                      -20,
+                      0
+                    ]
+                  ],
+                  "o" : [
+                    [
+                      20,
+                      0
+                    ],
+                    [
+                      -20,
+                      0
+                    ]
+                  ],
+                  "v" : [
+                    [
+                      20,
+                      50
+                    ],
+                    [
+                      80,
+                      50
+                    ]
+                  ],
+                  "c" : false
+                },
+                "ix" : 2
+              },
+              "nm" : "Path 1",
+              "mn" : "ADBE Vector Shape - Group",
+              "hd" : false
+            },
+            {
+              "ty" : "tm",
+              "s" : {
+                "a" : 0,
+                "k" : 45,
+                "ix" : 1
+              },
+              "e" : {
+                "a" : 0,
+                "k": 55,
+                "ix" : 2
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 3
+              },
+              "m" : 1,
+              "ix" : 2,
+              "nm" : "Trim Paths 1",
+              "mn" : "ADBE Vector Filter - Trim",
+              "hd" : false
+            },
+            {
+              "ty" : "st",
+              "c" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  1,
+                  0
+                ],
+                "ix" : 3
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 4
+              },
+              "w" : {
+                "a" : 0,
+                "k" : 10,
+                "ix" : 5
+              },
+              "lc" : 3,
+              "lj" : 1,
+              "ml" : 10,
+              "nm" : "Stroke 1",
+              "mn" : "ADBE Vector Graphic - Stroke",
+              "hd" : false
+            },
+            {
+              "ty" : "tr",
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 2
+              },
+              "a" : {
+                "a" : 0,
+                "k" : [
+                  0,
+                  0
+                ],
+                "ix" : 1
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                  100,
+                  100
+                ],
+                "ix" : 3
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 6
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100,
+                "ix" : 7
+              },
+              "sk" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 4
+              },
+              "sa" : {
+                "a" : 0,
+                "k" : 0,
+                "ix" : 5
+              },
+              "nm" : "Transform"
+            }
+          ],
+          "nm" : "Group 1",
+          "np" : 3,
+          "cix" : 2,
+          "ix" : 1,
+          "mn" : "ADBE Vector Group",
+          "hd" : false
+        }
+      ],
+      "ip" : 0,
+      "op" : 60.0000024438501,
+      "st" : 0,
+      "bm" : 0
+    }
+  ],
+  "markers" : []
+}


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