aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-08-22 11:44:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-22 11:44:26 -0700
commit5f0e82204ecca0805a7689cdba5f802458e103f4 (patch)
tree2343461173da35e4df8ec89d362e870b513bc8b7 /tests
parent3e42a4638559d71481ba598857f2d0c715c8d4b3 (diff)
Support comment groups in SkRecord.
This should fix the failing paint-command-log-nodes.html layout test. BUG=406425 R=tomhudson@chromium.org Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/501533003
Diffstat (limited to 'tests')
-rw-r--r--tests/RecorderTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp
index 1ca9206b47..21a897ca8b 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: