xref: /third_party/skia/tests/Skbug5221.cpp (revision cb93a386)
1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2016 Google Inc.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#include "tests/Test.h"
9cb93a386Sopenharmony_ci
10cb93a386Sopenharmony_ci#include "include/core/SkCanvas.h"
11cb93a386Sopenharmony_ci#include "include/core/SkFont.h"
12cb93a386Sopenharmony_ci#include "include/core/SkSurface.h"
13cb93a386Sopenharmony_ci#include "include/gpu/GrDirectContext.h"
14cb93a386Sopenharmony_ci
15cb93a386Sopenharmony_ci// This passes by not crashing.
16cb93a386Sopenharmony_cistatic void test(SkCanvas* canvas) {
17cb93a386Sopenharmony_ci    canvas->scale(63, 0);
18cb93a386Sopenharmony_ci    canvas->drawString("A", 50, 50, SkFont(), SkPaint());
19cb93a386Sopenharmony_ci}
20cb93a386Sopenharmony_ci
21cb93a386Sopenharmony_ciDEF_TEST(skbug5221, r) {
22cb93a386Sopenharmony_ci    sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
23cb93a386Sopenharmony_ci    test(surface->getCanvas());
24cb93a386Sopenharmony_ci}
25cb93a386Sopenharmony_ci
26cb93a386Sopenharmony_ciDEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) {
27cb93a386Sopenharmony_ci    sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(
28cb93a386Sopenharmony_ci            contextInfo.directContext(), SkBudgeted::kYes,
29cb93a386Sopenharmony_ci            SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
30cb93a386Sopenharmony_ci    test(surface->getCanvas());
31cb93a386Sopenharmony_ci}
32