skia2/tests/skbug5221.cpp
Brian Salomon ae38f6e8f3 skbug5221 unit test should not require N32 support from GPU
Change-Id: I98f0120a012f0adaf0b34d11135a1210a66ecea0
Reviewed-on: https://skia-review.googlesource.com/20681
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-06-23 16:30:55 +00:00

34 lines
931 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 "SkSurface.h"
// This passes by not crashing.
static void test(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
canvas->scale(63, 0);
static const char kTxt[] = "A";
canvas->drawText(kTxt, SK_ARRAY_COUNT(kTxt), 50, 50, paint);
}
DEF_TEST(skbug5221, r) {
sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
test(surface->getCanvas());
}
#if SK_SUPPORT_GPU
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());
}
#endif