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

Unified Diff: tests/DebugCanvasTest.cpp

Issue 23589007: Add infrastructure for testing the debugger code. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 | « gyp/tests.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DebugCanvasTest.cpp
diff --git a/tests/DebugCanvasTest.cpp b/tests/DebugCanvasTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..86139c4d2a7add87294666bd3262cb0098191161
--- /dev/null
+++ b/tests/DebugCanvasTest.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013 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 "debugger/SkDebugCanvas.h"
+
+static void test_debugRect(skiatest::Reporter* reporter) {
+ SkDebugCanvas canvas(100, 100);
+ canvas.drawRect(SkRect::MakeWH(100, 100), SkPaint());
+
+ const SkTDArray<SkDrawCommand*> cmds = canvas.getDrawCommands();
+ REPORTER_ASSERT(reporter, cmds.count() > 0);
+
+ const SkTDArray<SkString*>* result = cmds[0]->Info();
mtklein 2013/09/11 15:15:28 This is just a suggestion. We're assuming result
dsinclair 2013/09/11 15:20:44 Done.
+ REPORTER_ASSERT(reporter, result->count() > 0);
+
+ SkString expected("SkRect: (0, 0, 100, 100)");
+ REPORTER_ASSERT(reporter, expected == *(*result)[0]);
+}
+
+static void TestDebugCanvas(skiatest::Reporter* reporter) {
+ test_debugRect(reporter);
+}
+
+#include "TestClassDef.h"
+DEFINE_TESTCLASS("DebugCanvas", TestDebugCanvasClass, TestDebugCanvas)
« no previous file with comments | « gyp/tests.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698