diff options
author | Ben Wagner <bungeman@google.com> | 2016-11-07 18:05:29 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-08 20:20:15 +0000 |
commit | bf111d7bc9ba3857433e30eae27f0272c34ed0fb (patch) | |
tree | 878660f011e2513791d588b621bc16fa047484da /tests | |
parent | fa2c4788ce04f80ff7a5887613d93a4053cd174b (diff) |
Move SkOSPath out of include/core.
It is moved to src/utils. It is almost a tool, but has two uses in
src/ports.
The existing SkOSFile.cpp is left empty for the time being since it is
mentioned in Chromium's BUILD.gn for Skia.
Change-Id: I3bb7f7c4214359eb6ab906bfe76737d20bf1d6c7
Reviewed-on: https://skia-review.googlesource.com/4536
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BadIcoTest.cpp | 4 | ||||
-rw-r--r-- | tests/DataRefTest.cpp | 1 | ||||
-rw-r--r-- | tests/OSPathTest.cpp | 24 | ||||
-rw-r--r-- | tests/PDFDocumentTest.cpp | 1 | ||||
-rw-r--r-- | tests/StreamTest.cpp | 1 |
5 files changed, 18 insertions, 13 deletions
diff --git a/tests/BadIcoTest.cpp b/tests/BadIcoTest.cpp index a0664f1c5e..229e9bc44e 100644 --- a/tests/BadIcoTest.cpp +++ b/tests/BadIcoTest.cpp @@ -7,10 +7,12 @@ #include "Resources.h" #include "Test.h" + #include "SkBitmap.h" #include "SkCodec.h" -#include "SkStream.h" #include "SkOSFile.h" +#include "SkOSPath.h" +#include "SkStream.h" DEF_TEST(BadImage, reporter) { const char* const badImages [] = { diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index ab33d8c09c..d6e994cb65 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -8,6 +8,7 @@ #include "SkData.h" #include "SkDataTable.h" #include "SkOSFile.h" +#include "SkOSPath.h" #include "SkReadBuffer.h" #include "SkWriteBuffer.h" #include "SkStream.h" diff --git a/tests/OSPathTest.cpp b/tests/OSPathTest.cpp index 3276145fa4..22deff80a5 100644 --- a/tests/OSPathTest.cpp +++ b/tests/OSPathTest.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkOSFile.h" +#include "SkOSPath.h" #include "SkString.h" #include "Test.h" @@ -15,24 +15,24 @@ * 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. + * end with SkOSPath::SEPARATOR. * @param filename String representing the basename of a file. Must NOT - * contain SkPATH_SEPARATOR. + * contain SkOSPath::SEPARATOR. */ static void test_dir_with_file(skiatest::Reporter* reporter, SkString dir, SkString filename) { - // If filename contains SkPATH_SEPARATOR, the tests will fail. - SkASSERT(!filename.contains(SkPATH_SEPARATOR)); + // If filename contains SkOSPath::SEPARATOR, the tests will fail. + SkASSERT(!filename.contains(SkOSPath::SEPARATOR)); // Tests for SkOSPath::Join and SkOSPath::Basename - // fullName should be "dir<SkPATH_SEPARATOR>file" + // fullName should be "dir<SkOSPath::SEPARATOR>file" 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. size_t expectedSize = dir.size() + filename.size(); - if (!dir.endsWith(SkPATH_SEPARATOR) && !dir.isEmpty()) { + if (!dir.endsWith(SkOSPath::SEPARATOR) && !dir.isEmpty()) { expectedSize++; } REPORTER_ASSERT(reporter, fullName.size() == expectedSize); @@ -46,7 +46,7 @@ static void test_dir_with_file(skiatest::Reporter* reporter, SkString dir, // dirname should be the same as dir with any trailing seperators removed. // Except when the the string is just "/". SkString strippedDir = dir; - while (strippedDir.size() > 2 && strippedDir[strippedDir.size() - 1] == SkPATH_SEPARATOR) { + while (strippedDir.size() > 2 && strippedDir[strippedDir.size() - 1] == SkOSPath::SEPARATOR) { strippedDir.remove(strippedDir.size() - 1, 1); } if (!dirname.equals(strippedDir)) { @@ -55,7 +55,7 @@ static void test_dir_with_file(skiatest::Reporter* reporter, SkString dir, REPORTER_ASSERT(reporter, dirname.equals(strippedDir)); // basename will not contain a path separator - REPORTER_ASSERT(reporter, !basename.contains(SkPATH_SEPARATOR)); + REPORTER_ASSERT(reporter, !basename.contains(SkOSPath::SEPARATOR)); // Now take the basename of filename, which should be the same as filename. basename = SkOSPath::Basename(filename.c_str()); @@ -68,7 +68,7 @@ DEF_TEST(OSPath, reporter) { test_dir_with_file(reporter, dir, filename); // Now make sure this works with a path separator at the end of dir. - dir.appendUnichar(SkPATH_SEPARATOR); + dir.appendUnichar(SkOSPath::SEPARATOR); test_dir_with_file(reporter, dir, filename); // Test using no filename. @@ -82,7 +82,7 @@ DEF_TEST(OSPath, reporter) { test_dir_with_file(reporter, dir, filename); // Basename of a directory with a path separator at the end is empty. - dir.appendUnichar(SkPATH_SEPARATOR); + dir.appendUnichar(SkOSPath::SEPARATOR); SkString baseOfDir = SkOSPath::Basename(dir.c_str()); REPORTER_ASSERT(reporter, baseOfDir.size() == 0); @@ -91,7 +91,7 @@ DEF_TEST(OSPath, reporter) { REPORTER_ASSERT(reporter, empty.size() == 0); // File in root dir - dir.printf("%c", SkPATH_SEPARATOR); + dir.printf("%c", SkOSPath::SEPARATOR); filename.set("file"); test_dir_with_file(reporter, dir, filename); diff --git a/tests/PDFDocumentTest.cpp b/tests/PDFDocumentTest.cpp index afc05e49b8..fb3281920d 100644 --- a/tests/PDFDocumentTest.cpp +++ b/tests/PDFDocumentTest.cpp @@ -10,6 +10,7 @@ #include "SkCanvas.h" #include "SkDocument.h" #include "SkOSFile.h" +#include "SkOSPath.h" #include "SkStream.h" #include "SkPixelSerializer.h" diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp index b99b001193..b330745fb8 100644 --- a/tests/StreamTest.cpp +++ b/tests/StreamTest.cpp @@ -9,6 +9,7 @@ #include "SkData.h" #include "SkFrontBufferedStream.h" #include "SkOSFile.h" +#include "SkOSPath.h" #include "SkRandom.h" #include "SkStream.h" #include "SkStreamPriv.h" |