diff options
author | tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-12 21:11:12 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-12 21:11:12 +0000 |
commit | e4fafb146e85cdfcf9d5418597b6818aa0754ada (patch) | |
tree | ef3f70bafc7797cd75f3fe4daf7a0ed9108b89a9 | |
parent | 0682019f2161af00168bb1984918753f2a1c1e54 (diff) |
Use DEFINE_TESTCLASS_SHORT macro in tests.
The three version of DEFINE_TESTCLASS macro is deprecated and thus just
use the simple, short one.
BUG=None
TEST=out/Debug/tests
R=mtklein@google.com, bsalomon@google.com, robertphillips@google.com
Review URL: https://codereview.chromium.org/100113004
git-svn-id: http://skia.googlecode.com/svn/trunk@12653 2bbb7eff-a529-9590-31e7-b0007b416f81
93 files changed, 262 insertions, 506 deletions
diff --git a/tests/AnnotationTest.cpp b/tests/AnnotationTest.cpp index 5429b58912..db33afa6ab 100644 --- a/tests/AnnotationTest.cpp +++ b/tests/AnnotationTest.cpp @@ -6,6 +6,7 @@ * found in the LICENSE file. */ #include "Test.h" +#include "TestClassDef.h" #include "SkAnnotation.h" #include "SkData.h" #include "SkCanvas.h" @@ -24,7 +25,7 @@ static bool ContainsString(const char* data, size_t dataSize, const char* needle return false; } -static void test_nodraw(skiatest::Reporter* reporter) { +DEF_TEST(Annotation_NoDraw, reporter) { SkBitmap bm; bm.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); bm.allocPixels(); @@ -45,7 +46,7 @@ struct testCase { bool expectAnnotations; }; -static void test_pdf_link_annotations(skiatest::Reporter* reporter) { +DEF_TEST(Annotation_PdfLink, reporter) { SkISize size = SkISize::Make(612, 792); SkMatrix initialTransform; initialTransform.reset(); @@ -73,7 +74,7 @@ static void test_pdf_link_annotations(skiatest::Reporter* reporter) { } } -static void test_named_destination_annotations(skiatest::Reporter* reporter) { +DEF_TEST(Annotation_NamedDestination, reporter) { SkISize size = SkISize::Make(612, 792); SkMatrix initialTransform; initialTransform.reset(); @@ -94,12 +95,3 @@ static void test_named_destination_annotations(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, ContainsString(rawOutput, out->size(), "/example ")); } - -static void TestAnnotation(skiatest::Reporter* reporter) { - test_nodraw(reporter); - test_pdf_link_annotations(reporter); - test_named_destination_annotations(reporter); -} - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Annotation", AnnotationClass, TestAnnotation) diff --git a/tests/AtomicTest.cpp b/tests/AtomicTest.cpp index a9ab8d2279..b7b13b3fab 100644 --- a/tests/AtomicTest.cpp +++ b/tests/AtomicTest.cpp @@ -5,10 +5,11 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkThread.h" #include "SkThreadUtils.h" #include "SkTypes.h" -#include "Test.h" struct AddInfo { int32_t valueToAdd; @@ -31,7 +32,7 @@ static void addABunchOfTimes(void* data) { } } -static void test_atomicAddTests(skiatest::Reporter* reporter) { +DEF_TEST(Atomic, reporter) { int32_t total = base; SkThread* threads[SK_ARRAY_COUNT(gAdds)]; for (size_t i = 0; i < SK_ARRAY_COUNT(gAdds); i++) { @@ -55,6 +56,3 @@ static void test_atomicAddTests(skiatest::Reporter* reporter) { const int32_t originalValue = valueToModify; REPORTER_ASSERT(reporter, originalValue == sk_atomic_add(&valueToModify, 7)); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("AtomicAdd", AtomicAddTestClass, test_atomicAddTests) diff --git a/tests/BitSetTest.cpp b/tests/BitSetTest.cpp index 7139495217..bdfe9978e6 100644 --- a/tests/BitSetTest.cpp +++ b/tests/BitSetTest.cpp @@ -1,14 +1,15 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkBitSet.h" -static void TestBitSet(skiatest::Reporter* reporter) { +DEF_TEST(BitSet, reporter) { SkBitSet set0(65536); REPORTER_ASSERT(reporter, set0.isBitSet(0) == false); REPORTER_ASSERT(reporter, set0.isBitSet(32767) == false); @@ -74,6 +75,3 @@ static void TestBitSet(skiatest::Reporter* reporter) { set2 = set2; REPORTER_ASSERT(reporter, set2 == set3); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("BitSet", BitSetTest, TestBitSet) diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index f61d55e953..0df8c06d9b 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -6,6 +6,7 @@ * found in the LICENSE file. */ #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkRect.h" @@ -204,7 +205,7 @@ static void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) { setPixel(coords[i]->fX, coords[i]->fY, i, bm); } -static void TestBitmapCopy(skiatest::Reporter* reporter) { +DEF_TEST(BitmapCopy, reporter) { static const Pair gPairs[] = { { SkBitmap::kNo_Config, "0000000" }, { SkBitmap::kA8_Config, "0101010" }, @@ -550,6 +551,3 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) { } // for (size_t copyCase ... } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy) diff --git a/tests/BitmapGetColorTest.cpp b/tests/BitmapGetColorTest.cpp index 40aa3e26bf..7fc584fc29 100644 --- a/tests/BitmapGetColorTest.cpp +++ b/tests/BitmapGetColorTest.cpp @@ -6,11 +6,12 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkRect.h" #include "SkRandom.h" -static void TestGetColor(skiatest::Reporter* reporter) { +DEF_TEST(GetColor, reporter) { static const struct Rec { SkBitmap::Config fConfig; SkColor fInColor; @@ -45,6 +46,3 @@ static void TestGetColor(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, c == gRec[i].fOutColor); } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("GetColor", TestGetColorClass, TestGetColor) diff --git a/tests/BitmapHeapTest.cpp b/tests/BitmapHeapTest.cpp index 34a2984d40..2b5cf830c5 100644 --- a/tests/BitmapHeapTest.cpp +++ b/tests/BitmapHeapTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2012 Google Inc. * @@ -15,6 +14,7 @@ #include "SkRefCnt.h" #include "SkShader.h" #include "Test.h" +#include "TestClassDef.h" class FlatDictionary : public SkFlatDictionary<SkShader> { @@ -37,7 +37,7 @@ public: } }; -static void TestBitmapHeap(skiatest::Reporter* reporter) { +DEF_TEST(BitmapHeap, reporter) { // Create a bitmap shader. SkBitmap bm; bm.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); @@ -91,6 +91,3 @@ static void TestBitmapHeap(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, heap.count() == 1); REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0)) == 0); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("BitmapHeap", TestBitmapHeapClass, TestBitmapHeap) diff --git a/tests/BlitRowTest.cpp b/tests/BlitRowTest.cpp index 85761104b2..d0518bfb1d 100644 --- a/tests/BlitRowTest.cpp +++ b/tests/BlitRowTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -262,10 +263,7 @@ static void test_diagonal(skiatest::Reporter* reporter) { } } -static void TestBlitRow(skiatest::Reporter* reporter) { +DEF_TEST(BlitRow, reporter) { test_00_FF(reporter); test_diagonal(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("BlitRow", TestBlitRowClass, TestBlitRow) diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp index 7cba71e726..854300907a 100644 --- a/tests/CanvasStateTest.cpp +++ b/tests/CanvasStateTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2013 Google Inc. * @@ -7,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkCanvasStateUtils.h" @@ -227,14 +227,9 @@ static void test_soft_clips(skiatest::Reporter* reporter) { SkClearLastError(); } -//////////////////////////////////////////////////////////////////////////////// - -static void test_canvas_state_utils(skiatest::Reporter* reporter) { +DEF_TEST(CanvasState, reporter) { test_complex_layers(reporter); test_complex_clips(reporter); test_draw_filters(reporter); test_soft_clips(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("CanvasState", TestCanvasStateClass, test_canvas_state_utils) diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index 6d9fa1a671..744eafcf80 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -63,6 +63,7 @@ #include "SkStream.h" #include "SkTDArray.h" #include "Test.h" +#include "TestClassDef.h" class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { public: @@ -901,7 +902,7 @@ static void TestOverrideStateConsistency(skiatest::Reporter* reporter, } } -static void TestCanvas(skiatest::Reporter* reporter) { +DEF_TEST(Canvas, reporter) { // Init global here because bitmap pixels cannot be alocated during // static initialization kTestBitmap = testBitmap(); @@ -918,6 +919,3 @@ static void TestCanvas(skiatest::Reporter* reporter) { // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap is a global) kTestBitmap.reset(); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Canvas", TestCanvasClass, TestCanvas) diff --git a/tests/ClampRangeTest.cpp b/tests/ClampRangeTest.cpp index 1d6bcd21ff..a9a59acb6a 100644 --- a/tests/ClampRangeTest.cpp +++ b/tests/ClampRangeTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "gradients/SkClampRange.h" #include "SkRandom.h" @@ -80,6 +81,7 @@ static void slow_check(const SkClampRange& range, } } + static void test_range(SkFixed fx, SkFixed dx, int count) { SkClampRange range; range.init(fx, dx, count, V0, V1); @@ -88,8 +90,7 @@ static void test_range(SkFixed fx, SkFixed dx, int count) { #define ff(x) SkIntToFixed(x) -void TestClampRange(skiatest::Reporter* reporter); -void TestClampRange(skiatest::Reporter* reporter) { +DEF_TEST(ClampRange, reporter) { gReporter = reporter; test_range(0, 0, 20); @@ -126,10 +127,3 @@ void TestClampRange(skiatest::Reporter* reporter) { test_range(fx, dx, count); } } - -#ifdef USE_REPORTER - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ClampRange", ClampRangeClass, TestClampRange) - -#endif diff --git a/tests/ClipCubicTest.cpp b/tests/ClipCubicTest.cpp index 82eeee3ef5..829b7b6e0e 100644 --- a/tests/ClipCubicTest.cpp +++ b/tests/ClipCubicTest.cpp @@ -1,12 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "Test.h" +#include "Test.h" +#include "TestClassDef.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkCubicClipper.h" @@ -69,7 +69,7 @@ static SkPoint* SetCurve(float x0, float y0, } -static void TestCubicClipping(skiatest::Reporter* reporter) { +DEF_TEST(ClipCubic, reporter) { static SkPoint crv[4] = { { SkIntToScalar(0), SkIntToScalar(0) }, { SkIntToScalar(2), SkIntToScalar(3) }, @@ -163,9 +163,3 @@ static void TestCubicClipping(skiatest::Reporter* reporter) { test_giantClip(); } - - - - -#include "TestClassDef.h" -DEFINE_TESTCLASS("CubicClipper", CubicClippingTestClass, TestCubicClipping) diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 704aa6244b..05f9fcaaa3 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #if SK_SUPPORT_GPU #include "GrReducedClip.h" #endif @@ -15,7 +16,6 @@ #include "SkRect.h" #include "SkRegion.h" - static void test_assign_and_comparison(skiatest::Reporter* reporter) { SkClipStack s; bool doAA = false; @@ -1159,9 +1159,8 @@ static void test_reduced_clip_stack_no_aa_crash(skiatest::Reporter* reporter) { } #endif -/////////////////////////////////////////////////////////////////////////////////////////////////// -static void TestClipStack(skiatest::Reporter* reporter) { +DEF_TEST(ClipStack, reporter) { SkClipStack stack; REPORTER_ASSERT(reporter, 0 == stack.getSaveCount()); @@ -1210,6 +1209,3 @@ static void TestClipStack(skiatest::Reporter* reporter) { test_reduced_clip_stack_no_aa_crash(reporter); #endif } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ClipStack", TestClipStackClass, TestClipStack) diff --git a/tests/ClipperTest.cpp b/tests/ClipperTest.cpp index a81e6559f9..6f2e0af4f2 100644 --- a/tests/ClipperTest.cpp +++ b/tests/ClipperTest.cpp @@ -1,16 +1,17 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" -#include "SkPath.h" -#include "SkLineClipper.h" +#include "TestClassDef.h" +#include "SkCanvas.h" #include "SkEdgeClipper.h" +#include "SkLineClipper.h" +#include "SkPath.h" -#include "SkCanvas.h" static void test_hairclipping(skiatest::Reporter* reporter) { SkBitmap bm; bm.setConfig(SkBitmap::kARGB_8888_Config, 4, 4); @@ -144,11 +145,8 @@ static void test_intersectline(skiatest::Reporter* reporter) { } -static void TestClipper(skiatest::Reporter* reporter) { +DEF_TEST(Clipper, reporter) { test_intersectline(reporter); test_edgeclipper(); test_hairclipping(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Clipper", TestClipperClass, TestClipper) diff --git a/tests/ColorFilterTest.cpp b/tests/ColorFilterTest.cpp index 544c9f0f25..8444b73a1d 100644 --- a/tests/ColorFilterTest.cpp +++ b/tests/ColorFilterTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkColor.h" #include "SkColorPriv.h" #include "SkColorFilter.h" @@ -32,7 +33,7 @@ static SkColorFilter* reincarnate_colorfilter(SkFlattenable* obj) { #define ILLEGAL_MODE ((SkXfermode::Mode)-1) -static void test_asColorMode(skiatest::Reporter* reporter) { +DEF_TEST(ColorFilter, reporter) { SkRandom rand; for (int mode = 0; mode <= SkXfermode::kLastMode; mode++) { @@ -93,7 +94,7 @@ static void test_asColorMode(skiatest::Reporter* reporter) { /////////////////////////////////////////////////////////////////////////////// -static void test_lumaColorFilter(skiatest::Reporter* reporter) { +DEF_TEST(LumaColorFilter, reporter) { SkPMColor in, out; SkAutoTUnref<SkColorFilter> lf(SkLumaColorFilter::Create()); @@ -125,7 +126,3 @@ static void test_lumaColorFilter(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, SkGetPackedB32(out) == 0); } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ColorFilter", ColorFilterTestClass, test_asColorMode) -DEFINE_TESTCLASS("LumaColorFilter", LumaColorFilterTestClass, test_lumaColorFilter) diff --git a/tests/ColorTest.cpp b/tests/ColorTest.cpp index 30dad88e24..6b1d7d7028 100644 --- a/tests/ColorTest.cpp +++ b/tests/ColorTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkColor.h" #include "SkColorPriv.h" #include "SkMathPriv.h" @@ -76,12 +77,9 @@ static inline void test_fast_interp(skiatest::Reporter* reporter) { } } -static void TestColor(skiatest::Reporter* reporter) { +DEF_TEST(Color, reporter) { test_premul(reporter); //test_interp(reporter); test_fast_interp(reporter); -// test_565blend(); + //test_565blend(); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Color", ColorTestClass, TestColor) diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index c32c4553ca..b31bfcdd5c 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkData.h" #include "SkDataTable.h" #include "SkOrderedReadBuffer.h" @@ -133,7 +134,7 @@ static void test_globaltable(skiatest::Reporter* reporter) { } } -static void TestDataTable(skiatest::Reporter* reporter) { +DEF_TEST(DataTable, reporter) { test_emptytable(reporter); test_simpletable(reporter); test_vartable(reporter); @@ -206,7 +207,7 @@ static void test_files(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r2->data()), s, 26) == 0); } -static void TestData(skiatest::Reporter* reporter) { +DEF_TEST(Data, reporter) { const char* str = "We the people, in order to form a more perfect union."; const int N = 10; @@ -234,7 +235,3 @@ static void TestData(skiatest::Reporter* reporter) { test_cstring(reporter); test_files(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Data", DataTestClass, TestData) -DEFINE_TESTCLASS("DataTable", DataTableTestClass, TestDataTable) diff --git a/tests/DequeTest.cpp b/tests/DequeTest.cpp index 62e8e4db7d..d3e1c175fe 100644 --- a/tests/DequeTest.cpp +++ b/tests/DequeTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkDeque.h" static void assert_count(skiatest::Reporter* reporter, const SkDeque& deq, int count) { @@ -161,11 +162,9 @@ static void TestSub(skiatest::Reporter* reporter, int allocCount) { assert_blocks(reporter, deq, allocCount); } -static void TestDeque(skiatest::Reporter* reporter) { +DEF_TEST(Deque, reporter) { // test it once with the default allocation count TestSub(reporter, 1); // test it again with a generous allocation count TestSub(reporter, 10); } -#include "TestClassDef.h" -DEFINE_TESTCLASS("Deque", TestDequeClass, TestDeque) diff --git a/tests/DeviceLooperTest.cpp b/tests/DeviceLooperTest.cpp index 23e9d1503b..2dc94107c3 100644 --- a/tests/DeviceLooperTest.cpp +++ b/tests/DeviceLooperTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkDeviceLooper.h" #include "SkRasterClip.h" @@ -133,10 +134,7 @@ static void test_complex(skiatest::Reporter* reporter) { } } -static void TestDeviceLooper(skiatest::Reporter* reporter) { +DEF_TEST(DeviceLooper, reporter) { test_simple(reporter); test_complex(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("DeviceLooper", DeviceLooperClass, TestDeviceLooper) diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp index 642e2cedb9..f2e4837c63 100644 --- a/tests/DrawBitmapRectTest.cpp +++ b/tests/DrawBitmapRectTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkData.h" @@ -308,7 +309,7 @@ static void create(SkBitmap* bm, SkBitmap::Config config, SkColor color) { bm->eraseColor(color); } -static void TestDrawBitmapRect(skiatest::Reporter* reporter) { +DEF_TEST(DrawBitmapRect, reporter) { SkBitmap src, dst; create(&src, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); @@ -330,6 +331,3 @@ static void TestDrawBitmapRect(skiatest::Reporter* reporter) { test_treatAsSprite(reporter); test_faulty_pixelref(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("DrawBitmapRect", TestDrawBitmapRectClass, TestDrawBitmapRect) diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp index 40f4a047b2..9a49adfff4 100644 --- a/tests/DrawPathTest.cpp +++ b/tests/DrawPathTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkDashPathEffect.h" @@ -305,7 +306,7 @@ static void test_crbug_165432(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, filteredPath.isEmpty()); } -static void TestDrawPath(skiatest::Reporter* reporter) { +DEF_TEST(DrawPath, reporter) { test_giantaa(); test_bug533(); test_bigcubic(); @@ -319,6 +320,3 @@ static void TestDrawPath(skiatest::Reporter* reporter) { test_crbug_165432(reporter); test_big_aa_rect(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("DrawPath", TestDrawPathClass, TestDrawPath) diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp index b1bb19de65..768c93603d 100644 --- a/tests/DrawTextTest.cpp +++ b/tests/DrawTextTest.cpp @@ -4,17 +4,16 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkTypes.h" #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColor.h" #include "SkPaint.h" #include "SkPoint.h" #include "SkRect.h" - -/////////////////////////////////////////////////////////////////////////////// +#include "SkTypes.h" static const SkColor bgColor = SK_ColorWHITE; @@ -62,8 +61,7 @@ static bool compare(const SkBitmap& ref, const SkIRect& iref, return true; } -static void test_drawText(skiatest::Reporter* reporter) { - +DEF_TEST(DrawText, reporter) { SkPaint paint; paint.setColor(SK_ColorGRAY); paint.setTextSize(SkIntToScalar(20)); @@ -110,6 +108,3 @@ static void test_drawText(skiatest::Reporter* reporter) { } } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("DrawText_DrawPosText", DrawTextTestClass, test_drawText) diff --git a/tests/DynamicHashTest.cpp b/tests/DynamicHashTest.cpp index f502dbae70..5e92ace308 100644 --- a/tests/DynamicHashTest.cpp +++ b/tests/DynamicHashTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkTDynamicHash.h" namespace { @@ -139,12 +140,9 @@ static void test_remove(skiatest::Reporter* reporter) { ASSERT(hash.find(5)->value == 3.0); } -static void test_dynamic_hash(skiatest::Reporter* reporter) { +DEF_TEST(DynamicHash, reporter) { test_growth(reporter); test_add(reporter); test_lookup(reporter); test_remove(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("DynamicHash", DynamicHashTestClass, test_dynamic_hash); diff --git a/tests/EmptyPathTest.cpp b/tests/EmptyPathTest.cpp index 153af1f50a..fa1fd7f489 100644 --- a/tests/EmptyPathTest.cpp +++ b/tests/EmptyPathTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkPath.h" #include "SkCanvas.h" @@ -148,9 +149,6 @@ static void test_emptydrawing(skiatest::Reporter* reporter) { } } -static void TestEmptyPath(skiatest::Reporter* reporter) { +DEF_TEST(EmptyPath, reporter) { test_emptydrawing(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("EmptyPath", TestEmptyPathClass, TestEmptyPath) diff --git a/tests/ErrorTest.cpp b/tests/ErrorTest.cpp index 2d10640c68..9dca9d87d5 100644 --- a/tests/ErrorTest.cpp +++ b/tests/ErrorTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2013 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkError.h" #include "SkPath.h" #include "SkRect.h" @@ -27,7 +28,7 @@ static void cb(SkError err, void *context) { REPORTER_ASSERT( context_ptr->fReporter, (*(context_ptr->fIntPointer) == 0xdeadbeef) ); } -static void ErrorTest(skiatest::Reporter* reporter) { +DEF_TEST(Error, reporter) { SkError err; unsigned int test_value = 0xdeadbeef; @@ -59,6 +60,3 @@ static void ErrorTest(skiatest::Reporter* reporter) { CHECK(kInvalidArgument_SkError); CHECK(kNoError_SkError); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Error", ErrorTestClass, ErrorTest) diff --git a/tests/FillPathTest.cpp b/tests/FillPathTest.cpp index e0f3cf4490..ef0f5bfe32 100644 --- a/tests/FillPathTest.cpp +++ b/tests/FillPathTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkRegion.h" #include "SkPath.h" #include "SkScan.h" @@ -26,7 +27,7 @@ struct FakeBlitter : public SkBlitter { // http://code.google.com/p/skia/issues/detail?id=87 // Lines which is not clipped by boundary based clipping, // but skipped after tessellation, should be cleared by the blitter. -static void TestFillPathInverse(skiatest::Reporter* reporter) { +DEF_TEST(FillPathInverse, reporter) { FakeBlitter blitter; SkIRect clip; SkPath path; @@ -43,6 +44,3 @@ static void TestFillPathInverse(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, blitter.m_blitCount == expected_lines); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("FillPath", FillPathTestClass, TestFillPathInverse) diff --git a/tests/FitsInTest.cpp b/tests/FitsInTest.cpp index 365d7ea3d4..b66d53b519 100644 --- a/tests/FitsInTest.cpp +++ b/tests/FitsInTest.cpp @@ -6,14 +6,15 @@ */ #include "Test.h" - +#include "TestClassDef.h" #include "SkTypes.h" #include "SkTFitsIn.h" + #include <limits> #define TEST(S, s, D, expected) REPORTER_ASSERT(reporter, (SkTFitsIn<D>((S)(s)) == (expected))) -static void FitsInTest(skiatest::Reporter* reporter) { +DEF_TEST(FitsIn, reporter) { TEST(int32_t, 1, int8_t, true); TEST(int32_t, -1, int8_t, true); TEST(int32_t, (int32_t)(std::numeric_limits<int8_t>::max)(), int8_t, true); @@ -67,6 +68,3 @@ static void FitsInTest(skiatest::Reporter* reporter) { // Uncommenting the following should cause compile failures. //TEST(float, 1, uint64_t, true); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("FitsIn", FitsInTestClass, FitsInTest) diff --git a/tests/FlatDataTest.cpp b/tests/FlatDataTest.cpp index 79f94b39ed..5393a7834e 100644 --- a/tests/FlatDataTest.cpp +++ b/tests/FlatDataTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2012 Google Inc. * @@ -6,6 +5,8 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColor.h" @@ -15,7 +16,6 @@ #include "SkPictureFlat.h" #include "SkShader.h" #include "SkXfermode.h" -#include "Test.h" static void flattenFlattenableProc(SkOrderedWriteBuffer& buffer, const void* obj) { @@ -48,7 +48,7 @@ static void testCreate(skiatest::Reporter* reporter, const void* obj, REPORTER_ASSERT(reporter, *data1 == *data2); } -static void Tests(skiatest::Reporter* reporter) { +DEF_TEST(FlatData, reporter) { // Test flattening SkShader SkPoint points[2]; points[0].set(0, 0); @@ -85,5 +85,3 @@ static void Tests(skiatest::Reporter* reporter) { testCreate(reporter, xfer, &flattenFlattenableProc); } -#include "TestClassDef.h" -DEFINE_TESTCLASS("FlatData", FlatDataClass, Tests) diff --git a/tests/FlateTest.cpp b/tests/FlateTest.cpp index 879973fc90..8d5f015979 100644 --- a/tests/FlateTest.cpp +++ b/tests/FlateTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2011 Google Inc. * @@ -6,11 +5,11 @@ * found in the LICENSE file. */ - #include <stdlib.h> #include <string.h> #include "Test.h" +#include "TestClassDef.h" #include "SkData.h" #include "SkFlate.h" #include "SkStream.h" @@ -85,7 +84,7 @@ static void TestFlate(skiatest::Reporter* reporter, SkMemoryStream* testStream, testData.getLength()) == 0); } -static void TestFlateCompression(skiatest::Reporter* reporter) { +DEF_TEST(Flate, reporter) { TestFlate(reporter, NULL, 0); #if defined(SK_ZLIB_INCLUDE) && !defined(SK_DEBUG) REPORTER_ASSERT(reporter, SkFlate::HaveFlate()); @@ -99,6 +98,3 @@ static void TestFlateCompression(skiatest::Reporter* reporter) { TestFlate(reporter, &fileStream, 10240); #endif } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Flate", FlateTestClass, TestFlateCompression) diff --git a/tests/FontHostStreamTest.cpp b/tests/FontHostStreamTest.cpp index e15bd5a355..b9f39b3110 100644 --- a/tests/FontHostStreamTest.cpp +++ b/tests/FontHostStreamTest.cpp @@ -4,9 +4,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkTypes.h" #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColor.h" @@ -17,8 +17,7 @@ #include "SkRect.h" #include "SkStream.h" #include "SkTypeface.h" - -/////////////////////////////////////////////////////////////////////////////// +#include "SkTypes.h" static const SkColor bgColor = SK_ColorWHITE; @@ -66,8 +65,7 @@ static bool compare(const SkBitmap& ref, const SkIRect& iref, return true; } -static void test_fontHostStream(skiatest::Reporter* reporter) { - +DEF_TEST(FontHostStream, reporter) { { SkPaint paint; paint.setColor(SK_ColorGRAY); @@ -112,6 +110,3 @@ static void test_fontHostStream(skiatest::Reporter* reporter) { //Make sure the typeface is deleted and removed. SkGraphics::PurgeFontCache(); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("FontHost::CreateTypefaceFromStream", FontHostStreamTestClass, test_fontHostStream) diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp index a7ecc5a9dc..500f8598de 100644 --- a/tests/FontHostTest.cpp +++ b/tests/FontHostTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkPaint.h" #include "SkFontStream.h" #include "SkOSFile.h" @@ -305,13 +306,10 @@ static void test_advances(skiatest::Reporter* reporter) { } } -static void TestFontHost(skiatest::Reporter* reporter) { +DEF_TEST(FontHost, reporter) { test_tables(reporter); test_fontstream(reporter); test_advances(reporter); } // need tests for SkStrSearch - -#include "TestClassDef.h" -DEFINE_TESTCLASS("FontHost", FontHostTestClass, TestFontHost) diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp index 9b683f72c3..8ecdecc43f 100644 --- a/tests/FontMgrTest.cpp +++ b/tests/FontMgrTest.cpp @@ -6,7 +6,7 @@ */ #include "Test.h" - +#include "TestClassDef.h" #include "SkCommandLineFlags.h" #include "SkFontMgr.h" #include "SkTypeface.h" @@ -77,10 +77,7 @@ static void test_fontiter(skiatest::Reporter* reporter, bool verbose) { DEFINE_bool(verboseFontMgr, false, "run verbose fontmgr tests."); -static void TestFontMgr(skiatest::Reporter* reporter) { +DEF_TEST(FontMgr, reporter) { test_fontiter(reporter, FLAGS_verboseFontMgr); test_alias_names(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("FontMgr", FontMgrClass, TestFontMgr) diff --git a/tests/FontNamesTest.cpp b/tests/FontNamesTest.cpp index 42d9ca9f51..adbf81347d 100644 --- a/tests/FontNamesTest.cpp +++ b/tests/FontNamesTest.cpp @@ -6,7 +6,7 @@ */ #include "Test.h" - +#include "TestClassDef.h" #include "SkCommandLineFlags.h" #include "SkFontMgr.h" #include "SkOTTable_name.h" @@ -218,10 +218,7 @@ static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) { DEFINE_bool(verboseFontNames, false, "verbose FontNames test."); -static void TestFontNames(skiatest::Reporter* reporter) { +DEF_TEST(FontNames, reporter) { test_synthetic(reporter, FLAGS_verboseFontNames); test_systemfonts(reporter, FLAGS_verboseFontNames); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("FontNames", FontNamesTestClass, TestFontNames) diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp index 420718ff7a..3693fa5536 100644 --- a/tests/FrontBufferedStreamTest.cpp +++ b/tests/FrontBufferedStreamTest.cpp @@ -5,11 +5,12 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkFrontBufferedStream.h" #include "SkRefCnt.h" #include "SkStream.h" #include "SkTypes.h" -#include "Test.h" static void test_read(skiatest::Reporter* reporter, SkStream* bufferedStream, const void* expectations, size_t bytesToRead) { @@ -150,12 +151,9 @@ static void test_buffers(skiatest::Reporter* reporter, size_t bufferSize) { test_read_beyond_buffer(reporter, bufferSize); } -static void TestStreams(skiatest::Reporter* reporter) { +DEF_TEST(FrontBufferedStream, reporter) { // Test 6 and 64, which are used by Android, as well as another arbitrary length. test_buffers(reporter, 6); test_buffers(reporter, 15); test_buffers(reporter, 64); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("FrontBufferedStream", FrontBufferedStreamTestClass, TestStreams) diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp index 69d980ac8b..b090c89ec0 100644 --- a/tests/GeometryTest.cpp +++ b/tests/GeometryTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkGeometry.h" static bool nearly_equal(const SkPoint& a, const SkPoint& b) { @@ -33,8 +34,7 @@ static void testChopCubic(skiatest::Reporter* reporter) { } } - -static void TestGeometry(skiatest::Reporter* reporter) { +DEF_TEST(Geometry, reporter) { SkPoint pts[3], dst[5]; pts[0].set(0, 0); @@ -60,6 +60,3 @@ static void TestGeometry(skiatest::Reporter* reporter) { testChopCubic(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Geometry", GeometryTestClass, TestGeometry) diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp index 5919b44d68..c9dac9b497 100644 --- a/tests/GifTest.cpp +++ b/tests/GifTest.cpp @@ -11,13 +11,14 @@ (!defined(SK_BUILD_FOR_IOS)) && \ (!defined(SK_BUILD_FOR_MAC)) +#include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkData.h" #include "SkForceLinking.h" -#include "SkImageDecoder.h" #include "SkImage.h" +#include "SkImageDecoder.h" #include "SkStream.h" -#include "Test.h" __SK_FORCE_IMAGE_DECODER_LINKING; @@ -147,7 +148,7 @@ static void test_gif_data_short(skiatest::Reporter* r, GIF files which have been mangled somehow. We want to display as much of the GIF as possible. */ -static void TestGif(skiatest::Reporter* reporter) { +DEF_TEST(Gif, reporter) { // test perfectly good images. test_gif_data(reporter, static_cast<void *>(gifData), sizeof(gifData)); test_interlaced_gif_data(reporter, static_cast<void *>(interlacedGif), @@ -204,7 +205,4 @@ static void TestGif(skiatest::Reporter* reporter) { // "libgif warning [interlace DGifGetLine]" } -#include "TestClassDef.h" -DEFINE_TESTCLASS("GifTest", GifTestClass, TestGif) - #endif // !(SK_BUILD_FOR_WIN32||SK_BUILD_FOR_IOS||SK_BUILD_FOR_MAC) diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp index 3f719e6422..9d974ab2f5 100644 --- a/tests/GrMemoryPoolTest.cpp +++ b/tests/GrMemoryPoolTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" // This is a GPU-backend specific test #if SK_SUPPORT_GPU #include "GrMemoryPool.h" @@ -182,7 +183,7 @@ struct Rec { int fValue; }; -static void test_memory_pool(skiatest::Reporter* reporter) { +DEF_TEST(GrMemoryPool, reporter) { // prealloc and min alloc sizes for the pool static const size_t gSizes[][2] = { {0, 0}, @@ -239,7 +240,4 @@ static void test_memory_pool(skiatest::Reporter* reporter) { } } -#include "TestClassDef.h" -DEFINE_TESTCLASS("GrMemoryPool", GrMemoryPoolClass, test_memory_pool) - #endif diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp index 24ffb53151..1f77fbb0b0 100644 --- a/tests/GradientTest.cpp +++ b/tests/GradientTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkBitmapDevice.h" #include "SkColorShader.h" #include "SkEmptyShader.h" @@ -192,9 +193,7 @@ static void TestGradientShaders(skiatest::Reporter* reporter) { } } -static void TestGradients(skiatest::Reporter* reporter) { +DEF_TEST(Gradient, reporter) { TestGradientShaders(reporter); TestConstantGradient(reporter); } -#include "TestClassDef.h" -DEFINE_TESTCLASS("Gradients", TestGradientsClass, TestGradients) diff --git a/tests/HashCacheTest.cpp b/tests/HashCacheTest.cpp index 1a5c4701cd..437a80c6b7 100644 --- a/tests/HashCacheTest.cpp +++ b/tests/HashCacheTest.cpp @@ -5,8 +5,8 @@ * found in the LICENSE file. */ - #include "Test.h" +#include "TestClassDef.h" // This is a GR test #if SK_SUPPORT_GPU @@ -59,9 +59,7 @@ protected: int fKey; }; -//////////////////////////////////////////////////////////////////////////////// -static void TestHashCache(skiatest::Reporter* reporter) { - +DEF_TEST(HashCache, reporter) { GrTHashTable<HashElement, HashKey, 4> cache; HashElement negHashElements[10] = { @@ -154,8 +152,4 @@ static void TestHashCache(skiatest::Reporter* reporter) { } } -//////////////////////////////////////////////////////////////////////////////// -#include "TestClassDef.h" -DEFINE_TESTCLASS("HashCache", HashCacheTestClass, TestHashCache) - #endif diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp index 8f1591f708..6087b7f37f 100644 --- a/tests/ImageCacheTest.cpp +++ b/tests/ImageCacheTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkDiscardableMemory.h" #include "SkScaledImageCache.h" @@ -85,7 +86,7 @@ static SkDiscardableMemory* pool_factory(size_t bytes) { return gPool->create(bytes); } -static void TestImageCache(skiatest::Reporter* reporter) { +DEF_TEST(ImageCache, reporter) { static const size_t defLimit = DIM * DIM * 4 * COUNT + 1024; // 1K slop { @@ -104,9 +105,6 @@ static void TestImageCache(skiatest::Reporter* reporter) { } } -#include "TestClassDef.h" -DEFINE_TESTCLASS("ImageCache", TestImageCacheClass, TestImageCache) - DEF_TEST(ImageCache_doubleAdd, r) { // Adding the same key twice should be safe. SkScaledImageCache cache(1024); diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index be8626f0f6..f840129b1c 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -5,6 +5,8 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColor.h" @@ -19,7 +21,6 @@ #include "SkShader.h" #include "SkStream.h" #include "SkString.h" -#include "Test.h" __SK_FORCE_IMAGE_DECODER_LINKING; @@ -228,14 +229,10 @@ extern void test_row_proc_choice(); #endif // SK_DEBUG -static void test_imageDecodingTests(skiatest::Reporter* reporter) { +DEF_TEST(ImageDecoding, reporter) { test_unpremul(reporter); #ifdef SK_DEBUG test_stream_life(); test_row_proc_choice(); #endif } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ImageDecoding", ImageDecodingTestClass, - test_imageDecodingTests) diff --git a/tests/InfRectTest.cpp b/tests/InfRectTest.cpp index 4d957dcf75..3d964bdccf 100644 --- a/tests/InfRectTest.cpp +++ b/tests/InfRectTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkRect.h" @@ -57,7 +58,7 @@ static void check_invalid(skiatest::Reporter* reporter, // Tests that isFinite() will reject any rect with +/-inf values // as one of its coordinates. -static void TestInfRect(skiatest::Reporter* reporter) { +DEF_TEST(InfRect, reporter) { #ifdef SK_SCALAR_IS_FLOAT float inf = 1 / make_zero(); // infinity float nan = inf * 0; @@ -86,6 +87,3 @@ static void TestInfRect(skiatest::Reporter* reporter) { } // need tests for SkStrSearch - -#include "TestClassDef.h" -DEFINE_TESTCLASS("InfRect", InfRectTestClass, TestInfRect) diff --git a/tests/JpegTest.cpp b/tests/JpegTest.cpp index ac2ec8a02d..4d00eece2a 100644 --- a/tests/JpegTest.cpp +++ b/tests/JpegTest.cpp @@ -5,13 +5,14 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkData.h" #include "SkForceLinking.h" #include "SkImageDecoder.h" #include "SkImage.h" #include "SkStream.h" -#include "Test.h" __SK_FORCE_IMAGE_DECODER_LINKING; @@ -417,7 +418,7 @@ static const int goodJpegImageHeight = 128; Jpeg files which have been mangled somehow. We want to display as much of the jpeg as possible. */ -static void TestJpeg(skiatest::Reporter* reporter) { +DEF_TEST(Jpeg, reporter) { size_t len = sizeof(goodJpegImage) / 2; // I am explicitly not putting the entire image into the // DecodeMemory. This simulates a network error. @@ -447,6 +448,3 @@ static void TestJpeg(skiatest::Reporter* reporter) { SkASSERT(writeSuccess); #endif } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("JpegTest", JpegTestClass, TestJpeg) diff --git a/tests/LListTest.cpp b/tests/LListTest.cpp index 128b11ed5b..dc7b37741b 100644 --- a/tests/LListTest.cpp +++ b/tests/LListTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkTInternalLList.h" #include "SkTLList.h" @@ -310,10 +311,7 @@ static void TestTLList(skiatest::Reporter* reporter) { } } -static void test_llists(skiatest::Reporter* reporter) { +DEF_TEST(LList, reporter) { TestTInternalLList(reporter); TestTLList(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("LList", TestLListClass, test_llists) diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp index 11ac48869f..01ebca1464 100644 --- a/tests/LayerDrawLooperTest.cpp +++ b/tests/LayerDrawLooperTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkBitmapDevice.h" #include "SkCanvas.h" @@ -145,11 +146,8 @@ static void test_mixed(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, !looper->next(&canvas, &paint)); } -static void TestLayerDrawLooper(skiatest::Reporter* reporter) { +DEF_TEST(LayerDrawLooper, reporter) { test_frontToBack(reporter); test_backToFront(reporter); test_mixed(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("LayerDrawLooper", TestLayerDrawLooperClass, TestLayerDrawLooper) diff --git a/tests/MD5Test.cpp b/tests/MD5Test.cpp index 9b9e756aa8..ed9f69cd8d 100644 --- a/tests/MD5Test.cpp +++ b/tests/MD5Test.cpp @@ -4,7 +4,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkMD5.h" static bool digests_equal(const SkMD5::Digest& expectedDigest, const SkMD5::Digest& computedDigest) { @@ -58,11 +60,8 @@ static struct MD5Test { { "12345678901234567890123456789012345678901234567890123456789012345678901234567890", {{ 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55, 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a }} }, }; -static void TestMD5(skiatest::Reporter* reporter) { +DEF_TEST(MD5, reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(md5_tests); ++i) { md5_test(md5_tests[i].message, md5_tests[i].digest, reporter); } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("MD5", MD5TestClass, TestMD5) diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp index f5c61cbeb8..22680c13e6 100644 --- a/tests/MathTest.cpp +++ b/tests/MathTest.cpp @@ -1,17 +1,19 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" +#include "SkColorPriv.h" +#include "SkEndian.h" #include "SkFloatBits.h" #include "SkFloatingPoint.h" #include "SkMathPriv.h" #include "SkPoint.h" #include "SkRandom.h" -#include "SkColorPriv.h" static void test_clz(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 32 == SkCLZ(0)); @@ -430,7 +432,7 @@ static void test_copysign(skiatest::Reporter* reporter) { } } -static void TestMath(skiatest::Reporter* reporter) { +DEF_TEST(Math, reporter) { int i; int32_t x; SkRandom rand; @@ -646,19 +648,12 @@ static void TestMath(skiatest::Reporter* reporter) { test_clz(reporter); } -#include "TestClassDef.h" -DEFINE_TESTCLASS("Math", MathTestClass, TestMath) - -/////////////////////////////////////////////////////////////////////////////// - -#include "SkEndian.h" - template <typename T> struct PairRec { T fYin; T fYang; }; -static void TestEndian(skiatest::Reporter* reporter) { +DEF_TEST(TestEndian, reporter) { static const PairRec<uint16_t> g16[] = { { 0x0, 0x0 }, { 0xFFFF, 0xFFFF }, @@ -690,8 +685,6 @@ static void TestEndian(skiatest::Reporter* reporter) { } } -DEFINE_TESTCLASS("Endian", EndianTestClass, TestEndian) - template <typename T> static void test_divmod(skiatest::Reporter* r) { const struct { diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp index 51a6e7f950..afd2762a7a 100644 --- a/tests/Matrix44Test.cpp +++ b/tests/Matrix44Test.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkMatrix44.h" static bool nearly_equal_double(double a, double b) { @@ -528,7 +529,7 @@ static void test_3x3_conversion(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, nearly_equal_scalar(vec4transformed[3], vec4transformed2[3])); } -static void TestMatrix44(skiatest::Reporter* reporter) { +DEF_TEST(Matrix44, reporter) { SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); SkMatrix44 inverse(SkMatrix44::kUninitialized_Constructor); SkMatrix44 iden1(SkMatrix44::kUninitialized_Constructor); @@ -634,6 +635,3 @@ static void TestMatrix44(skiatest::Reporter* reporter) { test_map2(reporter); test_3x3_conversion(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Matrix44", Matrix44TestClass, TestMatrix44) diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 9f4babfed9..a6d4edabc0 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkMath.h" #include "SkMatrix.h" #include "SkMatrixUtils.h" @@ -689,7 +690,7 @@ static void test_matrix_homogeneous(skiatest::Reporter* reporter) { } -static void TestMatrix(skiatest::Reporter* reporter) { +DEF_TEST(Matrix, reporter) { SkMatrix mat, inverse, iden1, iden2; mat.reset(); @@ -812,6 +813,3 @@ static void TestMatrix(skiatest::Reporter* reporter) { test_matrix_decomposition(reporter); test_matrix_homogeneous(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Matrix", MatrixTestClass, TestMatrix) diff --git a/tests/MemsetTest.cpp b/tests/MemsetTest.cpp index 9da7850cc3..36d0f0a467 100644 --- a/tests/MemsetTest.cpp +++ b/tests/MemsetTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkChunkAlloc.h" #include "SkUtils.h" @@ -115,12 +116,9 @@ static void test_32(skiatest::Reporter* reporter) { * For performance considerations, implementations may take different paths * depending on the alignment of the dst, and/or the size of the count. */ -static void TestMemset(skiatest::Reporter* reporter) { +DEF_TEST(Memset, reporter) { test_16(reporter); test_32(reporter); test_chunkalloc(reporter); -}; - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Memset", TestMemsetClass, TestMemset) +} diff --git a/tests/MetaDataTest.cpp b/tests/MetaDataTest.cpp index 439065236a..4512045d23 100644 --- a/tests/MetaDataTest.cpp +++ b/tests/MetaDataTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkMetaData.h" static void test_ptrs(skiatest::Reporter* reporter) { @@ -34,7 +35,7 @@ static void test_ptrs(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 1 == ref.getRefCnt()); } -static void TestMetaData(skiatest::Reporter* reporter) { +DEF_TEST(MetaData, reporter) { SkMetaData m1; REPORTER_ASSERT(reporter, !m1.findS32("int")); @@ -114,6 +115,3 @@ static void TestMetaData(skiatest::Reporter* reporter) { test_ptrs(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("MetaData", TestMetaDataClass, TestMetaData) diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp index 398827367a..ed62219af1 100644 --- a/tests/MipMapTest.cpp +++ b/tests/MipMapTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkMipMap.h" #include "SkBitmap.h" #include "SkRandom.h" @@ -20,7 +21,7 @@ static void make_bitmap(SkBitmap* bm, SkRandom& rand) { bm->eraseColor(SK_ColorWHITE); } -static void TestMipMap(skiatest::Reporter* reporter) { +DEF_TEST(MipMap, reporter) { SkBitmap bm; SkRandom rand; @@ -54,6 +55,3 @@ static void TestMipMap(skiatest::Reporter* reporter) { } } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("MipMap", MipMapTestClass, TestMipMap) diff --git a/tests/OSPathTest.cpp b/tests/OSPathTest.cpp index 5ae32ebc0d..e0d7b9d410 100644 --- a/tests/OSPathTest.cpp +++ b/tests/OSPathTest.cpp @@ -5,9 +5,10 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkString.h" #include "SkOSFile.h" -#include "Test.h" /** * Test SkPathJoin and SkBasename. @@ -50,7 +51,7 @@ static void test_dir_with_file(skiatest::Reporter* reporter, SkString dir, REPORTER_ASSERT(reporter, basename.equals(filename)); } -static void test_os_path_utils_tests(skiatest::Reporter* reporter) { +DEF_TEST(OSPath, reporter) { SkString dir("dir"); SkString filename("file"); test_dir_with_file(reporter, dir, filename); @@ -83,6 +84,3 @@ static void test_os_path_utils_tests(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, emptyPath.size() == 1); REPORTER_ASSERT(reporter, emptyPath.contains(SkPATH_SEPARATOR)); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("OSPath", OSPathTestClass, test_os_path_utils_tests) diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp index 0d623a13bb..9b9569d367 100644 --- a/tests/PDFPrimitivesTest.cpp +++ b/tests/PDFPrimitivesTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2010 The Android Open Source Project * @@ -7,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkData.h" @@ -346,7 +346,7 @@ static void test_issue1083() { doc.emitPDF(&stream); } -static void TestPDFPrimitives(skiatest::Reporter* reporter) { +DEF_TEST(PDFPrimitives, reporter) { SkAutoTUnref<SkPDFInt> int42(new SkPDFInt(42)); SimpleCheckObjectOutput(reporter, int42.get(), "42"); @@ -432,6 +432,3 @@ static void TestPDFPrimitives(skiatest::Reporter* reporter) { TestImages(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("PDFPrimitives", PDFPrimitivesTestClass, TestPDFPrimitives) diff --git a/tests/PackBitsTest.cpp b/tests/PackBitsTest.cpp index f7d4b8e6b1..8a6ed88f67 100644 --- a/tests/PackBitsTest.cpp +++ b/tests/PackBitsTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkPackBits.h" static const uint16_t gTest0[] = { 0, 0, 1, 1 }; @@ -125,10 +126,7 @@ static void test_pack8(skiatest::Reporter* reporter) { } } -static void TestPackBits(skiatest::Reporter* reporter) { +DEF_TEST(PackBits, reporter) { test_pack8(reporter); test_pack16(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("PackBits", PackBitsTestClass, TestPackBits) diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index 03c93d44c9..eed9de3a5c 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkBlurMask.h" #include "SkBlurMaskFilter.h" #include "SkLayerDrawLooper.h" @@ -235,7 +236,7 @@ static void regression_measureText(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, r.isEmpty()); } -static void TestPaint(skiatest::Reporter* reporter) { +DEF_TEST(Paint, reporter) { // TODO add general paint tests test_copy(reporter); @@ -251,6 +252,3 @@ static void TestPaint(skiatest::Reporter* reporter) { test_cmap(reporter); } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Paint", TestPaintClass, TestPaint) diff --git a/tests/ParsePathTest.cpp b/tests/ParsePathTest.cpp index 4d0fdba2b8..3ade1a765b 100644 --- a/tests/ParsePathTest.cpp +++ b/tests/ParsePathTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkParsePath.h" static void test_to_from(skiatest::Reporter* reporter, const SkPath& path) { @@ -38,7 +39,7 @@ static struct { 6, 6.5f } } }; -static void TestParsePath(skiatest::Reporter* reporter) { +DEF_TEST(ParsePath, reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { SkPath path; bool success = SkParsePath::FromSVGString(gRec[i].fStr, &path); @@ -60,6 +61,3 @@ static void TestParsePath(skiatest::Reporter* reporter) { p.addRoundRect(r, 4, 4.5f); test_to_from(reporter, p); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ParsePath", ParsePathClass, TestParsePath) diff --git a/tests/PathCoverageTest.cpp b/tests/PathCoverageTest.cpp index 97708bbc90..ede1fdc64e 100644 --- a/tests/PathCoverageTest.cpp +++ b/tests/PathCoverageTest.cpp @@ -1,14 +1,15 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + +#include "Test.h" +#include "TestClassDef.h" #include "SkMath.h" #include "SkPoint.h" #include "SkScalar.h" -#include "Test.h" /* Duplicates lots of code from gpu/src/GrPathUtils.cpp @@ -160,10 +161,7 @@ static void TestQuadPointCount(skiatest::Reporter* reporter) { one_d_pe(gRibbon, SK_ARRAY_COUNT(gRibbon), reporter); } -static void TestPathCoverage(skiatest::Reporter* reporter) { +DEF_TEST(PathCoverage, reporter) { TestQuadPointCount(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("PathCoverage", PathCoverageTestClass, TestPathCoverage) diff --git a/tests/PathMeasureTest.cpp b/tests/PathMeasureTest.cpp index c9acb7ea00..5c92ca1686 100644 --- a/tests/PathMeasureTest.cpp +++ b/tests/PathMeasureTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkPathMeasure.h" static void test_small_segment3() { @@ -79,7 +80,7 @@ static void test_small_segment() { #endif } -static void TestPathMeasure(skiatest::Reporter* reporter) { +DEF_TEST(PathMeasure, reporter) { SkPath path; path.moveTo(0, 0); @@ -207,6 +208,3 @@ static void TestPathMeasure(skiatest::Reporter* reporter) { test_small_segment2(); test_small_segment3(); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("PathMeasure", PathMeasureTestClass, TestPathMeasure) diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 06ecff6281..bea3ea5ab8 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkPath.h" @@ -3179,7 +3180,7 @@ public: } }; -static void TestPath(skiatest::Reporter* reporter) { +DEF_TEST(Path, reporter) { SkTSize<SkScalar>::Make(3,4); SkPath p, empty; @@ -3298,6 +3299,3 @@ static void TestPath(skiatest::Reporter* reporter) { test_contains(reporter); PathTest_Private::TestPathTo(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Path", PathTestClass, TestPath) diff --git a/tests/PathUtilsTest.cpp b/tests/PathUtilsTest.cpp index fad5cae0bb..a147487cfc 100644 --- a/tests/PathUtilsTest.cpp +++ b/tests/PathUtilsTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2013 Google Inc. * @@ -6,13 +5,13 @@ * found in the LICENSE file. */ -#include "SkPathUtils.h" - +#include "Test.h" +#include "TestClassDef.h" #include "SkBitmap.h" #include "SkCanvas.h" +#include "SkPathUtils.h" #include "SkRandom.h" #include "SkTime.h" -#include "Test.h" const int kNumIt = 100; @@ -130,7 +129,7 @@ static void test_region(skiatest::Reporter* reporter, const SkBitmap* truth, test_path_eq(reporter, &path, truth, w, h); } -static void TestPathUtils(skiatest::Reporter* reporter) { +DEF_TEST(PathUtils, reporter) { const int w[] = {4, 8, 12, 16}; const int h = 8, rowBytes = 4; @@ -154,6 +153,3 @@ static void TestPathUtils(skiatest::Reporter* reporter) { } } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("PathUtils", PathUtils, TestPathUtils) diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index 9ef4bb06bd..49717972d4 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -4,7 +4,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -651,7 +653,7 @@ static void test_hierarchical(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, parentWBWB.willPlayBackBitmaps()); // 2 } -static void TestPicture(skiatest::Reporter* reporter) { +DEF_TEST(Picture, reporter) { #ifdef SK_DEBUG test_deleting_empty_playback(); test_serializing_empty_picture(); @@ -666,6 +668,3 @@ static void TestPicture(skiatest::Reporter* reporter) { test_clip_expansion(reporter); test_hierarchical(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Pictures", PictureTestClass, TestPicture) diff --git a/tests/PictureUtilsTest.cpp b/tests/PictureUtilsTest.cpp index bb01bc902f..65771c3467 100644 --- a/tests/PictureUtilsTest.cpp +++ b/tests/PictureUtilsTest.cpp @@ -4,7 +4,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "picture_utils.h" #include "SkString.h" @@ -45,10 +47,7 @@ static void test_get_basename(skiatest::Reporter* reporter) { #endif } -static void TestPictureUtils(skiatest::Reporter* reporter) { +DEF_TEST(PictureUtils, reporter) { test_filepath_creation(reporter); test_get_basename(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("PictureUtils", PictureUtilsTestClass, TestPictureUtils) diff --git a/tests/PipeTest.cpp b/tests/PipeTest.cpp index acf288ae8d..e18b3ae192 100644 --- a/tests/PipeTest.cpp +++ b/tests/PipeTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2012 Google Inc. * @@ -6,13 +5,14 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SamplePipeControllers.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkGPipe.h" #include "SkPaint.h" #include "SkShader.h" -#include "Test.h" // Ensures that the pipe gracefully handles drawing an invalid bitmap. static void testDrawingBadBitmap(SkCanvas* pipeCanvas) { @@ -43,7 +43,7 @@ static void testDrawingAfterEndRecording(SkCanvas* canvas) { pipeCanvas->drawBitmap(bm, 0, 0); } -static void test_pipeTests(skiatest::Reporter*) { +DEF_TEST(Pipe, reporter) { SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, 64, 64); SkCanvas canvas(bitmap); @@ -56,6 +56,3 @@ static void test_pipeTests(skiatest::Reporter*) { testDrawingAfterEndRecording(&canvas); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("PipeTest", PipeTestClass, test_pipeTests) diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp index 9d87bffebc..d9e555d63b 100644 --- a/tests/QuickRejectTest.cpp +++ b/tests/QuickRejectTest.cpp @@ -5,9 +5,10 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkCanvas.h" #include "SkDrawLooper.h" -#include "Test.h" /* * Subclass of looper that just draws once, with an offset in X. @@ -76,9 +77,6 @@ static void test_drawBitmap(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 0xFFFFFFFF == *dst.getAddr32(5, 5)); } -static void test(skiatest::Reporter* reporter) { +DEF_TEST(QuickReject, reporter) { test_drawBitmap(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("QuickReject", QuickRejectClass, test) diff --git a/tests/RTreeTest.cpp b/tests/RTreeTest.cpp index a907d6d588..beff03c650 100644 --- a/tests/RTreeTest.cpp +++ b/tests/RTreeTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2012 Google Inc. * @@ -7,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkRTree.h" #include "SkTSort.h" @@ -139,7 +139,7 @@ static void rtree_test_main(SkRTree* rtree, skiatest::Reporter* reporter) { } } -static void test_rtree(skiatest::Reporter* reporter) { +DEF_TEST(RTree, reporter) { SkRTree* rtree = SkRTree::Create(MIN_CHILDREN, MAX_CHILDREN); SkAutoUnref au(rtree); rtree_test_main(rtree, reporter); @@ -149,7 +149,3 @@ static void test_rtree(skiatest::Reporter* reporter) { SkAutoUnref auo(unsortedRtree); rtree_test_main(unsortedRtree, reporter); } - - -#include "TestClassDef.h" -DEFINE_TESTCLASS("RTree", RTreeTestClass, test_rtree) diff --git a/tests/RandomTest.cpp b/tests/RandomTest.cpp index c9fee4aa23..536e388d4e 100644 --- a/tests/RandomTest.cpp +++ b/tests/RandomTest.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2013 Google Inc. * @@ -7,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkTSort.h" @@ -178,7 +178,7 @@ static void test_range(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, chi_square_test(bins, 10000)); } -static void TestRandom(skiatest::Reporter* reporter) { +DEF_TEST(Random, reporter) { // check uniform distributions of each byte in 32-bit word test_random_byte(reporter, 0); test_random_byte(reporter, 8); @@ -191,6 +191,3 @@ static void TestRandom(skiatest::Reporter* reporter) { test_range(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Random", RandomTestClass, TestRandom) diff --git a/tests/Reader32Test.cpp b/tests/Reader32Test.cpp index d81287bd74..b7a7c6ddc9 100644 --- a/tests/Reader32Test.cpp +++ b/tests/Reader32Test.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2011 Google Inc. * @@ -6,10 +5,9 @@ * found in the LICENSE file. */ - - -#include "SkReader32.h" #include "Test.h" +#include "TestClassDef.h" +#include "SkReader32.h" static void assert_eof(skiatest::Reporter* reporter, const SkReader32& reader) { REPORTER_ASSERT(reporter, reader.eof()); @@ -35,7 +33,7 @@ static void assert_empty(skiatest::Reporter* reporter, const SkReader32& reader) assert_start(reporter, reader); } -static void Tests(skiatest::Reporter* reporter) { +DEF_TEST(Reader32, reporter) { SkReader32 reader; assert_empty(reporter, reader); REPORTER_ASSERT(reporter, NULL == reader.base()); @@ -82,6 +80,3 @@ static void Tests(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, NULL == reader.base()); REPORTER_ASSERT(reporter, NULL == reader.peek()); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Reader32", Reader32Class, Tests) diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp index ed771e77f8..d844596fe0 100644 --- a/tests/RefCntTest.cpp +++ b/tests/RefCntTest.cpp @@ -5,15 +5,13 @@ * found in the LICENSE file. */ -#include "SkTypes.h" #include "Test.h" - +#include "TestClassDef.h" #include "SkRefCnt.h" +#include "SkTRefArray.h" #include "SkThreadUtils.h" +#include "SkTypes.h" #include "SkWeakRefCnt.h" -#include "SkTRefArray.h" - -/////////////////////////////////////////////////////////////////////////////// class InstCounterClass { public: @@ -143,11 +141,8 @@ static void test_weakRefCnt(skiatest::Reporter* reporter) { ref->unref(); } -static void test_refCntTests(skiatest::Reporter* reporter) { +DEF_TEST(RefCnt, reporter) { test_refCnt(reporter); test_weakRefCnt(reporter); test_refarray(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("RefCnt", RefCntTestClass, test_refCntTests) diff --git a/tests/RefDictTest.cpp b/tests/RefDictTest.cpp index 7d33f9b802..96492ead4d 100644 --- a/tests/RefDictTest.cpp +++ b/tests/RefDictTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkRefDict.h" class TestRC : public SkRefCnt { @@ -15,7 +16,7 @@ private: typedef SkRefCnt INHERITED; }; -static void TestRefDict(skiatest::Reporter* reporter) { +DEF_TEST(RefDict, reporter) { TestRC data0, data1; SkRefDict dict; @@ -72,6 +73,3 @@ static void TestRefDict(skiatest::Reporter* reporter) { // be sure d's destructor lowered data0's owner count back to 1 REPORTER_ASSERT(reporter, 1 == data0.getRefCnt()); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("RefDict", RefDictTestClass, TestRefDict) diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp index 5d3946ebfe..4d423db07b 100644 --- a/tests/RegionTest.cpp +++ b/tests/RegionTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkRegion.h" #include "SkRandom.h" @@ -222,7 +223,7 @@ static bool test_rects(const SkIRect rect[], int count) { return true; } -static void TestRegion(skiatest::Reporter* reporter) { +DEF_TEST(Region, reporter) { const SkIRect r2[] = { { 0, 0, 1, 1 }, { 2, 2, 3, 3 }, @@ -254,6 +255,3 @@ static void TestRegion(skiatest::Reporter* reporter) { test_empties(reporter); test_fromchrome(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Region", RegionTestClass, TestRegion) diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp index 7cadf01871..57c93ae900 100644 --- a/tests/RoundRectTest.cpp +++ b/tests/RoundRectTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkMatrix.h" #include "SkRRect.h" @@ -553,7 +554,7 @@ static void test_round_rect_transform(skiatest::Reporter* reporter) { } } -static void TestRoundRect(skiatest::Reporter* reporter) { +DEF_TEST(RoundRect, reporter) { test_round_rect_basic(reporter); test_round_rect_rects(reporter); test_round_rect_ovals(reporter); @@ -563,6 +564,3 @@ static void TestRoundRect(skiatest::Reporter* reporter) { test_round_rect_contains_rect(reporter); test_round_rect_transform(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("RoundRect", TestRoundRectClass, TestRoundRect) diff --git a/tests/SHA1Test.cpp b/tests/SHA1Test.cpp index dde828cb51..87849b2c8a 100644 --- a/tests/SHA1Test.cpp +++ b/tests/SHA1Test.cpp @@ -4,7 +4,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkSHA1.h" static bool digests_equal(const SkSHA1::Digest& expectedDigest, const SkSHA1::Digest& computedDigest) { @@ -45,11 +47,8 @@ static void sha1_test(const SHA1Test& test, skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, digests_equal(test.digest, digest)); } -static void TestSHA1(skiatest::Reporter* reporter) { +DEF_TEST(SHA1, reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(sha1_tests); ++i) { sha1_test(sha1_tests[i], reporter); } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("SHA1", SHA1TestClass, TestSHA1) diff --git a/tests/ScalarTest.cpp b/tests/ScalarTest.cpp index 8a166454d6..47d3226343 100644 --- a/tests/ScalarTest.cpp +++ b/tests/ScalarTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkFloatingPoint.h" #include "SkMath.h" #include "SkPoint.h" @@ -187,9 +188,6 @@ static void test_isfinite(skiatest::Reporter* reporter) { #pragma warning ( pop ) #endif -static void TestScalar(skiatest::Reporter* reporter) { +DEF_TEST(Scalar, reporter) { test_isfinite(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Scalar", TestScalarClass, TestScalar) diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index 7ae06d737e..bb05432427 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -5,6 +5,8 @@ * found in the LICENSE file. */ +#include "Test.h" +#include "TestClassDef.h" #include "SkBitmapDevice.h" #include "SkBitmapSource.h" #include "SkCanvas.h" @@ -12,7 +14,6 @@ #include "SkOrderedWriteBuffer.h" #include "SkValidatingReadBuffer.h" #include "SkXfermodeImageFilter.h" -#include "Test.h" static const uint32_t kArraySize = 64; @@ -232,7 +233,7 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap, } } -static void Tests(skiatest::Reporter* reporter) { +DEF_TEST(Serialization, reporter) { // Test matrix serialization { SkMatrix matrix = SkMatrix::I(); @@ -316,6 +317,3 @@ static void Tests(skiatest::Reporter* reporter) { TestBitmapSerialization(validBitmap, invalidBitmap2, false, reporter); } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Serialization", SerializationClass, Tests) diff --git a/tests/ShaderImageFilterTest.cpp b/tests/ShaderImageFilterTest.cpp index 49fc6e040b..f0a17acef8 100644 --- a/tests/ShaderImageFilterTest.cpp +++ b/tests/ShaderImageFilterTest.cpp @@ -1,17 +1,18 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkCanvas.h" #include "SkShader.h" #include "SkRectShaderImageFilter.h" #include "SkGradientShader.h" -static void test_asShaderMode(skiatest::Reporter* reporter) { +DEF_TEST(ShaderImageFilter, reporter) { int w = 10, h = 10; SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)); // Make small 10x10 gradient @@ -61,6 +62,3 @@ static void test_asShaderMode(skiatest::Reporter* reporter) { } } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ShaderImageFilter", ShaderImageFilterTestClass, test_asShaderMode) diff --git a/tests/ShaderOpacityTest.cpp b/tests/ShaderOpacityTest.cpp index c3dc888ba3..d514516808 100644 --- a/tests/ShaderOpacityTest.cpp +++ b/tests/ShaderOpacityTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkShader.h" #include "SkGradientShader.h" #include "SkColorShader.h" @@ -108,12 +109,8 @@ static void test_color(skiatest::Reporter* reporter) REPORTER_ASSERT(reporter, colorShader4.isOpaque()); } -static void test_shader_opacity(skiatest::Reporter* reporter) -{ +DEF_TEST(ShaderOpacity, reporter) { test_gradient(reporter); test_color(reporter); test_bitmap(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ShaderOpacity", ShaderOpacityTestClass, test_shader_opacity) diff --git a/tests/Sk64Test.cpp b/tests/Sk64Test.cpp index 50b7ec7d2f..9af32b14be 100644 --- a/tests/Sk64Test.cpp +++ b/tests/Sk64Test.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include <math.h> @@ -31,7 +32,7 @@ static void bool_table_test(skiatest::Reporter* reporter, } #endif -static void TestSk64(skiatest::Reporter* reporter) { +DEF_TEST(Sk64Test, reporter) { enum BoolTests { kZero_BoolTest, kPos_BoolTest, @@ -198,6 +199,3 @@ static void TestSk64(skiatest::Reporter* reporter) { } #endif } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Sk64", Sk64TestClass, TestSk64) diff --git a/tests/SortTest.cpp b/tests/SortTest.cpp index 28c6e682de..ceca4097c5 100644 --- a/tests/SortTest.cpp +++ b/tests/SortTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkTSort.h" @@ -32,7 +33,7 @@ static void check_sort(skiatest::Reporter* reporter, const char label[], } } -static void TestSort(skiatest::Reporter* reporter) { +DEF_TEST(Sort, reporter) { /** An array of random numbers to be sorted. */ int randomArray[500]; /** The reference sort of the random numbers. */ @@ -61,6 +62,3 @@ static void TestSort(skiatest::Reporter* reporter) { } // need tests for SkStrSearch - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Sort", SortTestClass, TestSort) diff --git a/tests/SrcOverTest.cpp b/tests/SrcOverTest.cpp index d1e65a9b38..ae01d0c966 100644 --- a/tests/SrcOverTest.cpp +++ b/tests/SrcOverTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkColorPriv.h" #include "SkXfermode.h" @@ -24,7 +25,7 @@ static int test_srcover2(unsigned dst, unsigned alpha) { return alpha + SkMulDiv255Round(dst, 255 - alpha); } -static void test_srcover_hack(skiatest::Reporter* reporter) { +DEF_TEST(SrcOver, 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)? */ @@ -74,6 +75,3 @@ static void test_srcover_hack(skiatest::Reporter* reporter) { } } } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("SrcOver", SrcOverTestClass, test_srcover_hack) diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp index 29d74fe9d8..16978d59cb 100644 --- a/tests/StreamTest.cpp +++ b/tests/StreamTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkOSFile.h" #include "SkStream.h" @@ -187,11 +188,8 @@ static void TestNullData() { } -static void TestStreams(skiatest::Reporter* reporter) { +DEF_TEST(Stream, reporter) { TestWStream(reporter); TestPackedUInt(reporter); TestNullData(); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Stream", StreamTestClass, TestStreams) diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp index c8c10e1925..04e04704ab 100644 --- a/tests/StringTest.cpp +++ b/tests/StringTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkString.h" #include <stdarg.h> #include <stdio.h> @@ -32,9 +33,7 @@ static void printfAnalog(char* buffer, int size, const char format[], ...) { ARGS_TO_BUFFER(format, buffer, size); } - - -static void TestString(skiatest::Reporter* reporter) { +DEF_TEST(String, reporter) { SkString a; SkString b((size_t)0); SkString c(""); @@ -190,9 +189,6 @@ static void TestString(skiatest::Reporter* reporter) { } -#include "TestClassDef.h" -DEFINE_TESTCLASS("String", StringTestClass, TestString) - DEF_TEST(String_SkStrSplit, r) { SkTArray<SkString> results; diff --git a/tests/StrokeTest.cpp b/tests/StrokeTest.cpp index 9336bed33a..1278bd4b85 100644 --- a/tests/StrokeTest.cpp +++ b/tests/StrokeTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkPaint.h" #include "SkPath.h" #include "SkRect.h" @@ -55,9 +56,6 @@ static void test_strokerect(skiatest::Reporter* reporter) { } } -static void TestStroke(skiatest::Reporter* reporter) { +DEF_TEST(Stroke, reporter) { test_strokerect(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Stroke", TestStrokeClass, TestStroke) diff --git a/tests/TLSTest.cpp b/tests/TLSTest.cpp index d31a09f188..6a423a586d 100644 --- a/tests/TLSTest.cpp +++ b/tests/TLSTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkGraphics.h" #include "SkPaint.h" #include "SkTLS.h" @@ -67,7 +68,7 @@ static void testTLSDestructor(void*) { SkTLS::Get(FakeCreateTLS, FakeDeleteTLS); } -static void TestTLS(skiatest::Reporter* reporter) { +DEF_TEST(TLS, reporter) { // TODO: Disabled for now to work around // http://code.google.com/p/skia/issues/detail?id=619 // ('flaky segfault in TLS test on Shuttle_Ubuntu12 buildbots') @@ -78,6 +79,3 @@ static void TestTLS(skiatest::Reporter* reporter) { test_threads(&testTLSDestructor); REPORTER_ASSERT(reporter, 0 == gCounter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("TLS", TLSClass, TestTLS) diff --git a/tests/TSetTest.cpp b/tests/TSetTest.cpp index 8f276f7bc7..4026c6a6f8 100644 --- a/tests/TSetTest.cpp +++ b/tests/TSetTest.cpp @@ -4,7 +4,9 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkTSet.h" // Tests the SkTSet<T> class template. @@ -127,11 +129,8 @@ static void TestTSet_merge(skiatest::Reporter* reporter) { #endif } -static void TestTSet(skiatest::Reporter* reporter) { +DEF_TEST(TSet, reporter) { TestTSet_basic(reporter); TestTSet_advanced(reporter); TestTSet_merge(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("TSet", TSetTest, TestTSet) diff --git a/tests/TestSize.cpp b/tests/TestSize.cpp index 6a9a88773f..475517a075 100644 --- a/tests/TestSize.cpp +++ b/tests/TestSize.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkSize.h" static void TestISize(skiatest::Reporter* reporter) { @@ -30,7 +31,7 @@ static void TestISize(skiatest::Reporter* reporter) { a.fWidth == b.fWidth && a.fHeight == b.fHeight); } -static void TestSize(skiatest::Reporter* reporter) { +DEF_TEST(Size, reporter) { TestISize(reporter); SkSize a, b; @@ -61,7 +62,4 @@ static void TestSize(skiatest::Reporter* reporter) { ia.set(ix, iy); a.set(x, y); REPORTER_ASSERT(reporter, a.toRound() == ia); -}; - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Size", TestSizeClass, TestSize) +} diff --git a/tests/ToUnicode.cpp b/tests/ToUnicode.cpp index d518432b8a..d6ca3da180 100644 --- a/tests/ToUnicode.cpp +++ b/tests/ToUnicode.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2010 The Android Open Source Project * @@ -6,8 +5,8 @@ * found in the LICENSE file. */ - #include "Test.h" +#include "TestClassDef.h" #include "SkData.h" #include "SkPDFTypes.h" #include "SkPDFFont.h" @@ -32,7 +31,7 @@ void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode, uint16_t firstGlypthID, uint16_t lastGlypthID); -static void TestToUnicode(skiatest::Reporter* reporter) { +DEF_TEST(ToUnicode, reporter) { SkTDArray<SkUnichar> glyphToUnicode; SkTDArray<uint16_t> glyphsInSubset; SkPDFGlyphSet subset; @@ -180,6 +179,3 @@ endbfrange\n"; REPORTER_ASSERT(reporter, stream_equals(buffer2, 0, expectedResult2, buffer2.getOffset())); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("ToUnicode", ToUnicodeTestClass, TestToUnicode) diff --git a/tests/Typeface.cpp b/tests/Typeface.cpp index 76fde7a8b8..d589f23a25 100644 --- a/tests/Typeface.cpp +++ b/tests/Typeface.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2013 Google Inc. * @@ -7,9 +6,10 @@ */ #include "Test.h" +#include "TestClassDef.h" #include "SkTypeface.h" -static void TestDefaultTypeface(skiatest::Reporter* reporter) { +DEF_TEST(Typeface, reporter) { SkAutoTUnref<SkTypeface> t1(SkTypeface::CreateFromName(NULL, SkTypeface::kNormal)); SkAutoTUnref<SkTypeface> t2(SkTypeface::RefDefault(SkTypeface::kNormal)); @@ -25,6 +25,3 @@ static void TestDefaultTypeface(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, NULL == t3.get()); #endif } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Typeface", TypefaceTestClass, TestDefaultTypeface) diff --git a/tests/UnicodeTest.cpp b/tests/UnicodeTest.cpp index ec9a8bc003..68f0ecf990 100644 --- a/tests/UnicodeTest.cpp +++ b/tests/UnicodeTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkPaint.h" #include "SkUtils.h" @@ -77,10 +78,7 @@ static void test_textencodings(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, !memcmp(glyphs8, glyphs32, count8 * sizeof(uint16_t))); } -static void TestUnicode(skiatest::Reporter* reporter) { +DEF_TEST(Unicode, reporter) { test_uvs(reporter); test_textencodings(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Unicode", TestUnicodeClass, TestUnicode) diff --git a/tests/UnitTestTest.cpp b/tests/UnitTestTest.cpp index e3e1b97685..f01b53d09f 100644 --- a/tests/UnitTestTest.cpp +++ b/tests/UnitTestTest.cpp @@ -5,14 +5,12 @@ * found in the LICENSE file. */ -#include "SkRTConf.h" #include "Test.h" +#include "TestClassDef.h" +#include "SkRTConf.h" -static void test_runUnitTests(skiatest::Reporter* reporter) { +DEF_TEST(UnitTest, reporter) { #ifdef SK_SUPPORT_UNITTEST SkRTConfRegistry::UnitTest(); #endif } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("UnitTest", UnitTestTestClass, test_runUnitTests) diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp index d7d67c2b8e..dfd0a2fd16 100644 --- a/tests/UtilsTest.cpp +++ b/tests/UtilsTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkRefCnt.h" #include "SkTSearch.h" @@ -183,7 +184,7 @@ static void test_utf16(skiatest::Reporter* reporter) { } } -static void TestUTF(skiatest::Reporter* reporter) { +DEF_TEST(Utils, reporter) { static const struct { const char* fUtf8; SkUnichar fUni; @@ -219,6 +220,3 @@ static void TestUTF(skiatest::Reporter* reporter) { test_autounref(reporter); test_autostarray(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Utils", UtfTestClass, TestUTF) diff --git a/tests/WArrayTest.cpp b/tests/WArrayTest.cpp index 601786208f..020953f720 100644 --- a/tests/WArrayTest.cpp +++ b/tests/WArrayTest.cpp @@ -6,6 +6,7 @@ */ #include "Test.h" +#include "TestClassDef.h" // Include the implementation so we can make an appropriate template instance. #include "SkAdvancedTypefaceMetrics.h" @@ -173,7 +174,7 @@ class TestWData { } }; -static void TestWArray(skiatest::Reporter* reporter) { +DEF_TEST(WArray, reporter) { TestWData(reporter, data1, SK_ARRAY_COUNT(data1), NULL, 0, expected1); TestWData(reporter, data2, SK_ARRAY_COUNT(data2), NULL, 0, expected2); TestWData(reporter, data3, SK_ARRAY_COUNT(data3), NULL, 0, expected3); @@ -205,6 +206,3 @@ static void TestWArray(skiatest::Reporter* reporter) { TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, SK_ARRAY_COUNT(subset14), expectedSubset14); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("WArray", WArrayTest, TestWArray) diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp index 15218378ec..2032fefae7 100644 --- a/tests/Writer32Test.cpp +++ b/tests/Writer32Test.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2011 Google Inc. * @@ -6,12 +5,11 @@ * found in the LICENSE file. */ - - +#include "Test.h" +#include "TestClassDef.h" #include "SkRandom.h" #include "SkReader32.h" #include "SkWriter32.h" -#include "Test.h" static void check_contents(skiatest::Reporter* reporter, const SkWriter32& writer, const void* expected, size_t size) { @@ -188,7 +186,7 @@ static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { } } -static void Tests(skiatest::Reporter* reporter) { +DEF_TEST(Writer32, reporter) { // dynamic allocator { SkWriter32 writer(256 * 4); @@ -252,6 +250,3 @@ static void Tests(skiatest::Reporter* reporter) { test_ptr(reporter); test_rewind(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) diff --git a/tests/XfermodeTest.cpp b/tests/XfermodeTest.cpp index 7d23b8530a..8f4d65aec5 100644 --- a/tests/XfermodeTest.cpp +++ b/tests/XfermodeTest.cpp @@ -1,11 +1,12 @@ - /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "Test.h" +#include "TestClassDef.h" #include "SkColor.h" #include "SkXfermode.h" @@ -63,10 +64,7 @@ static void test_IsMode(skiatest::Reporter* reporter) { } } -static void test_xfermodes(skiatest::Reporter* reporter) { +DEF_TEST(Xfermode, reporter) { test_asMode(reporter); test_IsMode(reporter); } - -#include "TestClassDef.h" -DEFINE_TESTCLASS("Xfermode", XfermodeTestClass, test_xfermodes) |