Skbug5221.cpp 879 B

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