Refactor how we handle resources path in Tests.
This idea emerged while doing https://codereview.chromium.org/321723002/
(commit 880914c35c8f7fc2e9c57134134c883baf66e538).
BUG=None
TEST=make tests && out/Debug/tests
R=mtklein@google.com
Author: tfarina@chromium.org
Review URL: https://codereview.chromium.org/346453002
diff --git a/gm/cmykjpeg.cpp b/gm/cmykjpeg.cpp
index 2d0c275..a1a12dc 100644
--- a/gm/cmykjpeg.cpp
+++ b/gm/cmykjpeg.cpp
@@ -6,6 +6,8 @@
*/
#include "gm.h"
+
+#include "Resources.h"
#include "SkCanvas.h"
#include "SkImageDecoder.h"
#include "SkStream.h"
@@ -21,18 +23,17 @@
protected:
virtual void onOnceBeforeDraw() SK_OVERRIDE {
-
// parameters to the "decode" call
bool dither = false;
- SkString filename(INHERITED::gResourcePath);
- if (!filename.endsWith("/") && !filename.endsWith("\\")) {
- filename.append("/");
+ SkString resourcePath = GetResourcePath();
+ if (!resourcePath.endsWith("/") && !resourcePath.endsWith("\\")) {
+ resourcePath.append("/");
}
- filename.append("CMYK.jpg");
+ resourcePath.append("CMYK.jpg");
- SkFILEStream stream(filename.c_str());
+ SkFILEStream stream(resourcePath.c_str());
if (!stream.isValid()) {
SkDebugf("Could not find CMYK.jpg, please set --resourcePath correctly.\n");
return;