diff options
-rw-r--r-- | gyp/dm.gyp | 1 | ||||
-rw-r--r-- | gyp/record.gyp | 5 | ||||
-rw-r--r-- | gyp/tests.gypi | 3 | ||||
-rw-r--r-- | gyp/tools.gyp | 1 | ||||
-rw-r--r-- | tests/RecorderTest.cpp | 36 |
5 files changed, 43 insertions, 3 deletions
diff --git a/gyp/dm.gyp b/gyp/dm.gyp index 6bce65afb3..8bb8ddf7eb 100644 --- a/gyp/dm.gyp +++ b/gyp/dm.gyp @@ -16,7 +16,6 @@ '../src/core', '../src/effects', '../src/pipe/utils/', - '../src/record', '../src/utils', '../src/utils/debugger', '../tools', diff --git a/gyp/record.gyp b/gyp/record.gyp index 2e4a560ec7..bcc42229ed 100644 --- a/gyp/record.gyp +++ b/gyp/record.gyp @@ -7,6 +7,11 @@ '../include/config', '../include/core', ], + 'direct_dependent_settings': { + 'include_dirs': [ + '../src/record', + ], + }, 'sources': [ '../src/record/SkRecorder.cpp', ], diff --git a/gyp/tests.gypi b/gyp/tests.gypi index 959e6c6d30..02aed738b5 100644 --- a/gyp/tests.gypi +++ b/gyp/tests.gypi @@ -9,7 +9,6 @@ '../src/pathops', '../src/pdf', '../src/pipe/utils', - '../src/record', '../src/utils', '../src/utils/debugger', '../tools/', @@ -24,6 +23,7 @@ 'flags.gyp:flags', 'pdf.gyp:pdf', 'tools.gyp:picture_utils', + 'record.gyp:record', ], 'sources': [ '../tests/Test.cpp', @@ -136,6 +136,7 @@ '../tests/ReadWriteAlphaTest.cpp', '../tests/Reader32Test.cpp', '../tests/RecordTest.cpp', + '../tests/RecorderTest.cpp', '../tests/RefCntTest.cpp', '../tests/RefDictTest.cpp', '../tests/RegionTest.cpp', diff --git a/gyp/tools.gyp b/gyp/tools.gyp index 461cc6b64b..079fd4d7a4 100644 --- a/gyp/tools.gyp +++ b/gyp/tools.gyp @@ -300,7 +300,6 @@ '../src/core/', '../src/images', '../src/lazy', - '../src/record', ], 'dependencies': [ 'flags.gyp:flags', diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp new file mode 100644 index 0000000000..e04a9e9f60 --- /dev/null +++ b/tests/RecorderTest.cpp @@ -0,0 +1,36 @@ +#include "Test.h" + +#include "SkRecord.h" +#include "SkRecorder.h" +#include "SkRecords.h" + +#define COUNT(T) + 1 +static const int kRecordTypes = SK_RECORD_TYPES(COUNT); +#undef COUNT + +// Tallies the types of commands it sees into histogram. +class Tally { +public: + explicit Tally(int histogram[kRecordTypes]) : fHistogram(histogram) {} + + template <typename T> void operator()(const T&) { + ++fHistogram[T::kType]; + } + +private: + int* fHistogram; +}; + +DEF_TEST(Recorder, r) { + SkRecord record; + SkRecorder recorder(&record, 1920, 1080); + + recorder.drawRect(SkRect::MakeWH(10, 10), SkPaint()); + + int histogram[kRecordTypes]; + bzero(&histogram, sizeof(histogram)); + + record.visit(Tally(histogram)); + + REPORTER_ASSERT(r, 1 == histogram[SkRecords::DrawRect::kType]); +} |