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

Side by Side Diff: tests/WArrayTest.cpp

Issue 26962002: Remove unnamed namespace usage from tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: revert AreEqual change Created 7 years, 2 months 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/TileGridTest.cpp ('k') | tests/WritePixelsTest.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 2011 Google Inc. 2 * Copyright 2011 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" 8 #include "Test.h"
9 9
10 // Include the implementation so we can make an appropriate template instance. 10 // Include the implementation so we can make an appropriate template instance.
11 #include "SkAdvancedTypefaceMetrics.h" 11 #include "SkAdvancedTypefaceMetrics.h"
12 12
13 using namespace skia_advanced_typeface_metrics_utils; 13 using namespace skia_advanced_typeface_metrics_utils;
14 14
15 namespace {
16
17 // Negative values and zeros in a range plus trailing zeros. 15 // Negative values and zeros in a range plus trailing zeros.
18 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
19 const int16_t data1[] = {-1, 0, -3, 4, 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, 0}; 17 static const int16_t data1[] = {-1, 0, -3, 4, 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, 0};
20 const char* expected1 = "0[-1 0 -3 4 5 6 7 0 0 0 8]"; 18 static const char* expected1 = "0[-1 0 -3 4 5 6 7 0 0 0 8]";
21 19
22 // Run with leading and trailing zeros. 20 // Run with leading and trailing zeros.
23 // Test rules: d 0 1 2 3 4 5 6 7 8 9 10 11 21 // Test rules: d 0 1 2 3 4 5 6 7 8 9 10 11
24 const int16_t data2[] = {0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 0, 0}; 22 static const int16_t data2[] = {0, 0, 0, 100, 100, 100, 100, 100, 100, 100, 0, 0 };
25 const char* expected2 = "3 9 100"; 23 static const char* expected2 = "3 9 100";
26 24
27 // Removing 0's from a range. 25 // Removing 0's from a range.
28 // Test rules: a 0 1 2 3 4 5 6 7 8 9 10 11 26 // Test rules: a 0 1 2 3 4 5 6 7 8 9 10 11
29 const int16_t data3[] = {1, 2, 0, 0, 0, 3, 4, 0, 0, 0, 0, 5}; 27 static const int16_t data3[] = {1, 2, 0, 0, 0, 3, 4, 0, 0, 0, 0, 5};
30 const char* expected3 = "0[1 2 0 0 0 3 4] 11[5]"; 28 static const char* expected3 = "0[1 2 0 0 0 3 4] 11[5]";
31 29
32 // Removing 0's from a run/range and between runs. 30 // Removing 0's from a run/range and between runs.
33 // Test rules: a, b 0 1 2 3 4 5 6 7 8 9 10 11 12 14 15 31 // Test rules: a, b 0 1 2 3 4 5 6 7 8 9 10 11 12 14 15
34 const int16_t data4[] = {1, 0, 0, 0, 1, 2, 2, 2, 3, 0, 0, 0, 0, 3, 4}; 32 static const int16_t data4[] = {1, 0, 0, 0, 1, 2, 2, 2, 3, 0, 0, 0, 0, 3, 4};
35 const char* expected4 = "0[1 0 0 0 1] 5 7 2 8[3] 13[3 4]"; 33 static const char* expected4 = "0[1 0 0 0 1] 5 7 2 8[3] 13[3 4]";
36 34
37 // Runs that starts outside a range. 35 // Runs that starts outside a range.
38 // Test rules: a, e 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 36 // Test rules: a, e 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
39 const int16_t data5[] = {1, 1, 2, 3, 0, 0, 0, 0, 5, 5, 6, 7, 0, 0, 0, 0, 8, 0}; 37 static const int16_t data5[] = {1, 1, 2, 3, 0, 0, 0, 0, 5, 5, 6, 7, 0, 0, 0, 0, 8, 0};
40 const char* expected5 = "0 1 1 2[2 3] 8 9 5 10[6 7] 16[8]"; 38 static const char* expected5 = "0 1 1 2[2 3] 8 9 5 10[6 7] 16[8]";
41 39
42 // Zeros and runs that should be broken out. 40 // Zeros and runs that should be broken out.
43 // Test rules: a, b, e 0 1 2 3 4 5 6 7 8 9 10 11 12 13 41 // Test rules: a, b, e 0 1 2 3 4 5 6 7 8 9 10 11 12 13
44 const int16_t data6[] = {1, 0, 0, 0, 0, 1, 2, 3, 3, 4, 5, 5, 5, 6}; 42 static const int16_t data6[] = {1, 0, 0, 0, 0, 1, 2, 3, 3, 4, 5, 5, 5, 6};
45 const char* expected6 = "0[1] 5[1 2 3 3 4] 10 12 5 13[6]"; 43 static const char* expected6 = "0[1] 5[1 2 3 3 4] 10 12 5 13[6]";
46 44
47 // Don't cares that aren't enough to break out a run. 45 // Don't cares that aren't enough to break out a run.
48 // Test rules: c 0 1 2 3 4 5 46 // Test rules: c 0 1 2 3 4 5
49 const int16_t data7[] = {1, 2, 10, 11, 2, 3}; 47 static const int16_t data7[] = {1, 2, 10, 11, 2, 3};
50 const char* expected7 = "0[1 2 10 11 2 3]"; 48 static const char* expected7 = "0[1 2 10 11 2 3]";
51 const uint32_t subset7[] = {0, 1, 4, 5}; 49 static const uint32_t subset7[] = {0, 1, 4, 5};
52 const char* expectedSubset7 = "0[1 2 0 0 2 3]"; 50 static const char* expectedSubset7 = "0[1 2 0 0 2 3]";
53 51
54 // Don't cares that are enough to break out a run. 52 // Don't cares that are enough to break out a run.
55 // Test rules: c 0 1 2 3 4 5 6 53 // Test rules: c 0 1 2 3 4 5 6
56 const int16_t data8[] = {1, 2, 10, 11, 12, 2, 3}; 54 static const int16_t data8[] = {1, 2, 10, 11, 12, 2, 3};
57 const char* expected8 = "0[1 2 10 11 12 2 3]"; 55 static const char* expected8 = "0[1 2 10 11 12 2 3]";
58 const uint32_t subset8[] = {0, 1, 5, 6}; 56 static const uint32_t subset8[] = {0, 1, 5, 6};
59 const char* expectedSubset8 = "0[1] 1 5 2 6[3]"; 57 static const char* expectedSubset8 = "0[1] 1 5 2 6[3]";
60 58
61 // Leading don't cares. 59 // Leading don't cares.
62 // Test rules: d 0 1 2 3 4 60 // Test rules: d 0 1 2 3 4
63 const int16_t data9[] = {1, 1, 10, 2, 3}; 61 static const int16_t data9[] = {1, 1, 10, 2, 3};
64 const char* expected9 = "0 1 1 2[10 2 3]"; 62 static const char* expected9 = "0 1 1 2[10 2 3]";
65 const uint32_t subset9[] = {0, 1, 3, 4}; 63 static const uint32_t subset9[] = {0, 1, 3, 4};
66 const char* expectedSubset9 = "0 1 1 3[2 3]"; 64 static const char* expectedSubset9 = "0 1 1 3[2 3]";
67 65
68 // Almost run of don't cares inside a range. 66 // Almost run of don't cares inside a range.
69 // Test rules: c 0 1 2 3 4 5 67 // Test rules: c 0 1 2 3 4 5
70 const int16_t data10[] = {1, 2, 10, 11, 12, 3}; 68 static const int16_t data10[] = {1, 2, 10, 11, 12, 3};
71 const char* expected10 = "0[1 2 10 11 12 3]"; 69 static const char* expected10 = "0[1 2 10 11 12 3]";
72 const uint32_t subset10[] = {0, 1, 5}; 70 static const uint32_t subset10[] = {0, 1, 5};
73 const char* expectedSubset10 = "0[1 2 0 0 0 3]"; 71 static const char* expectedSubset10 = "0[1 2 0 0 0 3]";
74 72
75 // Run of don't cares inside a range. 73 // Run of don't cares inside a range.
76 // Test rules: c 0 1 2 3 4 5 6 74 // Test rules: c 0 1 2 3 4 5 6
77 const int16_t data11[] = {1, 2, 10, 11, 12, 13, 3}; 75 static const int16_t data11[] = {1, 2, 10, 11, 12, 13, 3};
78 const char* expected11 = "0[1 2 10 11 12 13 3]"; 76 static const char* expected11 = "0[1 2 10 11 12 13 3]";
79 const uint32_t subset11[] = {0, 1, 6}; 77 static const uint32_t subset11[] = {0, 1, 6};
80 const char* expectedSubset11 = "0[1 2] 6[3]"; 78 static const char* expectedSubset11 = "0[1 2] 6[3]";
81 79
82 // Almost run within a range with leading don't cares. 80 // Almost run within a range with leading don't cares.
83 // Test rules: c 0 1 2 3 4 5 6 81 // Test rules: c 0 1 2 3 4 5 6
84 const int16_t data12[] = {1, 10, 11, 2, 12, 13, 3}; 82 static const int16_t data12[] = {1, 10, 11, 2, 12, 13, 3};
85 const char* expected12 = "0[1 10 11 2 12 13 3]"; 83 static const char* expected12 = "0[1 10 11 2 12 13 3]";
86 const uint32_t subset12[] = {0, 3, 6}; 84 static const uint32_t subset12[] = {0, 3, 6};
87 const char* expectedSubset12 = "0[1 0 0 2 0 0 3]"; 85 static const char* expectedSubset12 = "0[1 0 0 2 0 0 3]";
88 86
89 // Run within a range with leading don't cares. 87 // Run within a range with leading don't cares.
90 // Test rules: c 0 1 2 3 4 5 6 7 88 // Test rules: c 0 1 2 3 4 5 6 7
91 const int16_t data13[] = {1, 10, 11, 2, 2, 12, 13, 3}; 89 static const int16_t data13[] = {1, 10, 11, 2, 2, 12, 13, 3};
92 const char* expected13 = "0[1 10 11 2 2 12 13 3]"; 90 static const char* expected13 = "0[1 10 11 2 2 12 13 3]";
93 const uint32_t subset13[] = {0, 3, 4, 7}; 91 static const uint32_t subset13[] = {0, 3, 4, 7};
94 const char* expectedSubset13 = "0[1] 1 6 2 7[3]"; 92 static const char* expectedSubset13 = "0[1] 1 6 2 7[3]";
95 93
96 // Enough don't cares to breakup something. 94 // Enough don't cares to breakup something.
97 // Test rules: a 0 1 2 3 4 5 95 // Test rules: a 0 1 2 3 4 5
98 const int16_t data14[] = {1, 0, 0, 0, 0, 2}; 96 static const int16_t data14[] = {1, 0, 0, 0, 0, 2};
99 const char* expected14 = "0[1] 5[2]"; 97 static const char* expected14 = "0[1] 5[2]";
100 const uint32_t subset14[] = {0, 5}; 98 static const uint32_t subset14[] = {0, 5};
101 const char* expectedSubset14 = "0[1] 5[2]"; 99 static const char* expectedSubset14 = "0[1] 5[2]";
102
103 }
104 100
105 static SkString stringify_advance_data(SkAdvancedTypefaceMetrics::AdvanceMetric< int16_t>* data) { 101 static SkString stringify_advance_data(SkAdvancedTypefaceMetrics::AdvanceMetric< int16_t>* data) {
106 SkString result; 102 SkString result;
107 bool leadingSpace = false; 103 bool leadingSpace = false;
108 while (data != NULL) { 104 while (data != NULL) {
109 if (leadingSpace) { 105 if (leadingSpace) {
110 result.append(" "); 106 result.append(" ");
111 } else { 107 } else {
112 leadingSpace = true; 108 leadingSpace = true;
113 } 109 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13); 201 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13);
206 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, 202 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13,
207 SK_ARRAY_COUNT(subset13), expectedSubset13); 203 SK_ARRAY_COUNT(subset13), expectedSubset13);
208 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14); 204 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14);
209 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, 205 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14,
210 SK_ARRAY_COUNT(subset14), expectedSubset14); 206 SK_ARRAY_COUNT(subset14), expectedSubset14);
211 } 207 }
212 208
213 #include "TestClassDef.h" 209 #include "TestClassDef.h"
214 DEFINE_TESTCLASS("WArray", WArrayTest, TestWArray) 210 DEFINE_TESTCLASS("WArray", WArrayTest, TestWArray)
OLDNEW
« no previous file with comments | « tests/TileGridTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698