Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: tests/CTest.cpp

Issue 665203004: move c api into include (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/c/sk_surface.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CTest.cpp
diff --git a/tests/CTest.cpp b/tests/CTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f663dcf949a46e31636a556d3de8a18f64e5a71e
--- /dev/null
+++ b/tests/CTest.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "sk_surface.h"
+#include "Test.h"
+
+static void test_c(skiatest::Reporter* reporter) {
+ sk_colortype_t ct = sk_colortype_get_default_8888();
+
+ sk_imageinfo_t info = {
+ 1, 1, ct, PREMUL_SK_ALPHATYPE
+ };
+ uint32_t pixel[1] = { 0 };
+
+ sk_surface_t* surface = sk_surface_new_raster_direct(&info, pixel, sizeof(uint32_t));
+ sk_paint_t* paint = sk_paint_new();
+
+ sk_canvas_t* canvas = sk_surface_get_canvas(surface);
+ sk_canvas_draw_paint(canvas, paint);
+ REPORTER_ASSERT(reporter, 0xFF000000 == pixel[0]);
+
+ sk_paint_set_color(paint, sk_color_set_argb(0xFF, 0xFF, 0xFF, 0xFF));
+ sk_canvas_draw_paint(canvas, paint);
+ REPORTER_ASSERT(reporter, 0xFFFFFFFF == pixel[0]);
+
+ sk_paint_delete(paint);
+ sk_surface_delete(surface);
+}
+
+DEF_TEST(C_API, reporter) {
+ test_c(reporter);
+}
« no previous file with comments | « src/c/sk_surface.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698