Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
|
mtklein
2015/12/02 20:27:59
I'm not sure I see the long term value of this tes
hal.canary
2015/12/02 20:48:59
I'm not sure how gold failed to catch these.
| |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 //#include "SkAlphaThresholdFilter.h" | |
| 9 #include "SkImage.h" | |
| 10 #include "Test.h" | |
| 11 | |
| 12 static void test_flattenable(skiatest::Reporter* r, | |
| 13 const SkFlattenable* f, | |
| 14 const char* desc) { | |
| 15 if (f) { | |
| 16 SkFlattenable::Factory factory = f->getFactory(); | |
| 17 REPORTER_ASSERT(r, factory); | |
| 18 if (factory) { | |
| 19 if (!SkFlattenable::FactoryToName(factory)) { | |
| 20 ERRORF(r, "SkFlattenable::FactoryToName() fails with %s.", | |
| 21 desc); | |
| 22 } | |
| 23 } | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 DEF_TEST(FlattenableFactoryToName, r) { | |
| 28 #if 0 | |
| 29 SkIRect rects[2]; | |
| 30 rects[0] = SkIRect::MakeXYWH(0, 150, 500, 200); | |
| 31 rects[1] = SkIRect::MakeXYWH(150, 0, 200, 500); | |
| 32 SkRegion region; | |
| 33 region.setRects(rects, 2); | |
| 34 SkAutoTUnref<SkImageFilter> filter( | |
| 35 SkAlphaThresholdFilter::Create(region, 0.2f, 0.7f)); | |
| 36 test_flattenable(r, filter, "SkAlphaThresholdFilter()"); | |
|
mtklein
2015/12/02 20:28:00
We don't really guarantee these particular strings
hal.canary
2015/12/02 20:48:59
the string was for my ERRORF macro.
| |
| 37 #endif | |
| 38 SkBitmap bm; | |
| 39 bm.allocN32Pixels(8, 8); | |
| 40 bm.eraseColor(SK_ColorCYAN); | |
| 41 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bm)); | |
| 42 SkAutoTUnref<SkShader> shader( | |
| 43 image->newShader( | |
| 44 SkShader::kClamp_TileMode, | |
| 45 SkShader::kClamp_TileMode)); | |
| 46 test_flattenable(r, shader, "SkImage::newShader()"); | |
| 47 } | |
| OLD | NEW |