blob: 8d933db6003b1e9dcb3809ce9f86e3a6c29e1227 [file] [log] [blame]
commit-bot@chromium.org855e88e2014-04-21 19:33:12 +00001/*
2 * Copyright 2014 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 "SkPicture.h"
9#include "SkPictureRecorder.h"
10#include "SkShader.h"
11#include "Test.h"
12
13// Test that attempting to create a picture shader with a NULL picture or
14// empty picture returns NULL.
15DEF_TEST(PictureShader_empty, reporter) {
16 SkShader* shader = SkShader::CreatePictureShader(NULL,
fmalitab5f78262014-08-06 13:07:15 -070017 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
commit-bot@chromium.org855e88e2014-04-21 19:33:12 +000018 REPORTER_ASSERT(reporter, NULL == shader);
19
20 SkPictureRecorder factory;
21 factory.beginRecording(0, 0, NULL, 0);
22 SkAutoTUnref<SkPicture> picture(factory.endRecording());
23 shader = SkShader::CreatePictureShader(picture.get(),
fmalitab5f78262014-08-06 13:07:15 -070024 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
commit-bot@chromium.org855e88e2014-04-21 19:33:12 +000025 REPORTER_ASSERT(reporter, NULL == shader);
26}