blob: 94867bc945f446be34abfdd1fdd2641b633bcdfd [file] [log] [blame]
sugoi518d83d2014-07-21 11:37:39 -07001/*
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 "SkImageGenerator.h"
9#include "Test.h"
10
reed3ef71e32015-03-19 08:31:14 -070011class MyImageGenerator : public SkImageGenerator {
12public:
13 MyImageGenerator() : SkImageGenerator(SkImageInfo::MakeN32Premul(0, 0)) {}
14};
15
sugoi518d83d2014-07-21 11:37:39 -070016DEF_TEST(ImageGenerator, reporter) {
reed3ef71e32015-03-19 08:31:14 -070017 MyImageGenerator ig;
sugoi518d83d2014-07-21 11:37:39 -070018 SkISize sizes[3];
19 sizes[0] = SkISize::Make(200, 200);
20 sizes[1] = SkISize::Make(100, 100);
21 sizes[2] = SkISize::Make( 50, 50);
22 void* planes[3] = { NULL };
23 size_t rowBytes[3] = { 0 };
rileyaabaef862014-09-12 17:45:58 -070024 SkYUVColorSpace colorSpace;
sugoi518d83d2014-07-21 11:37:39 -070025
26 // Check that the YUV decoding API does not cause any crashes
rileyaabaef862014-09-12 17:45:58 -070027 ig.getYUV8Planes(sizes, NULL, NULL, &colorSpace);
28 ig.getYUV8Planes(sizes, NULL, NULL, NULL);
29 ig.getYUV8Planes(sizes, planes, NULL, NULL);
30 ig.getYUV8Planes(sizes, NULL, rowBytes, NULL);
31 ig.getYUV8Planes(sizes, planes, rowBytes, NULL);
32 ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace);
sugoi518d83d2014-07-21 11:37:39 -070033
34 int dummy;
35 planes[0] = planes[1] = planes[2] = &dummy;
36 rowBytes[0] = rowBytes[1] = rowBytes[2] = 250;
37
rileyaabaef862014-09-12 17:45:58 -070038 ig.getYUV8Planes(sizes, planes, rowBytes, &colorSpace);
sugoi518d83d2014-07-21 11:37:39 -070039}