Fix bug in setting directories for tests.
make_canonical_dir_path only worked if the provided directory
did not end with a slash. Remove this function, and call
SkPathJoin instead. Update the documentation to acknowledge
that this is an acceptable use of SkPathJoin, and update its
test.
R=epoger@google.com
Review URL: https://codereview.chromium.org/16098011
git-svn-id: http://skia.googlecode.com/svn/trunk@9458 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/OSPathTest.cpp b/tests/OSPathTest.cpp
index 96ff8a7..5ae32eb 100644
--- a/tests/OSPathTest.cpp
+++ b/tests/OSPathTest.cpp
@@ -59,6 +59,12 @@
dir.appendUnichar(SkPATH_SEPARATOR);
test_dir_with_file(reporter, dir, filename);
+ // Test using no filename.
+ test_dir_with_file(reporter, dir, SkString());
+
+ // Testing using no directory.
+ test_dir_with_file(reporter, SkString(), filename);
+
// Test with a sub directory.
dir.append("subDir");
test_dir_with_file(reporter, dir, filename);
@@ -71,6 +77,11 @@
// Basename of NULL is an empty string.
SkString empty = SkOSPath::SkBasename(NULL);
REPORTER_ASSERT(reporter, empty.size() == 0);
+
+ // Test that NULL can be used for the directory and filename.
+ SkString emptyPath = SkOSPath::SkPathJoin(NULL, NULL);
+ REPORTER_ASSERT(reporter, emptyPath.size() == 1);
+ REPORTER_ASSERT(reporter, emptyPath.contains(SkPATH_SEPARATOR));
}
#include "TestClassDef.h"