diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-11 19:57:55 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-11 19:57:55 +0000 |
commit | b0a34d80c5c7b06db8083a547f8e499781a9c169 (patch) | |
tree | aaaa2cce1f8ee80e7c735c91204b8e69f55eca8a /tests/AnnotationTest.cpp | |
parent | 548a433ec356cc38f73780563501a00ed937c49c (diff) |
idea: add annotation to SkPaint
Review URL: https://codereview.appspot.com/6355050
git-svn-id: http://skia.googlecode.com/svn/trunk@4555 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/AnnotationTest.cpp')
-rw-r--r-- | tests/AnnotationTest.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/AnnotationTest.cpp b/tests/AnnotationTest.cpp new file mode 100644 index 0000000000..fe2cd01900 --- /dev/null +++ b/tests/AnnotationTest.cpp @@ -0,0 +1,34 @@ + +/* + * Copyright 2011 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 "SkAnnotation.h" +#include "SkData.h" +#include "SkCanvas.h" + +static void test_nodraw(skiatest::Reporter* reporter) { + SkBitmap bm; + bm.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); + bm.allocPixels(); + bm.eraseColor(0); + + SkCanvas canvas(bm); + SkRect r = SkRect::MakeWH(SkIntToScalar(10), SkIntToScalar(10)); + + SkAutoDataUnref data(SkData::NewWithCString("http://www.gooogle.com")); + + REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0)); + SkAnnotateRectWithURL(&canvas, r, data.get()); + REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0)); +} + +static void TestAnnotation(skiatest::Reporter* reporter) { + test_nodraw(reporter); +} + +#include "TestClassDef.h" +DEFINE_TESTCLASS("Annotation", AnnotationClass, TestAnnotation) |