diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-04-02 16:59:40 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-04-02 16:59:40 +0000 |
commit | 80e39a77b16f4396eed230efea1d0b2fc8cbfb00 (patch) | |
tree | 01d340ffe7692fd0d7271b9fd30e151574b1b7e8 | |
parent | 57b799e951064b9328b5c676dcc3b4cb4477cc2b (diff) |
cleanup formating (e.g. no trailing spaces)
git-svn-id: http://skia.googlecode.com/svn/trunk@143 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | tests/MathTest.cpp | 103 | ||||
-rw-r--r-- | tests/MatrixTest.cpp | 8 | ||||
-rw-r--r-- | tests/PackBitsTest.cpp | 8 | ||||
-rw-r--r-- | tests/PathTest.cpp | 8 | ||||
-rw-r--r-- | tests/Sk64Test.cpp | 2 | ||||
-rw-r--r-- | tests/SrcOverTest.cpp | 9 | ||||
-rw-r--r-- | tests/StreamTest.cpp | 65 | ||||
-rw-r--r-- | tests/Test.h | 22 | ||||
-rw-r--r-- | tests/TestClassDef.h | 8 | ||||
-rw-r--r-- | tests/UtilsTest.cpp | 6 | ||||
-rw-r--r-- | tests/testmain.cpp | 10 |
11 files changed, 118 insertions, 131 deletions
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp index 38c3dc1319..dddd2da310 100644 --- a/tests/MathTest.cpp +++ b/tests/MathTest.cpp @@ -6,13 +6,13 @@ static int symmetric_fixmul(int a, int b) { int sa = SkExtractSign(a); int sb = SkExtractSign(b); - + a = SkApplySign(a, sa); b = SkApplySign(b, sb); - + #if 1 int c = (int)(((SkLONGLONG)a * b) >> 16); - + return SkApplySign(c, sa ^ sb); #else SkLONGLONG ab = (SkLONGLONG)a * b; @@ -30,9 +30,9 @@ static void check_length(skiatest::Reporter* reporter, float x = SkScalarToFloat(p.fX); float y = SkScalarToFloat(p.fY); float len = sk_float_sqrt(x*x + y*y); - + len /= SkScalarToFloat(targetLen); - + REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f); #endif } @@ -114,25 +114,24 @@ static void test_int2float(skiatest::Reporter* reporter, int ival) { static void unittest_fastfloat(skiatest::Reporter* reporter) { SkRandom rand; size_t i; - + static const float gFloats[] = { 0.f, 1.f, 0.5f, 0.499999f, 0.5000001f, 1.f/3, 0.000000001f, 1000000000.f, // doesn't overflow 0.0000000001f, 10000000000.f // does overflow }; for (i = 0; i < SK_ARRAY_COUNT(gFloats); i++) { - // SkDebugf("---- test floats %g %d\n", gFloats[i], (int)gFloats[i]); test_float_conversions(reporter, gFloats[i]); test_float_conversions(reporter, -gFloats[i]); } - + for (int outer = 0; outer < 100; outer++) { rand.setSeed(outer); for (i = 0; i < 100000; i++) { float x = nextFloat(rand); test_float_conversions(reporter, x); } - + test_int2float(reporter, 0); test_int2float(reporter, 1); test_int2float(reporter, -1); @@ -156,13 +155,13 @@ static void test_muldiv255(skiatest::Reporter* reporter) { float s = ab / 255.0f; int round = (int)floorf(s + 0.5f); int trunc = (int)floorf(s); - + int iround = SkMulDiv255Round(a, b); int itrunc = SkMulDiv255Trunc(a, b); - + REPORTER_ASSERT(reporter, iround == round); REPORTER_ASSERT(reporter, itrunc == trunc); - + REPORTER_ASSERT(reporter, itrunc <= iround); REPORTER_ASSERT(reporter, iround <= a); REPORTER_ASSERT(reporter, iround <= b); @@ -171,23 +170,23 @@ static void test_muldiv255(skiatest::Reporter* reporter) { #endif } -static void TestMath(skiatest::Reporter* reporter) { +static void TestMath(skiatest::Reporter* reporter) { int i; int32_t x; SkRandom rand; - + // these should assert #if 0 SkToS8(128); SkToS8(-129); SkToU8(256); SkToU8(-5); - + SkToS16(32768); SkToS16(-32769); SkToU16(65536); SkToU16(-5); - + if (sizeof(size_t) > 4) { SkToS32(4*1024*1024); SkToS32(-4*1024*1024); @@ -195,77 +194,77 @@ static void TestMath(skiatest::Reporter* reporter) { SkToU32(-5); } #endif - + test_muldiv255(reporter); - + { SkScalar x = SK_ScalarNaN; REPORTER_ASSERT(reporter, SkScalarIsNaN(x)); } - + for (i = 1; i <= 10; i++) { x = SkCubeRootBits(i*i*i, 11); REPORTER_ASSERT(reporter, x == i); } - + x = SkFixedSqrt(SK_Fixed1); REPORTER_ASSERT(reporter, x == SK_Fixed1); x = SkFixedSqrt(SK_Fixed1/4); REPORTER_ASSERT(reporter, x == SK_Fixed1/2); x = SkFixedSqrt(SK_Fixed1*4); REPORTER_ASSERT(reporter, x == SK_Fixed1*2); - + x = SkFractSqrt(SK_Fract1); REPORTER_ASSERT(reporter, x == SK_Fract1); x = SkFractSqrt(SK_Fract1/4); REPORTER_ASSERT(reporter, x == SK_Fract1/2); x = SkFractSqrt(SK_Fract1/16); REPORTER_ASSERT(reporter, x == SK_Fract1/4); - + for (i = 1; i < 100; i++) { x = SkFixedSqrt(SK_Fixed1 * i * i); REPORTER_ASSERT(reporter, x == SK_Fixed1 * i); } - + for (i = 0; i < 1000; i++) { int value = rand.nextS16(); int max = rand.nextU16(); - + int clamp = SkClampMax(value, max); int clamp2 = value < 0 ? 0 : (value > max ? max : value); REPORTER_ASSERT(reporter, clamp == clamp2); } - + for (i = 0; i < 100000; i++) { SkPoint p; - + p.setLength(rand.nextS(), rand.nextS(), SK_Scalar1); check_length(reporter, p, SK_Scalar1); p.setLength(rand.nextS() >> 13, rand.nextS() >> 13, SK_Scalar1); check_length(reporter, p, SK_Scalar1); } - + { SkFixed result = SkFixedDiv(100, 100); REPORTER_ASSERT(reporter, result == SK_Fixed1); result = SkFixedDiv(1, SK_Fixed1); REPORTER_ASSERT(reporter, result == 1); } - + #ifdef SK_CAN_USE_FLOAT unittest_fastfloat(reporter); #endif - + #ifdef SkLONGLONG for (i = 0; i < 100000; i++) { SkFixed numer = rand.nextS(); SkFixed denom = rand.nextS(); SkFixed result = SkFixedDiv(numer, denom); SkLONGLONG check = ((SkLONGLONG)numer << 16) / denom; - + (void)SkCLZ(numer); (void)SkCLZ(denom); - + REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32); if (check > SK_MaxS32) { check = SK_MaxS32; @@ -273,10 +272,10 @@ static void TestMath(skiatest::Reporter* reporter) { check = SK_MinS32; } REPORTER_ASSERT(reporter, result == (int32_t)check); - + result = SkFractDiv(numer, denom); check = ((SkLONGLONG)numer << 30) / denom; - + REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32); if (check > SK_MaxS32) { check = SK_MaxS32; @@ -284,61 +283,65 @@ static void TestMath(skiatest::Reporter* reporter) { check = SK_MinS32; } REPORTER_ASSERT(reporter, result == (int32_t)check); - + // make them <= 2^24, so we don't overflow in fixmul numer = numer << 8 >> 8; denom = denom << 8 >> 8; - + result = SkFixedMul(numer, denom); SkFixed r2 = symmetric_fixmul(numer, denom); // SkASSERT(result == r2); - + result = SkFixedMul(numer, numer); r2 = SkFixedSquare(numer); REPORTER_ASSERT(reporter, result == r2); - + #ifdef SK_CAN_USE_FLOAT if (numer >= 0 && denom >= 0) { SkFixed mean = SkFixedMean(numer, denom); - float fm = sk_float_sqrt(sk_float_abs(SkFixedToFloat(numer) * SkFixedToFloat(denom))); + float prod = SkFixedToFloat(numer) * SkFixedToFloat(denom); + float fm = sk_float_sqrt(sk_float_abs(prod)); SkFixed mean2 = SkFloatToFixed(fm); int diff = SkAbs32(mean - mean2); REPORTER_ASSERT(reporter, diff <= 1); } - + { SkFixed mod = SkFixedMod(numer, denom); float n = SkFixedToFloat(numer); float d = SkFixedToFloat(denom); float m = sk_float_mod(n, d); - REPORTER_ASSERT(reporter, mod == 0 || (mod < 0) == (m < 0)); // ensure the same sign + // ensure the same sign + REPORTER_ASSERT(reporter, mod == 0 || (mod < 0) == (m < 0)); int diff = SkAbs32(mod - SkFloatToFixed(m)); REPORTER_ASSERT(reporter, (diff >> 7) == 0); } #endif } #endif - + #ifdef SK_CAN_USE_FLOAT for (i = 0; i < 100000; i++) { SkFract x = rand.nextU() >> 1; double xx = (double)x / SK_Fract1; SkFract xr = SkFractSqrt(x); SkFract check = SkFloatToFract(sqrt(xx)); - REPORTER_ASSERT(reporter, xr == check || xr == check-1 || xr == check+1); - + REPORTER_ASSERT(reporter, xr == check || + xr == check-1 || + xr == check+1); + xr = SkFixedSqrt(x); xx = (double)x / SK_Fixed1; check = SkFloatToFixed(sqrt(xx)); REPORTER_ASSERT(reporter, xr == check || xr == check-1); - + xr = SkSqrt32(x); xx = (double)x; check = (int32_t)sqrt(xx); REPORTER_ASSERT(reporter, xr == check || xr == check-1); } #endif - + #if !defined(SK_SCALAR_IS_FLOAT) && defined(SK_CAN_USE_FLOAT) { SkFixed s, c; @@ -346,21 +349,21 @@ static void TestMath(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, s == 0); REPORTER_ASSERT(reporter, c == SK_Fixed1); } - + int maxDiff = 0; for (i = 0; i < 10000; i++) { SkFixed rads = rand.nextS() >> 10; double frads = SkFixedToFloat(rads); - + SkFixed s, c; s = SkScalarSinCos(rads, &c); - + double fs = sin(frads); double fc = cos(frads); - + SkFixed is = SkFloatToFixed(fs); SkFixed ic = SkFloatToFixed(fc); - + maxDiff = SkMax32(maxDiff, SkAbs32(is - s)); maxDiff = SkMax32(maxDiff, SkAbs32(ic - c)); } diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 659672a109..68e587bd49 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -23,7 +23,7 @@ static bool nearly_equal(const SkMatrix& a, const SkMatrix& b) { static bool is_identity(const SkMatrix& m) { SkMatrix identity; - identity.reset(); + identity.reset(); return nearly_equal(m, identity); } @@ -54,7 +54,7 @@ void TestMatrix(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, is_identity(iden1)); iden2.setConcat(inverse, mat); REPORTER_ASSERT(reporter, is_identity(iden2)); - + // rectStaysRect test { static const struct { @@ -79,10 +79,10 @@ void TestMatrix(skiatest::Reporter* reporter) { { SK_Scalar1, SK_Scalar1, SK_Scalar1, 0, false }, { SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1, false } }; - + for (size_t i = 0; i < SK_ARRAY_COUNT(gRectStaysRectSamples); i++) { SkMatrix m; - + m.reset(); m.set(SkMatrix::kMScaleX, gRectStaysRectSamples[i].m00); m.set(SkMatrix::kMSkewX, gRectStaysRectSamples[i].m01); diff --git a/tests/PackBitsTest.cpp b/tests/PackBitsTest.cpp index 22de3c3b1d..729467e343 100644 --- a/tests/PackBitsTest.cpp +++ b/tests/PackBitsTest.cpp @@ -23,7 +23,7 @@ static void test_pack16(skiatest::Reporter* reporter) { { gTest2, SK_ARRAY_COUNT(gTest2) }, { gTest3, SK_ARRAY_COUNT(gTest3) } }; - + for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); i++) { uint8_t dst[100]; size_t dstSize = SkPackBits::Pack16(gTests[i].fSrc, @@ -34,7 +34,7 @@ static void test_pack16(skiatest::Reporter* reporter) { gTests[i].fCount * sizeof(uint16_t)) == 0; REPORTER_ASSERT(reporter, match); } - + for (int n = 1000; n; n--) { size_t size = 50; uint16_t src[100], src2[100]; @@ -74,7 +74,7 @@ static void test_pack8(skiatest::Reporter* reporter) { { gTest83, SK_ARRAY_COUNT(gTest83) }, { gTest84, SK_ARRAY_COUNT(gTest84) } }; - + for (size_t i = 4; i < SK_ARRAY_COUNT(gTests); i++) { uint8_t dst[100]; size_t maxSize = SkPackBits::ComputeMaxSize8(gTests[i].fCount); @@ -103,7 +103,7 @@ static void test_pack8(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, size == srcCount); bool match = memcmp(src, src2, size * sizeof(uint8_t)) == 0; REPORTER_ASSERT(reporter, match); - + for (int j = 0; j < 200; j++) { size_t skip = gRand.nextU() % size; size_t write = gRand.nextU() % size; diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 0e44719220..c17fa45955 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -4,7 +4,7 @@ static void TestPath(skiatest::Reporter* reporter) { SkPath p, p2; SkRect bounds, bounds2; - + REPORTER_ASSERT(reporter, p.isEmpty()); REPORTER_ASSERT(reporter, p.getFillType() == SkPath::kWinding_FillType); REPORTER_ASSERT(reporter, !p.isInverseFillType()); @@ -12,7 +12,7 @@ static void TestPath(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, !(p != p2)); REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); - + bounds.set(0, 0, SK_Scalar1, SK_Scalar1); p.addRect(bounds); REPORTER_ASSERT(reporter, bounds == p.getBounds()); @@ -27,7 +27,7 @@ static void TestPath(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, count == 4); bounds2.set(pts, 4); REPORTER_ASSERT(reporter, bounds == bounds2); - + bounds.offset(SK_Scalar1*3, SK_Scalar1*4); p.offset(SK_Scalar1*3, SK_Scalar1*4); REPORTER_ASSERT(reporter, bounds == p.getBounds()); @@ -37,7 +37,7 @@ static void TestPath(skiatest::Reporter* reporter) { bounds.setEmpty(); REPORTER_ASSERT(reporter, p.isRect(&bounds2)); REPORTER_ASSERT(reporter, bounds == bounds2); - + // now force p to not be a rect bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2); p.addRect(bounds); diff --git a/tests/Sk64Test.cpp b/tests/Sk64Test.cpp index 503395708d..9fb49ebbed 100644 --- a/tests/Sk64Test.cpp +++ b/tests/Sk64Test.cpp @@ -183,7 +183,7 @@ static void TestSk64(skiatest::Reporter* reporter) { else dfixdiv = SkFloatToFixed(dnumer / ddenom); diff = fixdiv - dfixdiv; - + if (SkAbs32(diff) > 1) { SkDebugf(" %d === numer %g denom %g div %g xdiv %x fxdiv %x\n", i, dnumer, ddenom, ddiv, dfixdiv, fixdiv); diff --git a/tests/SrcOverTest.cpp b/tests/SrcOverTest.cpp index cf429de48e..497b3a81e1 100644 --- a/tests/SrcOverTest.cpp +++ b/tests/SrcOverTest.cpp @@ -21,7 +21,7 @@ static void test_srcover_hack(skiatest::Reporter* reporter) { /* Here's the idea. Can we ensure that when we blend on top of an opaque dst, that the result always stay's opaque (i.e. exactly 255)? */ - + unsigned i; int opaqueCounter0 = 0; int opaqueCounter1 = 0; @@ -42,7 +42,7 @@ static void test_srcover_hack(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, opaqueCounter0 == 129); REPORTER_ASSERT(reporter, opaqueCounter1 == 256); REPORTER_ASSERT(reporter, opaqueCounter2 == 256); - + // Now ensure that we never over/underflow a byte for (i = 0; i <= 255; i++) { for (unsigned dst = 0; dst <= 255; dst++) { @@ -56,11 +56,12 @@ static void test_srcover_hack(skiatest::Reporter* reporter) { } REPORTER_ASSERT(reporter, r1 <= 255 && r1 >= max); REPORTER_ASSERT(reporter, r2 <= 255 && r2 >= max); - + #if 0 // this shows where r1 (faster) differs from r2 (more exact) if (r1 != r2) { - SkDebugf("--- dst=%d i=%d r1=%d r2=%d exact=%g\n", dst, i, r1, r2, i + dst - dst*i/255.0f); + SkDebugf("--- dst=%d i=%d r1=%d r2=%d exact=%g\n", + dst, i, r1, r2, i + dst - dst*i/255.0f); } #endif } diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp index 704ab4a6a1..e62f2ed5a0 100644 --- a/tests/StreamTest.cpp +++ b/tests/StreamTest.cpp @@ -29,14 +29,15 @@ static void test_buffer(skiatest::Reporter* reporter) { 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); + REPORTER_ASSERT(reporter, + memcmp(storage + bytesRead, storage2, ss) == 0); bytesRead += ss; } REPORTER_ASSERT(reporter, bytesRead == size); @@ -45,16 +46,16 @@ static void test_buffer(skiatest::Reporter* reporter) { } static void TestRStream(skiatest::Reporter* reporter) { - static const char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + static const char s[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; char copy[sizeof(s)]; SkRandom rand; - - for (int i = 0; i < 65; i++) - { + + 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)); @@ -64,42 +65,24 @@ static void TestRStream(skiatest::Reporter* reporter) { 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(); +static void TestWStream(skiatest::Reporter* reporter) { + SkDynamicMemoryWStream ds; + const char s[] = "abcdefghijklmnopqrstuvwxyz"; + int i; + for (i = 0; i < 100; i++) { + REPORTER_ASSERT(reporter, ds.write(s, 26)); } - - { - 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; + 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) { diff --git a/tests/Test.h b/tests/Test.h index 8d2eb87468..d5dc9e39ea 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -6,7 +6,7 @@ #include "SkTRegistry.h" namespace skiatest { - + class Test; class Reporter : public SkRefCnt { @@ -19,7 +19,7 @@ namespace skiatest { ///// kLastResult = kFailed }; - + void resetReporting(); int countTests() const { return fTestCount; } int countResults(Result r) { @@ -30,7 +30,7 @@ namespace skiatest { void startTest(Test*); void report(const char testDesc[], Result); void endTest(Test*); - + // helpers for tests void assertTrue(bool cond, const char desc[]) { if (!cond) { @@ -48,35 +48,35 @@ namespace skiatest { void reportFailed(const SkString& desc) { this->report(desc.c_str(), kFailed); } - + protected: virtual void onStart(Test*) {} virtual void onReport(const char desc[], Result) {} virtual void onEnd(Test*) {} - + private: Test* fCurrTest; int fTestCount; int fResultCount[kLastResult+1]; - + typedef SkRefCnt INHERITED; }; - + class Test { - public: + public: Test(); virtual ~Test(); Reporter* getReporter() const { return fReporter; } void setReporter(Reporter*); - + const char* getName(); void run(); - + protected: virtual void onGetName(SkString*) = 0; virtual void onRun(Reporter*) = 0; - + private: Reporter* fReporter; SkString fName; diff --git a/tests/TestClassDef.h b/tests/TestClassDef.h index 77f48b3b46..0773f5a31e 100644 --- a/tests/TestClassDef.h +++ b/tests/TestClassDef.h @@ -1,12 +1,12 @@ -/* This file is meant be including by .cpp files, so it can spew out a +/* This file is meant to be included by .cpp files, so it can spew out a customized class + global definition. - + e.g. #include "TestClassDef.h" DEFINE_TESTCLASS("MyTest", MyTestClass, MyTestFunction) - + where MyTestFunction is declared as - + void MyTestFunction(skiatest::Reporter*) */ diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp index f6b02112f0..8a8319c74b 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -55,9 +55,9 @@ static void test_utf16(skiatest::Reporter* reporter) { static const SkUnichar gUni[] = { 0x10000, 0x18080, 0x20202, 0xFFFFF, 0x101234 }; - + uint16_t buf[2]; - + for (size_t i = 0; i < SK_ARRAY_COUNT(gUni); i++) { size_t count = SkUTF16_FromUnichar(gUni[i], buf); REPORTER_ASSERT(reporter, count == 2); @@ -100,7 +100,7 @@ static void TestUTF(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, p - gTest[i].fUtf8 == (int)strlen(gTest[i].fUtf8)); } - + test_utf16(reporter); test_search(reporter); } diff --git a/tests/testmain.cpp b/tests/testmain.cpp index 57d7c041a2..2e16de3355 100644 --- a/tests/testmain.cpp +++ b/tests/testmain.cpp @@ -12,11 +12,11 @@ public: r->ref(); fReg = TestRegistry::Head(); } - + ~Iter() { fReporter->unref(); } - + Test* next() { if (fReg) { TestRegistry::Factory fact = fReg->factory(); @@ -27,7 +27,7 @@ public: } return NULL; } - + static int Count() { const TestRegistry* reg = TestRegistry::Head(); int count = 0; @@ -37,7 +37,7 @@ public: } return count; } - + private: Reporter* fReporter; const TestRegistry* fReg; @@ -81,7 +81,7 @@ int main (int argc, char * const argv[]) { DebugfReporter reporter; Iter iter(&reporter); Test* test; - + const int count = Iter::Count(); int index = 0; while ((test = iter.next()) != NULL) { |