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/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 3b9c194..89db399 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "Resources.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkColor.h"
@@ -148,7 +149,7 @@
static void test_unpremul(skiatest::Reporter* reporter) {
// This test cannot run if there is no resource path.
- SkString resourcePath = skiatest::Test::GetResourcePath();
+ SkString resourcePath = GetResourcePath();
if (resourcePath.isEmpty()) {
SkDebugf("Could not run unpremul test because resourcePath not specified.");
return;
@@ -230,7 +231,7 @@
}
DEF_TEST(ImageDecoding_alphaType, reporter) {
- SkString resourcePath = skiatest::Test::GetResourcePath();
+ SkString resourcePath = GetResourcePath();
if (resourcePath.isEmpty()) {
SkDebugf("Could not run alphaType test because resourcePath not specified.");
return;
@@ -253,7 +254,7 @@
// Using known images, test that decoding into unpremul and premul behave as expected.
DEF_TEST(ImageDecoding_unpremul, reporter) {
- SkString resourcePath = skiatest::Test::GetResourcePath();
+ SkString resourcePath = GetResourcePath();
if (resourcePath.isEmpty()) {
SkDebugf("Could not run unpremul test because resourcePath not specified.");
return;
@@ -502,7 +503,7 @@
* SkInstallDiscardablePixelRef functions.
*/
DEF_TEST(ImprovedBitmapFactory, reporter) {
- SkString resourcePath = skiatest::Test::GetResourcePath();
+ SkString resourcePath = GetResourcePath();
SkString path = SkOSPath::SkPathJoin(
resourcePath.c_str(), "randPixels.png");
SkAutoTUnref<SkStreamRewindable> stream(
@@ -676,7 +677,7 @@
#endif
};
- SkString resourceDir = skiatest::Test::GetResourcePath();
+ SkString resourceDir = GetResourcePath();
if (!sk_exists(resourceDir.c_str())) {
return;
}