[skottie] Allow conincident keyframes

Relax the sanity check to allow parsing coincident keyframes.

The rest of the interpolation logic already handles these cases sanely.

Change-Id: Ib1eb762b2c36e9879971594dad859fbea5b87185
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/894376
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
diff --git a/modules/skottie/src/animator/KeyframeAnimator.cpp b/modules/skottie/src/animator/KeyframeAnimator.cpp
index 93ab157..be2a421 100644
--- a/modules/skottie/src/animator/KeyframeAnimator.cpp
+++ b/modules/skottie/src/animator/KeyframeAnimator.cpp
@@ -164,8 +164,8 @@
         if (i > 0) {
             auto& prev_kf = fKFs.back();
 
-            // Ts must be strictly monotonic.
-            if (t <= prev_kf.t) {
+            // Ts must be monotonic.
+            if (t < prev_kf.t) {
                 return false;
             }
 
diff --git a/modules/skottie/tests/Keyframe.cpp b/modules/skottie/tests/Keyframe.cpp
index 052f211..6ca874b 100644
--- a/modules/skottie/tests/Keyframe.cpp
+++ b/modules/skottie/tests/Keyframe.cpp
@@ -197,4 +197,31 @@
         REPORTER_ASSERT(reporter, prop(0.85f).x > 200);
         REPORTER_ASSERT(reporter, prop(0.85f).y > 200);
     }
+    {
+        // Coincident keyframes (t == 1)
+        //
+        // Effective interpolation intervals:
+        //   [0 .. 1) -> [100 .. 200)
+        //   [1 .. 2) -> [300 .. 400)
+        //
+        // When more than 2 concident keyframes are present, only the first and last one count.
+        MockProperty<ScalarValue> prop(R"({
+                                            "a": 1,
+                                            "k": [
+                                              { "t": 0, "s": [100]  },
+                                              { "t": 1, "s": [200]  },
+                                              { "t": 1, "s": [1000] },
+                                              { "t": 1, "s": [300]  },
+                                              { "t": 2, "s": [400]  }
+                                            ]
+                                          })");
+        REPORTER_ASSERT(reporter, prop);
+        REPORTER_ASSERT(reporter, !prop.isStatic());
+
+        REPORTER_ASSERT(reporter, prop(0.9999f) > 100);
+        REPORTER_ASSERT(reporter, prop(0.9999f) < 200);
+        REPORTER_ASSERT(reporter, prop(1) == 300);
+        REPORTER_ASSERT(reporter, prop(1.0001f) > 300);
+        REPORTER_ASSERT(reporter, prop(1.0001f) < 400);
+    }
 }