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

Side by Side Diff: tests/RecorderTest.cpp

Issue 227673011: More SkRecord TODOs: (Closed) Base URL: https://skia.googlesource.com/skia.git@tests
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 unified diff | Download patch
« no previous file with comments | « gyp/tools.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "Test.h"
2
3 #include "SkRecord.h"
4 #include "SkRecorder.h"
5 #include "SkRecords.h"
6
7 #define COUNT(T) + 1
8 static const int kRecordTypes = 0 + SK_RECORD_TYPES(COUNT);
f(malita) 2014/04/08 19:48:34 I guess it evals correctly, but I think we could d
mtklein 2014/04/08 19:51:40 Oooh, good call. This was left over from before I
9 #undef COUNT
10
11 // Tallies the types of commands it sees into histogram.
12 class Tally {
13 public:
14 explicit Tally(int histogram[kRecordTypes]) : fHistogram(histogram) {}
15
16 template <typename T> void operator()(const T&) {
17 ++fHistogram[T::kType];
18 }
19
20 private:
21 int* fHistogram;
22 };
23
24 DEF_TEST(Recorder, r) {
25 SkRecord record;
26 SkRecorder recorder(&record, 1920, 1080);
27
28 recorder.drawRect(SkRect::MakeWH(10, 10), SkPaint());
29
30 int histogram[kRecordTypes];
31 bzero(&histogram, sizeof(histogram));
32
33 record.visit(Tally(histogram));
34
35 REPORTER_ASSERT(r, 1 == histogram[SkRecords::DrawRect::kType]);
36 }
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698