OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 // Unit tests for src/core/SkPoint.cpp and its header | 8 // Unit tests for src/core/SkPoint.cpp and its header |
9 | 9 |
10 #include "SkPoint.h" | 10 #include "SkPoint.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 SkPoint pt = { 1.0e-37f, 1.0e-37f }; | 110 SkPoint pt = { 1.0e-37f, 1.0e-37f }; |
111 SkPoint copy = pt; | 111 SkPoint copy = pt; |
112 | 112 |
113 REPORTER_ASSERT(reporter, 0 == SkPoint::Normalize(&pt)); | 113 REPORTER_ASSERT(reporter, 0 == SkPoint::Normalize(&pt)); |
114 REPORTER_ASSERT(reporter, pt == copy); // pt is unchanged | 114 REPORTER_ASSERT(reporter, pt == copy); // pt is unchanged |
115 | 115 |
116 REPORTER_ASSERT(reporter, !pt.setLength(SK_Scalar1)); | 116 REPORTER_ASSERT(reporter, !pt.setLength(SK_Scalar1)); |
117 REPORTER_ASSERT(reporter, pt == copy); // pt is unchanged | 117 REPORTER_ASSERT(reporter, pt == copy); // pt is unchanged |
118 } | 118 } |
119 | 119 |
120 #include "TestClassDef.h" | |
121 DEF_TEST(Point, reporter) { | 120 DEF_TEST(Point, reporter) { |
122 test_casts(reporter); | 121 test_casts(reporter); |
123 | 122 |
124 static const struct { | 123 static const struct { |
125 SkScalar fX; | 124 SkScalar fX; |
126 SkScalar fY; | 125 SkScalar fY; |
127 SkScalar fLength; | 126 SkScalar fLength; |
128 } gRec[] = { | 127 } gRec[] = { |
129 { SkIntToScalar(3), SkIntToScalar(4), SkIntToScalar(5) }, | 128 { SkIntToScalar(3), SkIntToScalar(4), SkIntToScalar(5) }, |
130 { 0.6f, 0.8f, SK_Scalar1 }, | 129 { 0.6f, 0.8f, SK_Scalar1 }, |
(...skipping 19 matching lines...) Expand all Loading... |
150 slow.setLength(tests[i]); | 149 slow.setLength(tests[i]); |
151 fast.setLengthFast(tests[i]); | 150 fast.setLengthFast(tests[i]); |
152 | 151 |
153 if (slow.length() < FLT_MIN && fast.length() < FLT_MIN) continue; | 152 if (slow.length() < FLT_MIN && fast.length() < FLT_MIN) continue; |
154 | 153 |
155 SkScalar ratio = slow.length() / fast.length(); | 154 SkScalar ratio = slow.length() / fast.length(); |
156 REPORTER_ASSERT(reporter, ratio > 0.999f); | 155 REPORTER_ASSERT(reporter, ratio > 0.999f); |
157 REPORTER_ASSERT(reporter, ratio < 1.001f); | 156 REPORTER_ASSERT(reporter, ratio < 1.001f); |
158 } | 157 } |
159 } | 158 } |
OLD | NEW |