migrate more legacy unittests into tests/
authorreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sat, 7 Mar 2009 03:39:23 +0000 (03:39 +0000)
committerreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sat, 7 Mar 2009 03:39:23 +0000 (03:39 +0000)
SkParse yet to be cleaned up

git-svn-id: http://skia.googlecode.com/svn/trunk@113 2bbb7eff-a529-9590-31e7-b0007b416f81

16 files changed:
Makefile
bench/main.cpp
include/core/SkGraphics.h
include/core/SkPathMeasure.h
include/core/SkStream.h
include/core/SkTSearch.h
samplecode/SampleApp.cpp
src/core/SkGraphics.cpp
src/core/SkPathMeasure.cpp
src/core/SkStream.cpp
src/core/SkTSearch.cpp
tests/PathMeasureTest.cpp [new file with mode: 0644]
tests/SortTest.cpp [new file with mode: 0644]
tests/StreamTest.cpp [new file with mode: 0644]
tests/TestXCode/Tests.xcodeproj/project.pbxproj
tests/main.cpp

index c08d0bb356bdaf71e546e4f71fdd261de5fe9aaf..d687e15f4fb27c21e73992d5ba594a14577c681d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,8 @@ C_INCLUDES += -Isrc/core
 
 TESTS_SRCS := GeometryTest.cpp MathTest.cpp MatrixTest.cpp PackBitsTest.cpp \
               Sk64Test.cpp StringTest.cpp Test.cpp UtilsTest.cpp PathTest.cpp \
-              ClipCubicTest.cpp SrcOverTest.cpp main.cpp
+              ClipCubicTest.cpp SrcOverTest.cpp StreamTest.cpp SortTest.cpp \
+                         PathMeasureTest.cpp main.cpp
 
 TESTS_SRCS := $(addprefix tests/, $(TESTS_SRCS))
 
index d66482f5ccd3a80f27ff0a2802b673c08d59d8d5..77f49dcec8fe5edfd582652bbece26dbe0411623 100644 (file)
@@ -112,8 +112,8 @@ static int findConfig(const char config[]) {
 
 class SkAutoGraphics {
 public:
-    SkAutoGraphics(bool runUnitTests = false) {
-        SkGraphics::Init(runUnitTests);
+    SkAutoGraphics() {
+        SkGraphics::Init();
     }
     ~SkAutoGraphics() {
         SkGraphics::Term();
index cb061283065f72c5277772083d719ffcebc079a7..1862a2bded139a8a144c22d8a4174da7fc6abbff 100644 (file)
@@ -21,7 +21,7 @@
 
 class SkGraphics {
 public:
-    static void Init(bool runUnitTests);
+    static void Init();
     static void Term();
 
     /** Return the (approximate) number of bytes used by the font cache.
index 5ab97cacfdbd5a65a80a114824ccb57ce61e7e28..2d94ae21bb3d54e7f634a8663382cce81f36300e 100644 (file)
@@ -80,7 +80,6 @@ public:
 
 #ifdef SK_DEBUG
     void    dump();
-    static void UnitTest();
 #endif
 
 private:
index 26ef43f624739d591576dd4f0bdd83ae2e7794ca..3a82991eba91d86a8998af3b9315aec30edcd44b 100644 (file)
@@ -68,8 +68,6 @@ public:
     bool     readBool() { return this->readU8() != 0; }
     SkScalar readScalar();
     size_t   readPackedUInt();
-
-    static void UnitTest();
 };
 
 class SkWStream : SkNoncopyable {
@@ -101,8 +99,6 @@ public:
     bool    writePackedUInt(size_t);
     
     bool writeStream(SkStream* input, size_t length);
-
-    static void UnitTest();
 };
 
 ////////////////////////////////////////////////////////////////////////////////////////
index f29e6f5e77e6de20d0333835c0fefc930ef4f9bc..e2080715c70178cfcb06915e1a287f5fef647da1 100644 (file)
@@ -161,7 +161,5 @@ extern "C" {
     void SkQSort(void* base, size_t count, size_t elemSize, SkQSortCompareProc);
 }
 
-SkDEBUGCODE(void SkQSort_UnitTest();)
-
 #endif
 
index 0d2bbbc23b3f7163e4a54343fc622521cb728286..3a819029d0d9a7fbbd293defe041059074011cf5 100644 (file)
@@ -597,7 +597,7 @@ void get_preferred_size(int* x, int* y, int* width, int* height) {
 void application_init() {
 //    setenv("ANDROID_ROOT", "../../../data", 0);
     setenv("ANDROID_ROOT", "/android/device/data", 0);
-       SkGraphics::Init(true);
+       SkGraphics::Init();
        SkEvent::Init();
 }
 
index ff41f0c231044e90ba7c5017413a3805af6e3771..7e72c3f5eb171ad024c846f55ac7ab55e1e13252 100644 (file)
@@ -27,7 +27,6 @@
 #include "SkMatrix.h"
 #include "SkPath.h"
 #include "SkPathEffect.h"
-#include "SkPathMeasure.h"
 #include "SkRandom.h"
 #include "SkRefCnt.h"
 #include "SkScalerContext.h"
@@ -78,7 +77,6 @@ static void test_sort()
 #define SPEED_TESTx
 
 #define typesizeline(type)  { #type , sizeof(type) }
-#define unittestline(type)  { #type , type::UnitTest }
 
 
 #ifdef BUILD_EMBOSS_TABLE
@@ -271,7 +269,7 @@ static float time_intToFloat() {
 #endif
 #endif
 
-void SkGraphics::Init(bool runUnitTests)
+void SkGraphics::Init()
 {
     SkGlobals::Init();
 
@@ -287,9 +285,7 @@ void SkGraphics::Init(bool runUnitTests)
     SkRadialGradient_BuildTable();
 #endif
 
-#ifdef SK_SUPPORT_UNITTEST
-    if (runUnitTests == false)
-        return;
+#ifdef SK_DEBUGx
     int i;
 
     static const struct {
@@ -337,25 +333,10 @@ void SkGraphics::Init(bool runUnitTests)
         else
             SkDebugf("SkGraphics: char is unsigned\n");
     }
-    for (i = 0; i < (int)SK_ARRAY_COUNT(gTypeSize); i++)
-        SkDebugf("SkGraphics: sizeof(%s) = %d\n", gTypeSize[i].fTypeName, gTypeSize[i].fSizeOf);
-
-    static const struct {
-        const char* fTypeName;
-        void (*fUnitTest)();
-    } gUnitTests[] = {
-        unittestline(SkPathMeasure),
-        unittestline(SkStream),
-        unittestline(SkWStream),
-    };
-
-    for (i = 0; i < (int)SK_ARRAY_COUNT(gUnitTests); i++)
-    {
-        SkDebugf("SkGraphics: Running UnitTest for %s\n", gUnitTests[i].fTypeName);
-        gUnitTests[i].fUnitTest();
-        SkDebugf("SkGraphics: End UnitTest for %s\n", gUnitTests[i].fTypeName);
+    for (i = 0; i < (int)SK_ARRAY_COUNT(gTypeSize); i++) {
+        SkDebugf("SkGraphics: sizeof(%s) = %d\n",
+                 gTypeSize[i].fTypeName, gTypeSize[i].fSizeOf);
     }
-    SkQSort_UnitTest();
 
 #endif
 
index ec1510df328d6cb7a2f603215e75194d6c2f2f39..99bdeceacae3ecb962509d772b6b9facbdaec1c7 100644 (file)
@@ -558,41 +558,4 @@ void SkPathMeasure::dump() {
     }
 }
 
-void SkPathMeasure::UnitTest() {
-#ifdef SK_SUPPORT_UNITTEST
-    SkPath  path;
-
-    path.moveTo(0, 0);
-    path.lineTo(SK_Scalar1, 0);
-    path.lineTo(SK_Scalar1, SK_Scalar1);
-    path.lineTo(0, SK_Scalar1);
-
-    SkPathMeasure   meas(path, true);
-    SkScalar        length = meas.getLength();
-    SkASSERT(length == SK_Scalar1*4);
-
-    path.reset();
-    path.moveTo(0, 0);
-    path.lineTo(SK_Scalar1*3, SK_Scalar1*4);
-    meas.setPath(&path, false);
-    length = meas.getLength();
-    SkASSERT(length == SK_Scalar1*5);
-
-    path.reset();
-    path.addCircle(0, 0, SK_Scalar1);
-    meas.setPath(&path, true);
-    length = meas.getLength();
-    SkDebugf("circle arc-length = %g\n", length);
-
-    for (int i = 0; i < 8; i++) {
-        SkScalar    d = length * i / 8;
-        SkPoint     p;
-        SkVector    v;
-        meas.getPosTan(d, &p, &v);
-        SkDebugf("circle arc-length=%g, pos[%g %g] tan[%g %g]\n",
-                 d, p.fX, p.fY, v.fX, v.fY);
-    }
-#endif
-}
-
 #endif
index b199a1b94440daa8a5e38c4f2b8fefdd916b2803..6571328e8ab56d95aa110ea3ce8d6b35345e63db 100644 (file)
@@ -736,121 +736,3 @@ bool SkDebugWStream::write(const void* buffer, size_t size)
     return true;
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef SK_DEBUG
-
-#include "SkRandom.h"
-
-#ifdef SK_SUPPORT_UNITTEST
-#define MAX_SIZE    (256 * 1024)
-
-static void random_fill(SkRandom& rand, void* buffer, size_t size) {
-    char* p = (char*)buffer;
-    char* stop = p + size;
-    while (p < stop) {
-        *p++ = (char)(rand.nextU() >> 8);
-    }
-}
-
-static void test_buffer() {
-    SkRandom rand;
-    SkAutoMalloc am(MAX_SIZE * 2);
-    char* storage = (char*)am.get();
-    char* storage2 = storage + MAX_SIZE;
-
-    random_fill(rand, storage, MAX_SIZE);
-
-    for (int sizeTimes = 0; sizeTimes < 100; sizeTimes++) {
-        int size = rand.nextU() % MAX_SIZE;
-        if (size == 0) {
-            size = MAX_SIZE;
-        }
-        for (int times = 0; times < 100; times++) {
-            int bufferSize = 1 + (rand.nextU() & 0xFFFF);
-            SkMemoryStream mstream(storage, size);
-            SkBufferStream bstream(&mstream, bufferSize);
-            
-            int bytesRead = 0;
-            while (bytesRead < size) {
-                int s = 17 + (rand.nextU() & 0xFFFF);
-                int ss = bstream.read(storage2, s);
-                SkASSERT(ss > 0 && ss <= s);
-                SkASSERT(bytesRead + ss <= size);
-                SkASSERT(memcmp(storage + bytesRead, storage2, ss) == 0);
-                bytesRead += ss;
-            }
-            SkASSERT(bytesRead == size);
-        }
-    }
-}
-#endif
-
-void SkStream::UnitTest() {
-#ifdef SK_SUPPORT_UNITTEST
-    {
-        static const char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-        char            copy[sizeof(s)];
-        SkRandom        rand;
-        
-        for (int i = 0; i < 65; i++)
-        {
-            char*           copyPtr = copy;
-            SkMemoryStream  mem(s, sizeof(s));
-            SkBufferStream  buff(&mem, i);
-            
-            do {
-                copyPtr += buff.read(copyPtr, rand.nextU() & 15);
-            } while (copyPtr < copy + sizeof(s));
-            SkASSERT(copyPtr == copy + sizeof(s));
-            SkASSERT(memcmp(s, copy, sizeof(s)) == 0);
-        }
-    }
-    test_buffer();
-#endif
-}
-
-void SkWStream::UnitTest()
-{
-#ifdef SK_SUPPORT_UNITTEST
-    {
-        SkDebugWStream  s;
-
-        s.writeText("testing wstream helpers\n");
-        s.writeText("compare: 0 ");         s.writeDecAsText(0);    s.newline();
-        s.writeText("compare: 591 ");       s.writeDecAsText(591);  s.newline();
-        s.writeText("compare: -9125 ");     s.writeDecAsText(-9125);    s.newline();
-        s.writeText("compare: 0 ");         s.writeHexAsText(0, 0); s.newline();
-        s.writeText("compare: 03FA ");      s.writeHexAsText(0x3FA, 4); s.newline();
-        s.writeText("compare: DEADBEEF ");  s.writeHexAsText(0xDEADBEEF, 4);    s.newline();
-        s.writeText("compare: 0 ");         s.writeScalarAsText(SkIntToScalar(0));  s.newline();
-        s.writeText("compare: 27 ");        s.writeScalarAsText(SkIntToScalar(27)); s.newline();
-        s.writeText("compare: -119 ");      s.writeScalarAsText(SkIntToScalar(-119));   s.newline();
-        s.writeText("compare: 851.3333 ");  s.writeScalarAsText(SkIntToScalar(851) + SK_Scalar1/3); s.newline();
-        s.writeText("compare: -0.08 ");     s.writeScalarAsText(-SK_Scalar1*8/100); s.newline();
-    }
-
-    {
-        SkDynamicMemoryWStream  ds;
-        const char s[] = "abcdefghijklmnopqrstuvwxyz";
-        int i;
-        for (i = 0; i < 100; i++) {
-            bool result = ds.write(s, 26);
-            SkASSERT(result);
-        }
-        SkASSERT(ds.getOffset() == 100 * 26);
-        char* dst = new char[100 * 26 + 1];
-        dst[100*26] = '*';
-        ds.copyTo(dst);
-        SkASSERT(dst[100*26] == '*');
-   //     char* p = dst;
-        for (i = 0; i < 100; i++)
-            SkASSERT(memcmp(&dst[i * 26], s, 26) == 0);
-        SkASSERT(memcmp(dst, ds.getStream(), 100*26) == 0);
-        delete[] dst;
-    }
-#endif
-}
-
-#endif
index bab348f6e23912bd0734eaa72e23231fe20af1db..6d9ff8133f416f2bf7fd6d090f631ff0559a0da2 100644 (file)
@@ -185,35 +185,3 @@ void SkQSort(void* base, size_t count, size_t elemSize, SkQSortCompareProc compa
     SkQSort_Partition((char*)base, (char*)base + (count - 1) * elemSize, elemSize, compare);
 }
 
-#ifdef SK_DEBUG
-
-#include "SkRandom.h"
-
-#ifdef SK_SUPPORT_UNITTEST
-extern "C" {
-    int compare_int(const void* a, const void* b)
-    {
-        return *(const int*)a - *(const int*)b;
-    }
-}
-#endif
-
-void SkQSort_UnitTest()
-{
-#ifdef SK_SUPPORT_UNITTEST
-    int         array[100];
-    SkRandom    rand;
-
-    for (int i = 0; i < 1000; i++)
-    {
-        int j, count = rand.nextRangeU(1, SK_ARRAY_COUNT(array));
-        for (j = 0; j < count; j++)
-            array[j] = rand.nextS() & 0xFF;
-        SkQSort(array, count, sizeof(int), compare_int);
-        for (j = 1; j < count; j++)
-            SkASSERT(array[j-1] <= array[j]);
-    }
-#endif
-}
-
-#endif
diff --git a/tests/PathMeasureTest.cpp b/tests/PathMeasureTest.cpp
new file mode 100644 (file)
index 0000000..de18764
--- /dev/null
@@ -0,0 +1,42 @@
+#include "Test.h"
+#include "SkPathMeasure.h"
+
+static void TestPathMeasure(skiatest::Reporter* reporter) {
+    SkPath  path;
+
+    path.moveTo(0, 0);
+    path.lineTo(SK_Scalar1, 0);
+    path.lineTo(SK_Scalar1, SK_Scalar1);
+    path.lineTo(0, SK_Scalar1);
+
+    SkPathMeasure   meas(path, true);
+    SkScalar        length = meas.getLength();
+    SkASSERT(length == SK_Scalar1*4);
+
+    path.reset();
+    path.moveTo(0, 0);
+    path.lineTo(SK_Scalar1*3, SK_Scalar1*4);
+    meas.setPath(&path, false);
+    length = meas.getLength();
+    REPORTER_ASSERT(reporter, length == SK_Scalar1*5);
+
+    path.reset();
+    path.addCircle(0, 0, SK_Scalar1);
+    meas.setPath(&path, true);
+    length = meas.getLength();
+//    SkDebugf("circle arc-length = %g\n", length);
+
+    for (int i = 0; i < 8; i++) {
+        SkScalar    d = length * i / 8;
+        SkPoint     p;
+        SkVector    v;
+        meas.getPosTan(d, &p, &v);
+#if 0
+        SkDebugf("circle arc-length=%g, pos[%g %g] tan[%g %g]\n",
+                 d, p.fX, p.fY, v.fX, v.fY);
+#endif
+    }
+}
+
+#include "TestClassDef.h"
+DEFINE_TESTCLASS("PathMeasure", PathMeasureTestClass, TestPathMeasure)
diff --git a/tests/SortTest.cpp b/tests/SortTest.cpp
new file mode 100644 (file)
index 0000000..6d287c5
--- /dev/null
@@ -0,0 +1,30 @@
+#include "Test.h"
+#include "SkRandom.h"
+#include "SkTSearch.h"
+
+extern "C" {
+    int compare_int(const void* a, const void* b) {
+        return *(const int*)a - *(const int*)b;
+    }
+}
+
+static void TestSort(skiatest::Reporter* reporter) {
+    int         array[100];
+    SkRandom    rand;
+
+    for (int i = 0; i < 1000; i++) {
+        int j, count = rand.nextRangeU(1, SK_ARRAY_COUNT(array));
+        for (j = 0; j < count; j++) {
+            array[j] = rand.nextS() & 0xFF;
+        }
+        SkQSort(array, count, sizeof(int), compare_int);
+        for (j = 1; j < count; j++) {
+            REPORTER_ASSERT(reporter, array[j-1] <= array[j]);
+        }
+    }
+}
+
+// need tests for SkStrSearch
+
+#include "TestClassDef.h"
+DEFINE_TESTCLASS("Sort", SortTestClass, TestSort)
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
new file mode 100644 (file)
index 0000000..704ab4a
--- /dev/null
@@ -0,0 +1,111 @@
+#include "Test.h"
+#include "SkRandom.h"
+#include "SkStream.h"
+
+#define MAX_SIZE    (256 * 1024)
+
+static void random_fill(SkRandom& rand, void* buffer, size_t size) {
+    char* p = (char*)buffer;
+    char* stop = p + size;
+    while (p < stop) {
+        *p++ = (char)(rand.nextU() >> 8);
+    }
+}
+
+static void test_buffer(skiatest::Reporter* reporter) {
+    SkRandom rand;
+    SkAutoMalloc am(MAX_SIZE * 2);
+    char* storage = (char*)am.get();
+    char* storage2 = storage + MAX_SIZE;
+
+    random_fill(rand, storage, MAX_SIZE);
+
+    for (int sizeTimes = 0; sizeTimes < 100; sizeTimes++) {
+        int size = rand.nextU() % MAX_SIZE;
+        if (size == 0) {
+            size = MAX_SIZE;
+        }
+        for (int times = 0; times < 100; times++) {
+            int bufferSize = 1 + (rand.nextU() & 0xFFFF);
+            SkMemoryStream mstream(storage, size);
+            SkBufferStream bstream(&mstream, bufferSize);
+            
+            int bytesRead = 0;
+            while (bytesRead < size) {
+                int s = 17 + (rand.nextU() & 0xFFFF);
+                int ss = bstream.read(storage2, s);
+                REPORTER_ASSERT(reporter, ss > 0 && ss <= s);
+                REPORTER_ASSERT(reporter, bytesRead + ss <= size);
+                REPORTER_ASSERT(reporter, memcmp(storage + bytesRead, storage2, ss) == 0);
+                bytesRead += ss;
+            }
+            REPORTER_ASSERT(reporter, bytesRead == size);
+        }
+    }
+}
+
+static void TestRStream(skiatest::Reporter* reporter) {
+    static const char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+    char            copy[sizeof(s)];
+    SkRandom        rand;
+    
+    for (int i = 0; i < 65; i++)
+    {
+        char*           copyPtr = copy;
+        SkMemoryStream  mem(s, sizeof(s));
+        SkBufferStream  buff(&mem, i);
+        
+        do {
+            copyPtr += buff.read(copyPtr, rand.nextU() & 15);
+        } while (copyPtr < copy + sizeof(s));
+        REPORTER_ASSERT(reporter, copyPtr == copy + sizeof(s));
+        REPORTER_ASSERT(reporter, memcmp(s, copy, sizeof(s)) == 0);
+    }
+    test_buffer(reporter);
+}
+
+static void TestWStream(skiatest::Reporter* reporter)
+{
+    if (false) {
+        SkDebugWStream  s;
+
+        s.writeText("compare: 0 ");         s.writeDecAsText(0);    s.newline();
+        s.writeText("compare: 591 ");       s.writeDecAsText(591);  s.newline();
+        s.writeText("compare: -9125 ");     s.writeDecAsText(-9125);    s.newline();
+        s.writeText("compare: 0 ");         s.writeHexAsText(0, 0); s.newline();
+        s.writeText("compare: 03FA ");      s.writeHexAsText(0x3FA, 4); s.newline();
+        s.writeText("compare: DEADBEEF ");  s.writeHexAsText(0xDEADBEEF, 4);    s.newline();
+        s.writeText("compare: 0 ");         s.writeScalarAsText(SkIntToScalar(0));  s.newline();
+        s.writeText("compare: 27 ");        s.writeScalarAsText(SkIntToScalar(27)); s.newline();
+        s.writeText("compare: -119 ");      s.writeScalarAsText(SkIntToScalar(-119));   s.newline();
+        s.writeText("compare: 851.3333 ");  s.writeScalarAsText(SkIntToScalar(851) + SK_Scalar1/3); s.newline();
+        s.writeText("compare: -0.08 ");     s.writeScalarAsText(-SK_Scalar1*8/100); s.newline();
+    }
+
+    {
+        SkDynamicMemoryWStream  ds;
+        const char s[] = "abcdefghijklmnopqrstuvwxyz";
+        int i;
+        for (i = 0; i < 100; i++) {
+            REPORTER_ASSERT(reporter, ds.write(s, 26));
+        }
+        REPORTER_ASSERT(reporter, ds.getOffset() == 100 * 26);
+        char* dst = new char[100 * 26 + 1];
+        dst[100*26] = '*';
+        ds.copyTo(dst);
+        REPORTER_ASSERT(reporter, dst[100*26] == '*');
+   //     char* p = dst;
+        for (i = 0; i < 100; i++)
+            REPORTER_ASSERT(reporter, memcmp(&dst[i * 26], s, 26) == 0);
+        REPORTER_ASSERT(reporter, memcmp(dst, ds.getStream(), 100*26) == 0);
+        delete[] dst;
+    }
+}
+
+static void TestStreams(skiatest::Reporter* reporter) {
+    TestRStream(reporter);
+    TestWStream(reporter);
+}
+
+#include "TestClassDef.h"
+DEFINE_TESTCLASS("Stream", StreamTestClass, TestStreams)
index ec2c171549f16f9253d6aa6b4ddc256f41ea970b..af9dfd7e613c128a787582ba5ab66343e9892a7b 100644 (file)
@@ -21,6 +21,9 @@
                00A9BFA30F584E150091AD2D /* StringTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00A9BFA20F584E150091AD2D /* StringTest.cpp */; };
                00A9BFBC0F5851570091AD2D /* GeometryTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00A9BFBB0F5851570091AD2D /* GeometryTest.cpp */; };
                276D93080F5B9FEA0081B3B9 /* PathTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276D93070F5B9FEA0081B3B9 /* PathTest.cpp */; };
+               27C9A9C70F6222EE00E9C93D /* PathMeasureTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27C9A9C40F6222EE00E9C93D /* PathMeasureTest.cpp */; };
+               27C9A9C80F6222EE00E9C93D /* SortTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27C9A9C50F6222EE00E9C93D /* SortTest.cpp */; };
+               27C9A9C90F6222EE00E9C93D /* StreamTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27C9A9C60F6222EE00E9C93D /* StreamTest.cpp */; };
                8DD76F6A0486A84900D96B5E /* Tests.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Tests.1 */; };
 /* End PBXBuildFile section */
 
@@ -85,6 +88,9 @@
                00A9BFA60F584F200091AD2D /* TestClassDef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestClassDef.h; path = ../TestClassDef.h; sourceTree = SOURCE_ROOT; };
                00A9BFBB0F5851570091AD2D /* GeometryTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeometryTest.cpp; path = ../GeometryTest.cpp; sourceTree = SOURCE_ROOT; };
                276D93070F5B9FEA0081B3B9 /* PathTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathTest.cpp; path = ../PathTest.cpp; sourceTree = SOURCE_ROOT; };
+               27C9A9C40F6222EE00E9C93D /* PathMeasureTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PathMeasureTest.cpp; path = ../PathMeasureTest.cpp; sourceTree = SOURCE_ROOT; };
+               27C9A9C50F6222EE00E9C93D /* SortTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SortTest.cpp; path = ../SortTest.cpp; sourceTree = SOURCE_ROOT; };
+               27C9A9C60F6222EE00E9C93D /* StreamTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamTest.cpp; path = ../StreamTest.cpp; sourceTree = SOURCE_ROOT; };
                8DD76F6C0486A84900D96B5E /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; };
                C6859E8B029090EE04C91782 /* Tests.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Tests.1; sourceTree = "<group>"; };
 /* End PBXFileReference section */
                08FB7795FE84155DC02AAC07 /* Source */ = {
                        isa = PBXGroup;
                        children = (
+                               27C9A9C40F6222EE00E9C93D /* PathMeasureTest.cpp */,
+                               27C9A9C50F6222EE00E9C93D /* SortTest.cpp */,
+                               27C9A9C60F6222EE00E9C93D /* StreamTest.cpp */,
                                009CC7870F5DAF16002185BE /* ClipCubicTest.cpp */,
                                276D93070F5B9FEA0081B3B9 /* PathTest.cpp */,
                                00A9BF850F584CF30091AD2D /* Sk64Test.cpp */,
                                276D93080F5B9FEA0081B3B9 /* PathTest.cpp in Sources */,
                                009CC7840F5DAE2B002185BE /* SrcOverTest.cpp in Sources */,
                                009CC7880F5DAF16002185BE /* ClipCubicTest.cpp in Sources */,
+                               27C9A9C70F6222EE00E9C93D /* PathMeasureTest.cpp in Sources */,
+                               27C9A9C80F6222EE00E9C93D /* SortTest.cpp in Sources */,
+                               27C9A9C90F6222EE00E9C93D /* StreamTest.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 0b82af4c0ff6f9db3c77a4842f221bbbf873b989..7975de0e54d4c9965058b943b5c8e84984e6fc17 100644 (file)
@@ -1,5 +1,5 @@
 #include <iostream>
-
+#include "SkGraphics.h"
 #include "Test.h"
 
 using namespace skiatest;
@@ -46,7 +46,19 @@ protected:
     virtual void onEnd(Test* test) {}
 };
 
+class SkAutoGraphics {
+public:
+    SkAutoGraphics() {
+        SkGraphics::Init();
+    }
+    ~SkAutoGraphics() {
+        SkGraphics::Term();
+    }
+};
+
 int main (int argc, char * const argv[]) {
+    SkAutoGraphics ag;
+
     PrintfReporter reporter;
     Iter iter(&reporter);
     Test* test;