blob: 98ad5615165a68fc0cc5aa93c1272d02d64c9331 [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "tests/Test.h"
Hal Canarya70ae1a2019-01-08 15:04:23 -05009
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/core/SkCanvas.h"
11#include "include/core/SkFont.h"
12#include "include/core/SkSurface.h"
Robert Phillips6d344c32020-07-06 10:56:46 -040013#include "include/gpu/GrDirectContext.h"
bsalomon40ef4852016-05-02 13:22:13 -070014
15// This passes by not crashing.
16static void test(SkCanvas* canvas) {
bsalomon40ef4852016-05-02 13:22:13 -070017 canvas->scale(63, 0);
Hal Canarya70ae1a2019-01-08 15:04:23 -050018 canvas->drawString("A", 50, 50, SkFont(), SkPaint());
bsalomon40ef4852016-05-02 13:22:13 -070019}
20
21DEF_TEST(skbug5221, r) {
22 sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
23 test(surface->getCanvas());
24}
25
bsalomon40ef4852016-05-02 13:22:13 -070026DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) {
Brian Salomonae38f6e2017-06-23 12:04:22 -040027 sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(
Robert Phillips6d344c32020-07-06 10:56:46 -040028 contextInfo.directContext(), SkBudgeted::kYes,
Brian Salomonae38f6e2017-06-23 12:04:22 -040029 SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
bsalomon40ef4852016-05-02 13:22:13 -070030 test(surface->getCanvas());
31}