Home | History | Annotate | Download | only in tests
      1 /*
      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"
      9 
     10 #include "SkCanvas.h"
     11 #include "SkFont.h"
     12 #include "SkSurface.h"
     13 
     14 // This passes by not crashing.
     15 static void test(SkCanvas* canvas) {
     16     canvas->scale(63, 0);
     17     canvas->drawString("A", 50, 50, SkFont(), SkPaint());
     18 }
     19 
     20 DEF_TEST(skbug5221, r) {
     21     sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256)));
     22     test(surface->getCanvas());
     23 }
     24 
     25 DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) {
     26     sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(
     27             contextInfo.grContext(), SkBudgeted::kYes,
     28             SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
     29     test(surface->getCanvas());
     30 }
     31