diff options
author | tfarina <tfarina@chromium.org> | 2014-07-28 19:26:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-28 19:26:58 -0700 |
commit | a8e2e1504b9af6ba791637f228debaa23953064a (patch) | |
tree | c4dc50d10bb27a4bfd263f877cb7d602f6779afc /tests | |
parent | 2bff230d835fbc84f0ce8b2e7a399fe8416ec7c8 (diff) |
Cleanup: Rename SkOSPath functions.
Mostly for brevity and matches better with Python:
Python | Old C++ | New C++
os.path.join | SkOSPath::SkPathJoin | SkOSPath::Join
os.path.basename | SkOSPath::SkBasename | SkOSPath::Basename
BUG=None
TEST=make all
R=mtklein@google.com, bsalomon@google.com
Author: tfarina@chromium.org
Review URL: https://codereview.chromium.org/428443002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/DataRefTest.cpp | 2 | ||||
-rw-r--r-- | tests/DocumentTest.cpp | 4 | ||||
-rw-r--r-- | tests/FontHostTest.cpp | 2 | ||||
-rw-r--r-- | tests/ImageDecodingTest.cpp | 10 | ||||
-rw-r--r-- | tests/OSPathTest.cpp | 20 | ||||
-rw-r--r-- | tests/SerializationTest.cpp | 2 | ||||
-rw-r--r-- | tests/StreamTest.cpp | 2 |
7 files changed, 21 insertions, 21 deletions
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index adb05f9af5..6a58c16507 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -179,7 +179,7 @@ static void test_files(skiatest::Reporter* reporter) { return; } - SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "data_test"); + SkString path = SkOSPath::Join(tmpDir.c_str(), "data_test"); const char s[] = "abcdefghijklmnopqrstuvwxyz"; { diff --git a/tests/DocumentTest.cpp b/tests/DocumentTest.cpp index 73510f8432..97aefcb4e1 100644 --- a/tests/DocumentTest.cpp +++ b/tests/DocumentTest.cpp @@ -37,7 +37,7 @@ static void test_abortWithFile(skiatest::Reporter* reporter) { // allways, then all these tests will be disabled. } - SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "aborted.pdf"); + SkString path = SkOSPath::Join(tmpDir.c_str(), "aborted.pdf"); // Make sure doc's destructor is called to flush. { @@ -65,7 +65,7 @@ static void test_file(skiatest::Reporter* reporter) { // allways, then all these tests will be disabled. } - SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "file.pdf"); + SkString path = SkOSPath::Join(tmpDir.c_str(), "file.pdf"); SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(path.c_str())); diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp index 23625b3874..4fc99c40db 100644 --- a/tests/FontHostTest.cpp +++ b/tests/FontHostTest.cpp @@ -155,7 +155,7 @@ static void test_fontstream(skiatest::Reporter* reporter) { SkDebugf("Could not run fontstream test because resourcePath not specified."); return; } - SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "test.ttc"); + SkString filename = SkOSPath::Join(resourcePath.c_str(), "test.ttc"); SkFILEStream stream(filename.c_str()); if (stream.isValid()) { diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index 829851edab..89f59c5cdb 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -158,7 +158,7 @@ static void test_unpremul(skiatest::Reporter* reporter) { SkString basename; if (iter.next(&basename)) { do { - SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), basename.c_str()); + SkString filename = SkOSPath::Join(resourcePath.c_str(), basename.c_str()); // SkDebugf("about to decode \"%s\"\n", filename.c_str()); compare_unpremul(reporter, filename); } while (iter.next(&basename)); @@ -241,7 +241,7 @@ DEF_TEST(ImageDecoding_alphaType, reporter) { SkString basename; if (iter.next(&basename)) { do { - SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), basename.c_str()); + SkString filename = SkOSPath::Join(resourcePath.c_str(), basename.c_str()); for (int truth = 0; truth <= 1; ++truth) { test_alphaType(reporter, filename, SkToBool(truth)); } @@ -264,7 +264,7 @@ DEF_TEST(ImageDecoding_unpremul, reporter) { for (size_t i = 0; i < SK_ARRAY_COUNT(suffixes); ++i) { SkString basename = SkStringPrintf("%s%s", root, suffixes[i]); - SkString fullName = SkOSPath::SkPathJoin(resourcePath.c_str(), basename.c_str()); + SkString fullName = SkOSPath::Join(resourcePath.c_str(), basename.c_str()); SkBitmap bm; SkFILEStream stream(fullName.c_str()); @@ -692,7 +692,7 @@ DEF_TEST(ImageDecoderOptions, reporter) { const bool useDataList[] = {true, false}; for (size_t fidx = 0; fidx < SK_ARRAY_COUNT(files); ++fidx) { - SkString path = SkOSPath::SkPathJoin(resourceDir.c_str(), files[fidx]); + SkString path = SkOSPath::Join(resourceDir.c_str(), files[fidx]); if (!sk_exists(path.c_str())) { continue; } @@ -726,7 +726,7 @@ DEF_TEST(ImageDecoderOptions, reporter) { DEF_TEST(DiscardablePixelRef_SecondLockColorTableCheck, r) { SkString resourceDir = GetResourcePath(); - SkString path = SkOSPath::SkPathJoin(resourceDir.c_str(), "randPixels.gif"); + SkString path = SkOSPath::Join(resourceDir.c_str(), "randPixels.gif"); if (!sk_exists(path.c_str())) { return; } diff --git a/tests/OSPathTest.cpp b/tests/OSPathTest.cpp index d36b7cb0cf..1452c3852e 100644 --- a/tests/OSPathTest.cpp +++ b/tests/OSPathTest.cpp @@ -10,9 +10,9 @@ #include "Test.h" /** - * Test SkPathJoin and SkBasename. - * Will use SkPathJoin to append filename to dir, test that it works correctly, - * and tests using SkBasename on the result. + * Test SkOSPath::Join and SkOSPath::Basename. + * Will use SkOSPath::Join to append filename to dir, test that it works correctly, + * and tests using SkOSPath::Basename on the result. * @param reporter Reporter for test conditions. * @param dir String representing the path to a folder. May or may not * end with SkPATH_SEPARATOR. @@ -24,10 +24,10 @@ static void test_dir_with_file(skiatest::Reporter* reporter, SkString dir, // If filename contains SkPATH_SEPARATOR, the tests will fail. SkASSERT(!filename.contains(SkPATH_SEPARATOR)); - // Tests for SkOSPath::SkPathJoin and SkOSPath::SkBasename + // Tests for SkOSPath::Join and SkOSPath::Basename // fullName should be "dir<SkPATH_SEPARATOR>file" - SkString fullName = SkOSPath::SkPathJoin(dir.c_str(), filename.c_str()); + SkString fullName = SkOSPath::Join(dir.c_str(), filename.c_str()); // fullName should be the combined size of dir and file, plus one if // dir did not include the final path separator. @@ -37,7 +37,7 @@ static void test_dir_with_file(skiatest::Reporter* reporter, SkString dir, } REPORTER_ASSERT(reporter, fullName.size() == expectedSize); - SkString basename = SkOSPath::SkBasename(fullName.c_str()); + SkString basename = SkOSPath::Basename(fullName.c_str()); // basename should be the same as filename REPORTER_ASSERT(reporter, basename.equals(filename)); @@ -46,7 +46,7 @@ static void test_dir_with_file(skiatest::Reporter* reporter, SkString dir, REPORTER_ASSERT(reporter, !basename.contains(SkPATH_SEPARATOR)); // Now take the basename of filename, which should be the same as filename. - basename = SkOSPath::SkBasename(filename.c_str()); + basename = SkOSPath::Basename(filename.c_str()); REPORTER_ASSERT(reporter, basename.equals(filename)); } @@ -71,15 +71,15 @@ DEF_TEST(OSPath, reporter) { // Basename of a directory with a path separator at the end is empty. dir.appendUnichar(SkPATH_SEPARATOR); - SkString baseOfDir = SkOSPath::SkBasename(dir.c_str()); + SkString baseOfDir = SkOSPath::Basename(dir.c_str()); REPORTER_ASSERT(reporter, baseOfDir.size() == 0); // Basename of NULL is an empty string. - SkString empty = SkOSPath::SkBasename(NULL); + SkString empty = SkOSPath::Basename(NULL); REPORTER_ASSERT(reporter, empty.size() == 0); // Test that NULL can be used for the directory and filename. - SkString emptyPath = SkOSPath::SkPathJoin(NULL, NULL); + SkString emptyPath = SkOSPath::Join(NULL, NULL); REPORTER_ASSERT(reporter, emptyPath.size() == 1); REPORTER_ASSERT(reporter, emptyPath.contains(SkPATH_SEPARATOR)); } diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index 3a443f3b9c..2dc0c62cb5 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -299,7 +299,7 @@ static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) { SkDebugf("Could not run fontstream test because resourcePath not specified."); return; } - SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "test.ttc"); + SkString filename = SkOSPath::Join(resourcePath.c_str(), "test.ttc"); SkTypeface* typeface = SkTypeface::CreateFromFile(filename.c_str()); if (!typeface) { SkDebugf("Could not run fontstream test because test.ttc not found."); diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp index 7cf3126d61..ce391a398a 100644 --- a/tests/StreamTest.cpp +++ b/tests/StreamTest.cpp @@ -37,7 +37,7 @@ static void test_loop_stream(skiatest::Reporter* reporter, SkStream* stream, } static void test_filestreams(skiatest::Reporter* reporter, const char* tmpDir) { - SkString path = SkOSPath::SkPathJoin(tmpDir, "wstream_test"); + SkString path = SkOSPath::Join(tmpDir, "wstream_test"); const char s[] = "abcdefghijklmnopqrstuvwxyz"; |