Index: tests/ShaderTest.cpp |
diff --git a/tests/ShaderTest.cpp b/tests/ShaderTest.cpp |
index 83240478ad98c145762c6d70fe31ffb09e907e66..8ba55bba5fb0e42822ed02471dc31abdbaee7e42 100644 |
--- a/tests/ShaderTest.cpp |
+++ b/tests/ShaderTest.cpp |
@@ -55,3 +55,24 @@ DEF_TEST(Shader_isABitmap, reporter) { |
check_isabitmap(reporter, shader0.get(), W, H, tmx, tmy, localM); |
check_isabitmap(reporter, shader1.get(), W, H, tmx, tmy, localM); |
} |
+ |
+static void create_bitmap(SkBitmap* bitmap) { |
+ SkImageInfo info = SkImageInfo::Make(1, 1, kN32_SkColorType, kPremul_SkAlphaType); |
+ bitmap->setInfo(info); |
+ bitmap->allocPixels(info); |
+} |
+ |
+DEF_TEST(Shader_AndroidFramework, r) { |
+ SkBitmap origBitmap; |
+ create_bitmap(&origBitmap); |
+ //origBitmap.setImmutable(); |
+ sk_sp<SkShader> s = SkShader::MakeBitmapShader(origBitmap, SkShader::kClamp_TileMode, |
reed1
2016/09/20 17:19:06
Tests are allowed to call private APIs, e.g. SkIma
|
+ SkShader::kRepeat_TileMode); |
+ |
+ SkBitmap bitmap; |
+ SkShader::TileMode xy[2]; |
+ REPORTER_ASSERT(r, s->isABitmap(&bitmap, nullptr, xy)); |
+ REPORTER_ASSERT(r, SkShader::kClamp_TileMode == xy[0]); |
+ REPORTER_ASSERT(r, SkShader::kRepeat_TileMode == xy[1]); |
+ REPORTER_ASSERT(r, origBitmap.pixelRef() == bitmap.pixelRef()); |
+} |