Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: tests/FlattenableFactoryToName.cpp

Issue 1499443002: SkImageShaderFactoryToName SkAlphaThresholdFilterFactoryToName (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/FlattenableFactoryToName.cpp
diff --git a/tests/FlattenableFactoryToName.cpp b/tests/FlattenableFactoryToName.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e1bc5a3c05235f29d266b1b9d0ef09407eddf9c9
--- /dev/null
+++ b/tests/FlattenableFactoryToName.cpp
@@ -0,0 +1,47 @@
+/*
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.
+ * 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) {
+#if 0
+ 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()");
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.
+#endif
+ 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()");
+}
« src/ports/SkGlobalInitialization_default.cpp ('K') | « src/ports/SkGlobalInitialization_default.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698