diff options
author | scroggo <scroggo@google.com> | 2015-12-18 07:14:24 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-18 07:14:24 -0800 |
commit | 56fbbfe609baf5a6a8e21615b4a78fe6a6e364e0 (patch) | |
tree | a97fefe3d3d450d60ea52850ae51abe88bcd6c3f | |
parent | 13221b83663778a2f5cbd90e51e253268755877e (diff) |
Reland of Add test for previously unflattenables (patchset #1 id:1 of https://codereview.chromium.org/1532753002/ )
Reason for revert:
The test should now be blacklisted.
Original issue's description:
> Revert of Add test for previously unflattenables (patchset #1 id:1 of https://codereview.chromium.org/1514373003/ )
>
> Reason for revert:
> Speculative fix for skbug.com/4709
>
> Original issue's description:
> > Add test for previously unflattenables
> >
> > BUG=skia:4613
> >
> > Committed: https://skia.googlesource.com/skia/+/061aaa79f7d8a2e93962e8296abaae13f0a7a715
>
> TBR=halcanary@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:4613
>
> Committed: https://skia.googlesource.com/skia/+/c8f969309cafebeb16ad057f766b61bdc406a8b8
TBR=halcanary@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4613
Review URL: https://codereview.chromium.org/1535143002
-rw-r--r-- | tests/FlattenableFactoryToName.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/FlattenableFactoryToName.cpp b/tests/FlattenableFactoryToName.cpp new file mode 100644 index 0000000000..f8cb4fa2f9 --- /dev/null +++ b/tests/FlattenableFactoryToName.cpp @@ -0,0 +1,42 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkAlphaThresholdFilter.h" +#include "SkImage.h" +#include "Test.h" + +static void test_flattenable(skiatest::Reporter* r, + const SkFlattenable* f, + const char* desc) { + if (f) { + SkFlattenable::Factory factory = f->getFactory(); + REPORTER_ASSERT(r, factory); + if (factory) { + if (!SkFlattenable::FactoryToName(factory)) { + ERRORF(r, "SkFlattenable::FactoryToName() fails with %s.", desc); + } + } + } +} + +DEF_TEST(FlattenableFactoryToName, r) { + SkIRect rects[2]; + rects[0] = SkIRect::MakeXYWH(0, 150, 500, 200); + rects[1] = SkIRect::MakeXYWH(150, 0, 200, 500); + SkRegion region; + region.setRects(rects, 2); + SkAutoTUnref<SkImageFilter> filter( SkAlphaThresholdFilter::Create(region, 0.2f, 0.7f)); + test_flattenable(r, filter, "SkAlphaThresholdFilter()"); + + SkBitmap bm; + bm.allocN32Pixels(8, 8); + bm.eraseColor(SK_ColorCYAN); + SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bm)); + SkAutoTUnref<SkShader> shader(image->newShader(SkShader::kClamp_TileMode, + SkShader::kClamp_TileMode)); + test_flattenable(r, shader, "SkImage::newShader()"); +} |