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




commit 50807b79fcfb3bab432ac5d1508c0dd139872ac5
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                        |  41 ++++
 testsuite/ottie/snapshot.c                         | 181 +++++++++++++++
 .../ottie/snapshot/color-array-not-an-array.0.node |   9 +
 .../ottie/snapshot/color-array-not-an-array.lottie | 130 +++++++++++
 .../snapshot/color-array-size-too-small.0.node     |   9 +
 .../snapshot/color-array-size-too-small.lottie     | 133 +++++++++++
 testsuite/ottie/snapshot/color-has-no-alpha.0.node |   9 +
 testsuite/ottie/snapshot/color-has-no-alpha.lottie | 135 +++++++++++
 .../ottie/snapshot/default-stacking-order.0.node   |  18 ++
 .../ottie/snapshot/default-stacking-order.lottie   | 255 +++++++++++++++++++++
 .../snapshot/paths-respect-group-transform.0.node  |  30 +++
 .../snapshot/paths-respect-group-transform.lottie  |   1 +
 .../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.0.node     |  16 ++
 .../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 ++++++++++++++++++
 testsuite/ottie/snapshot/two-shapes.0.node         |  27 +++
 testsuite/ottie/snapshot/two-shapes.lottie         |   1 +
 25 files changed, 2181 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..07c29aac41
--- /dev/null
+++ b/testsuite/ottie/meson.build
@@ -0,0 +1,41 @@
+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 = [
+  [ 'color-has-no-alpha', 0 ],
+  [ 'color-array-not-an-array', 0 ],
+  [ 'color-array-size-too-small', 0 ],
+  [ 'default-stacking-order', 0 ],
+  [ 'paths-respect-group-transform.lottie', 0 ],
+  [ '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 ],
+  [ 'two-shapes', 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/color-array-not-an-array.0.node 
b/testsuite/ottie/snapshot/color-array-not-an-array.0.node
new file mode 100644
index 0000000000..6ca286872d
--- /dev/null
+++ b/testsuite/ottie/snapshot/color-array-not-an-array.0.node
@@ -0,0 +1,9 @@
+fill {
+  child: color {
+    bounds: 20 20 60 60;
+    color: rgb(0,0,0);
+  }
+  path: "\
+M 20 20 h 60 v 60 h -60 z";
+  fill-rule: winding;
+}
diff --git a/testsuite/ottie/snapshot/color-array-not-an-array.lottie 
b/testsuite/ottie/snapshot/color-array-not-an-array.lottie
new file mode 100644
index 0000000000..bbe76f6b87
--- /dev/null
+++ b/testsuite/ottie/snapshot/color-array-not-an-array.lottie
@@ -0,0 +1,130 @@
+{
+"v": "5.5.2",
+"ip": 0,
+"op": 180,
+"nm": "Animation",
+"mn": "{828cb955-8a2d-4494-badb-935628ead9a0}",
+"fr": 60,
+"w": 100,
+"h": 100,
+"assets": [
+],
+"layers": [
+    {
+        "ddd": 0,
+        "ty": 4,
+        "ip": 0,
+        "op": 180,
+        "st": 0,
+        "ks": {
+            "a": {
+                "a": 0,
+                "k": [
+                    0,
+                    0
+                ]
+            },
+            "p": {
+                "a": 0,
+                "k": [
+                    0,
+                    0
+                ]
+            },
+            "s": {
+                "a": 0,
+                "k": [
+                    100,
+                    100
+                ]
+            },
+            "r": {
+                "a": 0,
+                "k": 0
+            },
+            "o": {
+                "a": 0,
+                "k": 100
+            }
+        },
+        "shapes": [
+            {
+                "ty": "gr",
+                "nm": "Rectangle Group",
+                "mn": "{2101e829-0fd4-4cd3-8220-cd1ef92380c0}",
+                "it": [
+                    {
+                        "ty": "rc",
+                        "nm": "Rectangle",
+                        "mn": "{7db2a541-6f01-4a0e-b7ba-b4bf9501d2b1}",
+                        "p": {
+                            "a": 0,
+                            "k": [
+                                50,
+                                50
+                            ]
+                        },
+                        "s": {
+                            "a": 0,
+                            "k": [
+                                60,
+                                60
+                            ]
+                        },
+                        "r": {
+                            "a": 0,
+                            "k": 0
+                        }
+                    },
+                    {
+                        "ty": "fl",
+                        "nm": "Rectangle Fill",
+                        "mn": "{31322740-fb76-4406-bf47-625cc7b2e68f}",
+                        "o": {
+                            "a": 0,
+                            "k": 100
+                        },
+                        "c": {
+                            "a": 0,
+                            "k": 0.5
+                        },
+                        "r": 1
+                    },
+                    {
+                        "ty": "tr",
+                        "a": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                0
+                            ]
+                        },
+                        "p": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                0
+                            ]
+                        },
+                        "s": {
+                            "a": 0,
+                            "k": [
+                                100,
+                                100
+                            ]
+                        },
+                        "r": {
+                            "a": 0,
+                            "k": 0
+                        },
+                        "o": {
+                            "a": 0,
+                            "k": 100
+                        }
+                    }
+                ]
+            }
+        ]
+    }
+]
+}
diff --git a/testsuite/ottie/snapshot/color-array-size-too-small.0.node 
b/testsuite/ottie/snapshot/color-array-size-too-small.0.node
new file mode 100644
index 0000000000..6ca286872d
--- /dev/null
+++ b/testsuite/ottie/snapshot/color-array-size-too-small.0.node
@@ -0,0 +1,9 @@
+fill {
+  child: color {
+    bounds: 20 20 60 60;
+    color: rgb(0,0,0);
+  }
+  path: "\
+M 20 20 h 60 v 60 h -60 z";
+  fill-rule: winding;
+}
diff --git a/testsuite/ottie/snapshot/color-array-size-too-small.lottie 
b/testsuite/ottie/snapshot/color-array-size-too-small.lottie
new file mode 100644
index 0000000000..e3146618da
--- /dev/null
+++ b/testsuite/ottie/snapshot/color-array-size-too-small.lottie
@@ -0,0 +1,133 @@
+{
+"v": "5.5.2",
+"ip": 0,
+"op": 180,
+"nm": "Animation",
+"mn": "{828cb955-8a2d-4494-badb-935628ead9a0}",
+"fr": 60,
+"w": 100,
+"h": 100,
+"assets": [
+],
+"layers": [
+    {
+        "ddd": 0,
+        "ty": 4,
+        "ip": 0,
+        "op": 180,
+        "st": 0,
+        "ks": {
+            "a": {
+                "a": 0,
+                "k": [
+                    0,
+                    0
+                ]
+            },
+            "p": {
+                "a": 0,
+                "k": [
+                    0,
+                    0
+                ]
+            },
+            "s": {
+                "a": 0,
+                "k": [
+                    100,
+                    100
+                ]
+            },
+            "r": {
+                "a": 0,
+                "k": 0
+            },
+            "o": {
+                "a": 0,
+                "k": 100
+            }
+        },
+        "shapes": [
+            {
+                "ty": "gr",
+                "nm": "Rectangle Group",
+                "mn": "{2101e829-0fd4-4cd3-8220-cd1ef92380c0}",
+                "it": [
+                    {
+                        "ty": "rc",
+                        "nm": "Rectangle",
+                        "mn": "{7db2a541-6f01-4a0e-b7ba-b4bf9501d2b1}",
+                        "p": {
+                            "a": 0,
+                            "k": [
+                                50,
+                                50
+                            ]
+                        },
+                        "s": {
+                            "a": 0,
+                            "k": [
+                                60,
+                                60
+                            ]
+                        },
+                        "r": {
+                            "a": 0,
+                            "k": 0
+                        }
+                    },
+                    {
+                        "ty": "fl",
+                        "nm": "Rectangle Fill",
+                        "mn": "{31322740-fb76-4406-bf47-625cc7b2e68f}",
+                        "o": {
+                            "a": 0,
+                            "k": 100
+                        },
+                        "c": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                1
+                            ]
+                        },
+                        "r": 1
+                    },
+                    {
+                        "ty": "tr",
+                        "a": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                0
+                            ]
+                        },
+                        "p": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                0
+                            ]
+                        },
+                        "s": {
+                            "a": 0,
+                            "k": [
+                                100,
+                                100
+                            ]
+                        },
+                        "r": {
+                            "a": 0,
+                            "k": 0
+                        },
+                        "o": {
+                            "a": 0,
+                            "k": 100
+                        }
+                    }
+                ]
+            }
+        ]
+    }
+]
+}
diff --git a/testsuite/ottie/snapshot/color-has-no-alpha.0.node 
b/testsuite/ottie/snapshot/color-has-no-alpha.0.node
new file mode 100644
index 0000000000..74129e9111
--- /dev/null
+++ b/testsuite/ottie/snapshot/color-has-no-alpha.0.node
@@ -0,0 +1,9 @@
+fill {
+  child: color {
+    bounds: 20 20 60 60;
+    color: rgb(0,255,0);
+  }
+  path: "\
+M 20 20 h 60 v 60 h -60 z";
+  fill-rule: winding;
+}
diff --git a/testsuite/ottie/snapshot/color-has-no-alpha.lottie 
b/testsuite/ottie/snapshot/color-has-no-alpha.lottie
new file mode 100644
index 0000000000..61418568ad
--- /dev/null
+++ b/testsuite/ottie/snapshot/color-has-no-alpha.lottie
@@ -0,0 +1,135 @@
+{
+"v": "5.5.2",
+"ip": 0,
+"op": 180,
+"nm": "Animation",
+"mn": "{828cb955-8a2d-4494-badb-935628ead9a0}",
+"fr": 60,
+"w": 100,
+"h": 100,
+"assets": [
+],
+"layers": [
+    {
+        "ddd": 0,
+        "ty": 4,
+        "ip": 0,
+        "op": 180,
+        "st": 0,
+        "ks": {
+            "a": {
+                "a": 0,
+                "k": [
+                    0,
+                    0
+                ]
+            },
+            "p": {
+                "a": 0,
+                "k": [
+                    0,
+                    0
+                ]
+            },
+            "s": {
+                "a": 0,
+                "k": [
+                    100,
+                    100
+                ]
+            },
+            "r": {
+                "a": 0,
+                "k": 0
+            },
+            "o": {
+                "a": 0,
+                "k": 100
+            }
+        },
+        "shapes": [
+            {
+                "ty": "gr",
+                "nm": "Rectangle Group",
+                "mn": "{2101e829-0fd4-4cd3-8220-cd1ef92380c0}",
+                "it": [
+                    {
+                        "ty": "rc",
+                        "nm": "Rectangle",
+                        "mn": "{7db2a541-6f01-4a0e-b7ba-b4bf9501d2b1}",
+                        "p": {
+                            "a": 0,
+                            "k": [
+                                50,
+                                50
+                            ]
+                        },
+                        "s": {
+                            "a": 0,
+                            "k": [
+                                60,
+                                60
+                            ]
+                        },
+                        "r": {
+                            "a": 0,
+                            "k": 0
+                        }
+                    },
+                    {
+                        "ty": "fl",
+                        "nm": "Rectangle Fill",
+                        "mn": "{31322740-fb76-4406-bf47-625cc7b2e68f}",
+                        "o": {
+                            "a": 0,
+                            "k": 100
+                        },
+                        "c": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                1,
+                                0,
+                                0
+                            ]
+                        },
+                        "r": 1
+                    },
+                    {
+                        "ty": "tr",
+                        "a": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                0
+                            ]
+                        },
+                        "p": {
+                            "a": 0,
+                            "k": [
+                                0,
+                                0
+                            ]
+                        },
+                        "s": {
+                            "a": 0,
+                            "k": [
+                                100,
+                                100
+                            ]
+                        },
+                        "r": {
+                            "a": 0,
+                            "k": 0
+                        },
+                        "o": {
+                            "a": 0,
+                            "k": 100
+                        }
+                    }
+                ]
+            }
+        ]
+    }
+]
+}
diff --git a/testsuite/ottie/snapshot/default-stacking-order.0.node 
b/testsuite/ottie/snapshot/default-stacking-order.0.node
new file mode 100644
index 0000000000..6cbf1772f1
--- /dev/null
+++ b/testsuite/ottie/snapshot/default-stacking-order.0.node
@@ -0,0 +1,18 @@
+fill {
+  child: color {
+    bounds: 40 20 20 60;
+    color: rgb(0,255,0);
+  }
+  path: "\
+M 40 20 h 20 v 60 h -20 z";
+  fill-rule: winding;
+}
+fill {
+  child: color {
+    bounds: 20 40 60 20;
+    color: rgb(255,0,0);
+  }
+  path: "\
+M 20 40 h 60 v 20 h -60 z";
+  fill-rule: winding;
+}
diff --git a/testsuite/ottie/snapshot/default-stacking-order.lottie 
b/testsuite/ottie/snapshot/default-stacking-order.lottie
new file mode 100644
index 0000000000..a37ec6b593
--- /dev/null
+++ b/testsuite/ottie/snapshot/default-stacking-order.lottie
@@ -0,0 +1,255 @@
+{
+  "v" : "5.5.2",
+  "ip" : 0.0,
+  "op" : 180.0,
+  "nm" : "Animation",
+  "mn" : "{828cb955-8a2d-4494-badb-935628ead9a0}",
+  "fr" : 60.0,
+  "w" : 100,
+  "h" : 100,
+  "assets" : [],
+  "layers" : [
+    {
+      "ddd" : 0,
+      "ty" : 4,
+      "ip" : 0.0,
+      "op" : 180.0,
+      "st" : 0,
+      "ks" : {
+        "a" : {
+          "a" : 0,
+          "k" : [
+            0.0,
+            0.0
+          ]
+        },
+        "p" : {
+          "a" : 0,
+          "k" : [
+            0.0,
+            0.0
+          ]
+        },
+        "s" : {
+          "a" : 0,
+          "k" : [
+            100.0,
+            100.0
+          ]
+        },
+        "r" : {
+          "a" : 0,
+          "k" : 0.0
+        },
+        "o" : {
+          "a" : 0,
+          "k" : 100
+        }
+      },
+      "shapes" : [
+        {
+          "ty" : "gr",
+          "nm" : "Rectangle 1 Group",
+          "mn" : "{e9ee5ac8-191c-4c91-9810-f41801aefd11}",
+          "it" : [
+            {
+              "ty" : "rc",
+              "nm" : "Rectangle 1",
+              "mn" : "{065abe56-76de-4f28-b36d-44c9a39298ae}",
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  50.0,
+                  50.0
+                ]
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                      60.0,
+                      20.0
+                ]
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0.0
+              }
+            },
+            {
+              "ty" : "fl",
+              "nm" : "Rectangle 1 Fill",
+              "mn" : "{efec3e59-c036-4bc7-9655-e43c902e8154}",
+              "o" : {
+                "a" : 0,
+                "k" : 100.0
+              },
+              "c" : {
+                "a" : 0,
+                "k" : [
+                  1.0,
+                  0.0,
+                  0.0,
+                  1.0
+                ]
+              },
+              "r" : 1
+            },
+            {
+              "ty" : "tr",
+              "a" : {
+                "a" : 0,
+                "k" : [
+                  0.0,
+                  0.0
+                ]
+              },
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  0.0,
+                  0.0
+                ]
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                  100.0,
+                  100.0
+                ]
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0.0
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100.0
+              }
+            }
+          ]
+        }
+      ]
+    },
+    {
+      "ddd" : 0,
+      "ty" : 4,
+      "ip" : 0.0,
+      "op" : 180.0,
+      "st" : 0,
+      "ks" : {
+        "a" : {
+          "a" : 0,
+          "k" : [
+            0.0,
+            0.0
+          ]
+        },
+        "p" : {
+          "a" : 0,
+          "k" : [
+            0.0,
+            0.0
+          ]
+        },
+        "s" : {
+          "a" : 0,
+          "k" : [
+            100.0,
+            100.0
+          ]
+        },
+        "r" : {
+          "a" : 0,
+          "k" : 0.0
+        },
+        "o" : {
+          "a" : 0,
+          "k" : 100
+        }
+      },
+      "shapes" : [
+        {
+          "ty" : "gr",
+          "nm" : "Rectangle Group",
+          "mn" : "{2101e829-0fd4-4cd3-8220-cd1ef92380c0}",
+          "it" : [
+            {
+              "ty" : "rc",
+              "nm" : "Rectangle 1",
+              "mn" : "{065abe56-76de-4f28-b36d-44c9a39298ae}",
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  50.0,
+                  50.0
+                ]
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                      20.0,
+                      60.0
+                ]
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0.0
+              }
+            },
+            {
+              "ty" : "fl",
+              "nm" : "Rectangle Fill",
+              "mn" : "{31322740-fb76-4406-bf47-625cc7b2e68f}",
+              "o" : {
+                "a" : 0,
+                "k" : 100.0
+              },
+              "c" : {
+                "a" : 0,
+                "k" : [
+                  0.0,
+                  1.0,
+                  0.0,
+                  1.0
+                ]
+              },
+              "r" : 1
+            },
+            {
+              "ty" : "tr",
+              "a" : {
+                "a" : 0,
+                "k" : [
+                  0.0,
+                  0.0
+                ]
+              },
+              "p" : {
+                "a" : 0,
+                "k" : [
+                  0.0,
+                  0.0
+                ]
+              },
+              "s" : {
+                "a" : 0,
+                "k" : [
+                  100.0,
+                  100.0
+                ]
+              },
+              "r" : {
+                "a" : 0,
+                "k" : 0.0
+              },
+              "o" : {
+                "a" : 0,
+                "k" : 100.0
+              }
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
diff --git a/testsuite/ottie/snapshot/paths-respect-group-transform.0.node 
b/testsuite/ottie/snapshot/paths-respect-group-transform.0.node
new file mode 100644
index 0000000000..8c0491655a
--- /dev/null
+++ b/testsuite/ottie/snapshot/paths-respect-group-transform.0.node
@@ -0,0 +1,30 @@
+transform {
+  child: container {
+    fill {
+      child: color {
+        bounds: -64 -128 128 256;
+        color: rgb(0,0,255);
+      }
+      path: "\
+M 64 -128\
+L 64 128\
+L -64 128\
+L -64 -128\
+Z";
+      fill-rule: winding;
+    }
+    transform {
+      child: fill {
+        child: color {
+          bounds: -128 -64 256 128;
+          color: rgba(255,0,0,0.4);
+        }
+        path: "\
+M -128 -64 h 256 v 128 h -256 z";
+        fill-rule: winding;
+      }
+      transform: rotate(90);
+    }
+  }
+  transform: translate(256, 256);
+}
diff --git a/testsuite/ottie/snapshot/paths-respect-group-transform.lottie 
b/testsuite/ottie/snapshot/paths-respect-group-transform.lottie
new file mode 100644
index 0000000000..bcf78b13b6
--- /dev/null
+++ b/testsuite/ottie/snapshot/paths-respect-group-transform.lottie
@@ -0,0 +1 @@
+{"v":"5.5.2","ip":0.000,"op":180.000,"nm":"Animation","mn":"{e77b27cf-a6b9-4564-9165-c191e8e70c8f}","fr":60.000,"w":512,"h":512,"assets":[],"layers":[{"ddd":0,"ty":4,"ind":0,"st":0,"ip":0.000,"op":180.000,"nm":"Layer","mn":"{3bd686e5-3410-4a01-90e1-fcf41716d74c}","ks":{"a":{"a":0,"k":[0.000,0.000]},"p":{"a":0,"k":[256.000,256.000]},"s":{"a":0,"k":[100.000,100.000]},"r":{"a":0,"k":0.000},"o":{"a":0,"k":100.000}},"shapes":[{"ty":"gr","nm":"Rectangle
 
Group","mn":"{49eb3094-7a98-4d7e-924b-d4ddda21b7b7}","it":[{"ty":"rc","nm":"Rectangle","mn":"{8504d4f3-72f0-41cd-8fd2-1e3fa4e50d1e}","p":{"a":0,"k":[0.000,0.000]},"s":{"a":0,"k":[256.000,128.000]},"r":{"a":0,"k":0.000}},{"ty":"fl","nm":"Rectangle
 
Fill","mn":"{c397fe0c-516e-4ea8-977b-9278a3aa967d}","o":{"a":0,"k":40.000},"c":{"a":0,"k":[1.000,0.000,0.000,1.000]},"r":1},{"ty":"tr","a":{"a":0,"k":[0.000,0.000]},"p":{"a":0,"k":[0.000,0.000]},"s":{"a":0,"k":[100.000,100.000]},"r":{"a":0,"k":90.000},"o":{"a":0,"k":100.000}}]},{"ty":"fl","nm":"Re
 ctangle Fill 
1","mn":"{f5b7dac0-2806-4758-aae4-04ee887ff065}","o":{"a":0,"k":100.000},"c":{"a":0,"k":[0.000,0.000,1.000,1.000]},"r":1}]}]}
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.0.node 
b/testsuite/ottie/snapshot/trim-0-to-200-shows-everything-once.0.node
new file mode 100644
index 0000000000..1372937793
--- /dev/null
+++ b/testsuite/ottie/snapshot/trim-0-to-200-shows-everything-once.0.node
@@ -0,0 +1,16 @@
+clip {
+  child: stroke {
+    child: color {
+      bounds: -30 0 160 100;
+      color: rgba(0,255,0,0.4);
+    }
+    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-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" : []
+}
diff --git a/testsuite/ottie/snapshot/two-shapes.0.node b/testsuite/ottie/snapshot/two-shapes.0.node
new file mode 100644
index 0000000000..7e02113f3d
--- /dev/null
+++ b/testsuite/ottie/snapshot/two-shapes.0.node
@@ -0,0 +1,27 @@
+transform {
+  child: container {
+    stroke {
+      child: color {
+        bounds: -153 -153 306 306;
+        color: rgb(255,255,255);
+      }
+      path: "\
+M -50 -150 h 100 v 300 h -100 z\
+M -150 -50 h 300 v 100 h -300 z";
+      line-width: 6;
+      line-cap: round;
+      line-join: round;
+    }
+    fill {
+      child: color {
+        bounds: -150 -150 300 300;
+        color: rgba(255,0,0,0.4);
+      }
+      path: "\
+M -50 -150 h 100 v 300 h -100 z\
+M -150 -50 h 300 v 100 h -300 z";
+      fill-rule: winding;
+    }
+  }
+  transform: translate(256, 256);
+}
diff --git a/testsuite/ottie/snapshot/two-shapes.lottie b/testsuite/ottie/snapshot/two-shapes.lottie
new file mode 100644
index 0000000000..8b9b0f018f
--- /dev/null
+++ b/testsuite/ottie/snapshot/two-shapes.lottie
@@ -0,0 +1 @@
+{"v":"5.5.2","ip":0.000,"op":180.000,"nm":"Animation","mn":"{87fa173e-bf45-44b2-ada5-fb39a7fbb6ee}","fr":60.000,"w":512,"h":512,"assets":[],"layers":[{"ddd":0,"ty":4,"ind":0,"st":0,"ip":0.000,"op":180.000,"nm":"Layer","mn":"{956d0e46-fdae-4303-ba42-8a0e78c5d812}","ks":{"a":{"a":0,"k":[0.000,0.000]},"p":{"a":0,"k":[256.000,256.000]},"s":{"a":0,"k":[100.000,100.000]},"r":{"a":0,"k":0.000},"o":{"a":0,"k":100.000}},"shapes":[{"ty":"gr","nm":"Rectangle
 
Group","mn":"{6204aa15-606b-4735-9ab7-d6364fd913aa}","it":[{"ty":"rc","nm":"Rectangle","mn":"{119a0c41-bc85-422b-a83d-5795fda9753b}","p":{"a":0,"k":[0.000,0.000]},"s":{"a":0,"k":[100.000,300.000]},"r":{"a":0,"k":0.000}},{"ty":"rc","nm":"Rectangle
 
1","mn":"{4cb25c34-b565-494d-ac17-dfb224b793f6}","p":{"a":0,"k":[0.000,0.000]},"s":{"a":0,"k":[300.000,100.000]},"r":{"a":0,"k":0.000}},{"ty":"fl","nm":"Rectangle
 
Fill","mn":"{e2f5d06c-1170-448a-b325-61ad8c4d94d5}","o":{"a":0,"k":40.000},"c":{"a":0,"k":[1.000,0.000,0.000,1.000]},"r":1},{"ty":"st",
 "nm":"Ellipse 
Stroke","mn":"{1db4727e-dec1-43aa-abf2-8603df97c26d}","o":{"a":0,"k":100.000},"c":{"a":0,"k":[1.000,1.000,1.000,1.000]},"lc":2,"lj":2,"ml":4.000,"w":{"a":0,"k":6.000}},{"ty":"tr","a":{"a":0,"k":[0.000,0.000]},"p":{"a":0,"k":[0.000,0.000]},"s":{"a":0,"k":[100.000,100.000]},"r":{"a":0,"k":0.000},"o":{"a":0,"k":100.000}}]}]}]}
\ No newline at end of file


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