Deterministic SkTSet and PDF Output

Addresses this issue: https://code.google.com/p/skia/issues/detail?id=1277

R=edisonn@google.com, vandebo@chromium.org

Author: richardlin@chromium.org

Review URL: https://chromiumcodereview.appspot.com/19283005

git-svn-id: http://skia.googlecode.com/svn/trunk@10298 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/TSetTest.cpp b/tests/TSetTest.cpp
index 1cb9056..8f276f7 100644
--- a/tests/TSetTest.cpp
+++ b/tests/TSetTest.cpp
@@ -41,7 +41,7 @@
     return (long(i) * PRIME1) % PRIME2;
 }
 
-// Will expose contains() and find() too.
+// Will expose contains() too.
 static void TestTSet_advanced(skiatest::Reporter* reporter) {
     SkTSet<int> set0;
 
@@ -60,6 +60,11 @@
         REPORTER_ASSERT(reporter, !set0.add(f(i)));
     }
 
+    // Test deterministic output
+    for (int i = 0; i < COUNT; i++) {
+        REPORTER_ASSERT(reporter, set0[i] == f(i));
+    }
+
     // Test copy constructor too.
     SkTSet<int> set1 = set0;
 
@@ -68,6 +73,7 @@
 
     for (int i = 0; i < COUNT; i++) {
         REPORTER_ASSERT(reporter, set1.contains(f(i)));
+        REPORTER_ASSERT(reporter, set1[i] == f(i));
     }
 
     // Test operator= too.
@@ -79,6 +85,7 @@
 
     for (int i = 0; i < COUNT; i++) {
         REPORTER_ASSERT(reporter, set2.contains(f(i)));
+        REPORTER_ASSERT(reporter, set2[i] == f(i));
     }
 
 #ifdef SK_DEBUG
@@ -108,6 +115,12 @@
         REPORTER_ASSERT(reporter, set.contains(i));
     }
 
+    // check deterministic output
+    for (int i = 0; i < COUNT; i++) {
+        REPORTER_ASSERT(reporter, set[i] == 2 * i);
+        REPORTER_ASSERT(reporter, set[COUNT + i] == 2 * i + 1);
+    }
+
 #ifdef SK_DEBUG
     set.validate();
     setOdd.validate();