aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PictureShaderTest.cpp
blob: 8d933db6003b1e9dcb3809ce9f86e3a6c29e1227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkShader.h"
#include "Test.h"

// Test that attempting to create a picture shader with a NULL picture or
// empty picture returns NULL.
DEF_TEST(PictureShader_empty, reporter) {
    SkShader* shader = SkShader::CreatePictureShader(NULL,
            SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
    REPORTER_ASSERT(reporter, NULL == shader);

    SkPictureRecorder factory;
    factory.beginRecording(0, 0, NULL, 0);
    SkAutoTUnref<SkPicture> picture(factory.endRecording());
    shader = SkShader::CreatePictureShader(picture.get(),
            SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
    REPORTER_ASSERT(reporter, NULL == shader);
}