1855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org/*
2855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org * Copyright 2014 Google Inc.
3855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org *
4855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be
5855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org * found in the LICENSE file.
6855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org */
7855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org
8855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org#include "SkPicture.h"
9855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org#include "SkPictureRecorder.h"
10855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org#include "SkShader.h"
11855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org#include "Test.h"
12855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org
13855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org// Test that attempting to create a picture shader with a NULL picture or
14855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org// empty picture returns NULL.
15855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.orgDEF_TEST(PictureShader_empty, reporter) {
16855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org    SkShader* shader = SkShader::CreatePictureShader(NULL,
17b5f7826c51af2862aebcabe61e1ba684f925e488fmalita            SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
18855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org    REPORTER_ASSERT(reporter, NULL == shader);
19855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org
20855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org    SkPictureRecorder factory;
21855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org    factory.beginRecording(0, 0, NULL, 0);
22855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org    SkAutoTUnref<SkPicture> picture(factory.endRecording());
23855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org    shader = SkShader::CreatePictureShader(picture.get(),
24b5f7826c51af2862aebcabe61e1ba684f925e488fmalita            SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
25855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org    REPORTER_ASSERT(reporter, NULL == shader);
26855e88edfafe4b3892e99f932c38fa7433b2fcbecommit-bot@chromium.org}
27