diff options
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) |