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

Unified Diff: gm/selftest.cpp

Issue 12381038: gm self-test: use a pathologically simple test case instead of dashing2 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: tiny_comment_change Created 7 years, 10 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: gm/selftest.cpp
===================================================================
--- gm/selftest.cpp (revision 0)
+++ gm/selftest.cpp (revision 0)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * Pathologically simple drawing tests, designed to generate consistent
+ * output images across platforms for gm/tests/run.sh
+ */
+
+#include "gm.h"
+#include "SkCanvas.h"
+#include "SkPaint.h"
+
+class SelfTestGM : public skiagm::GM {
+public:
+ SelfTestGM(const char name[], SkColor color) : fName(name), fColor(color) {}
+ const static int kWidth = 300;
+ const static int kHeight = 200;
+
+protected:
+ SkString onShortName() {
+ return fName;
+ }
+
+ SkISize onISize() { return skiagm::make_isize(kWidth, kHeight); }
+
+ virtual void onDraw(SkCanvas* canvas) {
+ SkPaint paint;
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setColor(fColor);
+ canvas->drawRectCoords(0, 0, SkIntToScalar(kWidth), SkIntToScalar(kHeight), paint);
+ }
+
+private:
+ const SkString fName;
+ const SkColor fColor;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+static skiagm::GM* F1(void*) { return new SelfTestGM("selftest1", SK_ColorGREEN); }
+static skiagm::GM* F2(void*) { return new SelfTestGM("selftest2", SK_ColorBLUE); }
+
+static skiagm::GMRegistry gR1(F1);
+static skiagm::GMRegistry gR2(F2);

Powered by Google App Engine
This is Rietveld 408576698