2 * Copyright 2016 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "tests/Test.h"
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkFont.h"
12 #include "include/core/SkSurface.h"
13 #include "include/gpu/GrDirectContext.h"
15 // This passes by not crashing.
16 static void test(SkCanvas* canvas) {
18 canvas->drawString("A", 50, 50, SkFont(), SkPaint());
21 DEF_TEST(skbug5221, r) {
22 sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
23 test(surface->getCanvas());
26 DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) {
27 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(
28 contextInfo.directContext(), SkBudgeted::kYes,
29 SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
30 test(surface->getCanvas());