skia2/tests/skbug5221.cpp
Hal Canary a70ae1a70f drawText Cleanup, part 5
Change-Id: I2e6cb63839ec9c6f9d5b829505472f97b076a82c
Reviewed-on: https://skia-review.googlesource.com/c/182260
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-01-09 16:10:30 +00:00

31 lines
834 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Test.h"
#include "SkCanvas.h"
#include "SkFont.h"
#include "SkSurface.h"
// This passes by not crashing.
static void test(SkCanvas* canvas) {
canvas->scale(63, 0);
canvas->drawString("A", 50, 50, SkFont(), SkPaint());
}
DEF_TEST(skbug5221, r) {
sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
test(surface->getCanvas());
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) {
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(
contextInfo.grContext(), SkBudgeted::kYes,
SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
test(surface->getCanvas());
}