blob: f334dd9301f1651e3655506ab6b289210bcc73d7 [file] [log] [blame]
bsalomon40ef4852016-05-02 13:22:13 -07001/*
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 "Test.h"
Hal Canarya70ae1a2019-01-08 15:04:23 -05009
bsalomon40ef4852016-05-02 13:22:13 -070010#include "SkCanvas.h"
Hal Canarya70ae1a2019-01-08 15:04:23 -050011#include "SkFont.h"
bsalomon40ef4852016-05-02 13:22:13 -070012#include "SkSurface.h"
13
14// This passes by not crashing.
15static void test(SkCanvas* canvas) {
bsalomon40ef4852016-05-02 13:22:13 -070016 canvas->scale(63, 0);
Hal Canarya70ae1a2019-01-08 15:04:23 -050017 canvas->drawString("A", 50, 50, SkFont(), SkPaint());
bsalomon40ef4852016-05-02 13:22:13 -070018}
19
20DEF_TEST(skbug5221, r) {
21 sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
22 test(surface->getCanvas());
23}
24
bsalomon40ef4852016-05-02 13:22:13 -070025DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) {
Brian Salomonae38f6e2017-06-23 12:04:22 -040026 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(
27 contextInfo.grContext(), SkBudgeted::kYes,
28 SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
bsalomon40ef4852016-05-02 13:22:13 -070029 test(surface->getCanvas());
30}