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

Unified Diff: tests/RecorderTest.cpp

Issue 501533003: Support comment groups in SkRecord. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add unit test Created 6 years, 4 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/core/SkRecords.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RecorderTest.cpp
diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp
index 1ca9206b474dd9afdcd2564401af89be9986f847..21a897ca8b1a5e3b10ec759f758cf7dae8381833 100644
--- a/tests/RecorderTest.cpp
+++ b/tests/RecorderTest.cpp
@@ -49,6 +49,25 @@ DEF_TEST(Recorder, r) {
REPORTER_ASSERT(r, 1 == tally.count<SkRecords::DrawRect>());
}
+// All of Skia will work fine without support for comment groups, but
+// Chrome's inspector can break. This serves as a simple regression test.
+DEF_TEST(Recorder_CommentGroups, r) {
+ SkRecord record;
+ SkRecorder recorder(&record, 1920, 1080);
+
+ recorder.beginCommentGroup("test");
+ recorder.addComment("foo", "bar");
+ recorder.addComment("baz", "quux");
+ recorder.endCommentGroup();
+
+ Tally tally;
+ tally.apply(record);
+
+ REPORTER_ASSERT(r, 1 == tally.count<SkRecords::BeginCommentGroup>());
+ REPORTER_ASSERT(r, 2 == tally.count<SkRecords::AddComment>());
+ REPORTER_ASSERT(r, 1 == tally.count<SkRecords::EndCommentGroup>());
+}
+
// Regression test for leaking refs held by optional arguments.
DEF_TEST(Recorder_RefLeaking, r) {
// We use SaveLayer to test:
« no previous file with comments | « src/core/SkRecords.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698