2014-04-21 19:33:12 +00:00
|
|
|
/*
|
|
|
|
* 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,
|
2014-08-06 20:07:15 +00:00
|
|
|
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
|
2014-04-21 19:33:12 +00:00
|
|
|
REPORTER_ASSERT(reporter, NULL == shader);
|
|
|
|
|
|
|
|
SkPictureRecorder factory;
|
|
|
|
factory.beginRecording(0, 0, NULL, 0);
|
|
|
|
SkAutoTUnref<SkPicture> picture(factory.endRecording());
|
|
|
|
shader = SkShader::CreatePictureShader(picture.get(),
|
2014-08-06 20:07:15 +00:00
|
|
|
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
|
2014-04-21 19:33:12 +00:00
|
|
|
REPORTER_ASSERT(reporter, NULL == shader);
|
|
|
|
}
|