diff --git a/Makefile b/Makefile index c08d0bb356..d687e15f4f 100644 --- 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)) diff --git a/bench/main.cpp b/bench/main.cpp index d66482f5cc..77f49dcec8 100644 --- a/bench/main.cpp +++ b/bench/main.cpp @@ -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(); diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h index cb06128306..1862a2bded 100644 --- a/include/core/SkGraphics.h +++ b/include/core/SkGraphics.h @@ -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. diff --git a/include/core/SkPathMeasure.h b/include/core/SkPathMeasure.h index 5ab97cacfd..2d94ae21bb 100644 --- a/include/core/SkPathMeasure.h +++ b/include/core/SkPathMeasure.h @@ -80,7 +80,6 @@ public: #ifdef SK_DEBUG void dump(); - static void UnitTest(); #endif private: diff --git a/include/core/SkStream.h b/include/core/SkStream.h index 26ef43f624..3a82991eba 100644 --- a/include/core/SkStream.h +++ b/include/core/SkStream.h @@ -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(); }; //////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/core/SkTSearch.h b/include/core/SkTSearch.h index f29e6f5e77..e2080715c7 100644 --- a/include/core/SkTSearch.h +++ b/include/core/SkTSearch.h @@ -161,7 +161,5 @@ extern "C" { void SkQSort(void* base, size_t count, size_t elemSize, SkQSortCompareProc); } -SkDEBUGCODE(void SkQSort_UnitTest();) - #endif diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 0d2bbbc23b..3a819029d0 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -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(); } diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index ff41f0c231..7e72c3f5eb 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -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 diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp index ec1510df32..99bdeceaca 100644 --- a/src/core/SkPathMeasure.cpp +++ b/src/core/SkPathMeasure.cpp @@ -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 diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp index b199a1b944..6571328e8a 100644 --- a/src/core/SkStream.cpp +++ b/src/core/SkStream.cpp @@ -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 diff --git a/src/core/SkTSearch.cpp b/src/core/SkTSearch.cpp index bab348f6e2..6d9ff8133f 100644 --- a/src/core/SkTSearch.cpp +++ b/src/core/SkTSearch.cpp @@ -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 index 0000000000..de18764481 --- /dev/null +++ b/tests/PathMeasureTest.cpp @@ -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 index 0000000000..6d287c5004 --- /dev/null +++ b/tests/SortTest.cpp @@ -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 index 0000000000..704ab4a6a1 --- /dev/null +++ b/tests/StreamTest.cpp @@ -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) diff --git a/tests/TestXCode/Tests.xcodeproj/project.pbxproj b/tests/TestXCode/Tests.xcodeproj/project.pbxproj index ec2c171549..af9dfd7e61 100644 --- a/tests/TestXCode/Tests.xcodeproj/project.pbxproj +++ b/tests/TestXCode/Tests.xcodeproj/project.pbxproj @@ -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 = ""; }; /* End PBXFileReference section */ @@ -133,6 +139,9 @@ 08FB7795FE84155DC02AAC07 /* Source */ = { isa = PBXGroup; children = ( + 27C9A9C40F6222EE00E9C93D /* PathMeasureTest.cpp */, + 27C9A9C50F6222EE00E9C93D /* SortTest.cpp */, + 27C9A9C60F6222EE00E9C93D /* StreamTest.cpp */, 009CC7870F5DAF16002185BE /* ClipCubicTest.cpp */, 276D93070F5B9FEA0081B3B9 /* PathTest.cpp */, 00A9BF850F584CF30091AD2D /* Sk64Test.cpp */, @@ -251,6 +260,9 @@ 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; }; diff --git a/tests/main.cpp b/tests/main.cpp index 0b82af4c0f..7975de0e54 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,5 +1,5 @@ #include - +#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;