fix edgecase in chopcubic where we computed duplicate tvalues



git-svn-id: http://skia.googlecode.com/svn/trunk@3285 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp
index 6158a20..7cee730 100644
--- a/tests/GeometryTest.cpp
+++ b/tests/GeometryTest.cpp
@@ -12,6 +12,26 @@
     return SkScalarNearlyEqual(a.fX, b.fX) && SkScalarNearlyEqual(a.fY, b.fY);
 }
 
+static void testChopCubic(skiatest::Reporter* reporter) {
+    /*
+        Inspired by this test, which used to assert that the tValues had dups
+     
+        <path stroke="#202020" d="M0,0 C0,0 1,1 2190,5130 C2190,5070 2220,5010 2205,4980" />
+     */
+    const SkPoint src[] = {
+        { SkIntToScalar(2190), SkIntToScalar(5130) },
+        { SkIntToScalar(2190), SkIntToScalar(5070) },
+        { SkIntToScalar(2220), SkIntToScalar(5010) },
+        { SkIntToScalar(2205), SkIntToScalar(4980) },
+    };
+    SkPoint dst[13];
+    SkScalar tValues[3];
+    int count = SkChopCubicAtMaxCurvature(src, dst, tValues);
+    // if we successfully collaps duplicate t-values, we should only get 2 segments
+    REPORTER_ASSERT(reporter, 2 == count);
+}
+
+
 static void TestGeometry(skiatest::Reporter* reporter) {
     SkPoint pts[3], dst[5];
 
@@ -35,6 +55,8 @@
     for (int i = 0; i < 4; ++i) {
         REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i]));
     }
+    
+    testChopCubic(reporter);
 }
 
 #include "TestClassDef.h"