1 /*
2 * Copyright 2016 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 "tests/Test.h"
9
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkFont.h"
12 #include "include/core/SkSurface.h"
13 #include "include/gpu/GrDirectContext.h"
14
15 // This passes by not crashing.
test(SkCanvas * canvas)16 static void test(SkCanvas* canvas) {
17 canvas->scale(63, 0);
18 canvas->drawString("A", 50, 50, SkFont(), SkPaint());
19 }
20
DEF_TEST(skbug5221,r)21 DEF_TEST(skbug5221, r) {
22 sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
23 test(surface->getCanvas());
24 }
25
DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU,r,contextInfo)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());
31 }
32