Index: dm/DMComparisonTask.cpp |
diff --git a/dm/DMComparisonTask.cpp b/dm/DMComparisonTask.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f4f742c921077da558e0cad60cc6ea5569fcd0c1 |
--- /dev/null |
+++ b/dm/DMComparisonTask.cpp |
@@ -0,0 +1,22 @@ |
+#include "DMComparisonTask.h" |
+#include "DMUtil.h" |
+ |
+namespace DM { |
+ |
+ComparisonTask::ComparisonTask(const Task& parent, |
+ skiagm::Expectations expectations, |
+ SkBitmap bitmap) |
+ : Task(parent) |
+ , fName(parent.name()) // Masquerade as parent so failures are attributed to it. |
+ , fExpectations(expectations) |
+ , fBitmap(bitmap) |
+ {} |
+ |
+void ComparisonTask::draw() { |
+ const skiagm::GmResultDigest digest(fBitmap); |
+ if (!meetsExpectations(fExpectations, digest)) { |
+ this->fail(); |
+ } |
+} |
+ |
+} // namespace DM |