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

Unified Diff: tests/RecordCullingTest.cpp

Issue 251133008: Backfill unit tests for SkRecord (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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
Index: tests/RecordCullingTest.cpp
diff --git a/tests/RecordCullingTest.cpp b/tests/RecordCullingTest.cpp
deleted file mode 100644
index 7cb62414c319d6dd14e8178128a7279dc4271af8..0000000000000000000000000000000000000000
--- a/tests/RecordCullingTest.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 "Test.h"
-
-#include "SkRecord.h"
-#include "SkRecordOpts.h"
-#include "SkRecorder.h"
-#include "SkRecords.h"
-
-struct SkipScanner {
- template <typename T> void operator()(const T&) {}
-
- void apply(const SkRecord& record) {
- for (unsigned i = 0; i < record.count(); i++) {
- record.visit(i, *this);
- }
- }
-
- SkTDArray<unsigned> fSkips;
-};
-
-template <> void SkipScanner::operator()(const SkRecords::PairedPushCull& r) {
- *fSkips.append() = r.skip;
-}
-
-
-DEF_TEST(RecordCulling, r) {
- SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1080);
-
- recorder.drawRect(SkRect::MakeWH(1000, 10000), SkPaint());
-
- recorder.pushCull(SkRect::MakeWH(100, 100));
- recorder.drawRect(SkRect::MakeWH(10, 10), SkPaint());
- recorder.drawRect(SkRect::MakeWH(30, 30), SkPaint());
- recorder.pushCull(SkRect::MakeWH(5, 5));
- recorder.drawRect(SkRect::MakeWH(1, 1), SkPaint());
- recorder.popCull();
- recorder.popCull();
-
- SkRecordAnnotateCullingPairs(&record);
-
- SkipScanner scan;
- scan.apply(record);
-
- REPORTER_ASSERT(r, 2 == scan.fSkips.count());
- REPORTER_ASSERT(r, 6 == scan.fSkips[0]);
- REPORTER_ASSERT(r, 2 == scan.fSkips[1]);
-}
« no previous file with comments | « src/record/SkRecordOpts.h ('k') | tests/RecordDrawTest.cpp » ('j') | tests/RecordOptsTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698