blob: fe2cd01900d433f0711f70212b7fab0e8dc1676d [file] [log] [blame]
reed@google.comb0a34d82012-07-11 19:57:55 +00001
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
13static 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
29static void TestAnnotation(skiatest::Reporter* reporter) {
30 test_nodraw(reporter);
31}
32
33#include "TestClassDef.h"
34DEFINE_TESTCLASS("Annotation", AnnotationClass, TestAnnotation)