Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tests/OSPathTest.cpp

Issue 100113004: Use DEFINE_TESTCLASS_SHORT macro in tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/MipMapTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h"
9 #include "TestClassDef.h"
8 #include "SkString.h" 10 #include "SkString.h"
9 #include "SkOSFile.h" 11 #include "SkOSFile.h"
10 #include "Test.h"
11 12
12 /** 13 /**
13 * Test SkPathJoin and SkBasename. 14 * Test SkPathJoin and SkBasename.
14 * Will use SkPathJoin to append filename to dir, test that it works correctly, 15 * Will use SkPathJoin to append filename to dir, test that it works correctly,
15 * and tests using SkBasename on the result. 16 * and tests using SkBasename on the result.
16 * @param reporter Reporter for test conditions. 17 * @param reporter Reporter for test conditions.
17 * @param dir String representing the path to a folder. May or may not 18 * @param dir String representing the path to a folder. May or may not
18 * end with SkPATH_SEPARATOR. 19 * end with SkPATH_SEPARATOR.
19 * @param filename String representing the basename of a file. Must NOT 20 * @param filename String representing the basename of a file. Must NOT
20 * contain SkPATH_SEPARATOR. 21 * contain SkPATH_SEPARATOR.
(...skipping 22 matching lines...) Expand all
43 REPORTER_ASSERT(reporter, basename.equals(filename)); 44 REPORTER_ASSERT(reporter, basename.equals(filename));
44 45
45 // basename will not contain a path separator 46 // basename will not contain a path separator
46 REPORTER_ASSERT(reporter, !basename.contains(SkPATH_SEPARATOR)); 47 REPORTER_ASSERT(reporter, !basename.contains(SkPATH_SEPARATOR));
47 48
48 // Now take the basename of filename, which should be the same as filename. 49 // Now take the basename of filename, which should be the same as filename.
49 basename = SkOSPath::SkBasename(filename.c_str()); 50 basename = SkOSPath::SkBasename(filename.c_str());
50 REPORTER_ASSERT(reporter, basename.equals(filename)); 51 REPORTER_ASSERT(reporter, basename.equals(filename));
51 } 52 }
52 53
53 static void test_os_path_utils_tests(skiatest::Reporter* reporter) { 54 DEF_TEST(OSPath, reporter) {
54 SkString dir("dir"); 55 SkString dir("dir");
55 SkString filename("file"); 56 SkString filename("file");
56 test_dir_with_file(reporter, dir, filename); 57 test_dir_with_file(reporter, dir, filename);
57 58
58 // Now make sure this works with a path separator at the end of dir. 59 // Now make sure this works with a path separator at the end of dir.
59 dir.appendUnichar(SkPATH_SEPARATOR); 60 dir.appendUnichar(SkPATH_SEPARATOR);
60 test_dir_with_file(reporter, dir, filename); 61 test_dir_with_file(reporter, dir, filename);
61 62
62 // Test using no filename. 63 // Test using no filename.
63 test_dir_with_file(reporter, dir, SkString()); 64 test_dir_with_file(reporter, dir, SkString());
(...skipping 12 matching lines...) Expand all
76 77
77 // Basename of NULL is an empty string. 78 // Basename of NULL is an empty string.
78 SkString empty = SkOSPath::SkBasename(NULL); 79 SkString empty = SkOSPath::SkBasename(NULL);
79 REPORTER_ASSERT(reporter, empty.size() == 0); 80 REPORTER_ASSERT(reporter, empty.size() == 0);
80 81
81 // Test that NULL can be used for the directory and filename. 82 // Test that NULL can be used for the directory and filename.
82 SkString emptyPath = SkOSPath::SkPathJoin(NULL, NULL); 83 SkString emptyPath = SkOSPath::SkPathJoin(NULL, NULL);
83 REPORTER_ASSERT(reporter, emptyPath.size() == 1); 84 REPORTER_ASSERT(reporter, emptyPath.size() == 1);
84 REPORTER_ASSERT(reporter, emptyPath.contains(SkPATH_SEPARATOR)); 85 REPORTER_ASSERT(reporter, emptyPath.contains(SkPATH_SEPARATOR));
85 } 86 }
86
87 #include "TestClassDef.h"
88 DEFINE_TESTCLASS("OSPath", OSPathTestClass, test_os_path_utils_tests)
OLDNEW
« no previous file with comments | « tests/MipMapTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698