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

Side by Side Diff: tests/StringTest.cpp

Issue 117053002: remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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
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 #include "TestClassDef.h" 9 #include "TestClassDef.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 REPORTER_ASSERT(reporter, a.equals("000000016777216")); 150 REPORTER_ASSERT(reporter, a.equals("000000016777216"));
151 151
152 static const struct { 152 static const struct {
153 SkScalar fValue; 153 SkScalar fValue;
154 const char* fString; 154 const char* fString;
155 } gRec[] = { 155 } gRec[] = {
156 { 0, "0" }, 156 { 0, "0" },
157 { SK_Scalar1, "1" }, 157 { SK_Scalar1, "1" },
158 { -SK_Scalar1, "-1" }, 158 { -SK_Scalar1, "-1" },
159 { SK_Scalar1/2, "0.5" }, 159 { SK_Scalar1/2, "0.5" },
160 #ifdef SK_SCALAR_IS_FLOAT
161 #ifdef SK_BUILD_FOR_WIN 160 #ifdef SK_BUILD_FOR_WIN
162 { 3.4028234e38f, "3.4028235e+038" }, 161 { 3.4028234e38f, "3.4028235e+038" },
163 { -3.4028234e38f, "-3.4028235e+038" }, 162 { -3.4028234e38f, "-3.4028235e+038" },
164 #else 163 #else
165 { 3.4028234e38f, "3.4028235e+38" }, 164 { 3.4028234e38f, "3.4028235e+38" },
166 { -3.4028234e38f, "-3.4028235e+38" }, 165 { -3.4028234e38f, "-3.4028235e+38" },
167 #endif 166 #endif
168 #endif
169 }; 167 };
170 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { 168 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
171 a.reset(); 169 a.reset();
172 a.appendScalar(gRec[i].fValue); 170 a.appendScalar(gRec[i].fValue);
173 REPORTER_ASSERT(reporter, a.size() <= SkStrAppendScalar_MaxSize); 171 REPORTER_ASSERT(reporter, a.size() <= SkStrAppendScalar_MaxSize);
174 // SkDebugf(" received <%s> expected <%s>\n", a.c_str(), gRec[i].fString) ; 172 // SkDebugf(" received <%s> expected <%s>\n", a.c_str(), gRec[i].fString) ;
175 REPORTER_ASSERT(reporter, a.equals(gRec[i].fString)); 173 REPORTER_ASSERT(reporter, a.equals(gRec[i].fString));
176 } 174 }
177 175
178 REPORTER_ASSERT(reporter, SkStringPrintf("%i", 0).equals("0")); 176 REPORTER_ASSERT(reporter, SkStringPrintf("%i", 0).equals("0"));
(...skipping 15 matching lines...) Expand all
194 192
195 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results); 193 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results);
196 REPORTER_ASSERT(r, results.count() == 6); 194 REPORTER_ASSERT(r, results.count() == 6);
197 REPORTER_ASSERT(r, results[0].equals("a")); 195 REPORTER_ASSERT(r, results[0].equals("a"));
198 REPORTER_ASSERT(r, results[1].equals("b")); 196 REPORTER_ASSERT(r, results[1].equals("b"));
199 REPORTER_ASSERT(r, results[2].equals("c")); 197 REPORTER_ASSERT(r, results[2].equals("c"));
200 REPORTER_ASSERT(r, results[3].equals("dee")); 198 REPORTER_ASSERT(r, results[3].equals("dee"));
201 REPORTER_ASSERT(r, results[4].equals("f")); 199 REPORTER_ASSERT(r, results[4].equals("f"));
202 REPORTER_ASSERT(r, results[5].equals("g")); 200 REPORTER_ASSERT(r, results[5].equals("g"));
203 } 201 }
OLDNEW
« src/core/SkCanvas.cpp ('K') | « tests/ScalarTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698