reed@google.com | b0a34d8 | 2012-07-11 19:57:55 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | #include "Test.h" |
| 9 | #include "SkAnnotation.h" |
| 10 | #include "SkData.h" |
| 11 | #include "SkCanvas.h" |
| 12 | |
| 13 | static void test_nodraw(skiatest::Reporter* reporter) { |
| 14 | SkBitmap bm; |
| 15 | bm.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
| 16 | bm.allocPixels(); |
| 17 | bm.eraseColor(0); |
| 18 | |
| 19 | SkCanvas canvas(bm); |
| 20 | SkRect r = SkRect::MakeWH(SkIntToScalar(10), SkIntToScalar(10)); |
| 21 | |
| 22 | SkAutoDataUnref data(SkData::NewWithCString("http://www.gooogle.com")); |
| 23 | |
| 24 | REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0)); |
| 25 | SkAnnotateRectWithURL(&canvas, r, data.get()); |
| 26 | REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0)); |
| 27 | } |
| 28 | |
| 29 | static void TestAnnotation(skiatest::Reporter* reporter) { |
| 30 | test_nodraw(reporter); |
| 31 | } |
| 32 | |
| 33 | #include "TestClassDef.h" |
| 34 | DEFINE_TESTCLASS("Annotation", AnnotationClass, TestAnnotation) |