OLD | NEW |
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 <cmath> | 8 #include <cmath> |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" |
(...skipping 4111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4122 SkPath q; | 4122 SkPath q; |
4123 q.moveTo(10, 10); | 4123 q.moveTo(10, 10); |
4124 SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed)); | 4124 SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed)); |
4125 REPORTER_ASSERT(reporter, !changed); | 4125 REPORTER_ASSERT(reporter, !changed); |
4126 } | 4126 } |
4127 // q went out of scope. | 4127 // q went out of scope. |
4128 REPORTER_ASSERT(reporter, changed); | 4128 REPORTER_ASSERT(reporter, changed); |
4129 } | 4129 } |
4130 }; | 4130 }; |
4131 | 4131 |
| 4132 static void test_crbug_629455(skiatest::Reporter* reporter) { |
| 4133 SkPath path; |
| 4134 path.moveTo(0, 0); |
| 4135 path.cubicTo(SkBits2Float(0xcdcdcd00), SkBits2Float(0xcdcdcdcd), |
| 4136 SkBits2Float(0xcdcdcdcd), SkBits2Float(0xcdcdcdcd), |
| 4137 SkBits2Float(0x423fcdcd), SkBits2Float(0x40ed9341)); |
| 4138 // AKA: cubicTo(-4.31596e+08f, -4.31602e+08f, -4.31602e+08f, -4.31602e+08f, 47.
951f, 7.42423f); |
| 4139 path.lineTo(0, 0); |
| 4140 |
| 4141 auto surface = SkSurface::MakeRasterN32Premul(100, 100); |
| 4142 SkPaint paint; |
| 4143 paint.setAntiAlias(true); |
| 4144 surface->getCanvas()->drawPath(path, paint); |
| 4145 } |
| 4146 |
4132 static void test_interp(skiatest::Reporter* reporter) { | 4147 static void test_interp(skiatest::Reporter* reporter) { |
4133 SkPath p1, p2, out; | 4148 SkPath p1, p2, out; |
4134 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); | 4149 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); |
4135 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out)); | 4150 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out)); |
4136 REPORTER_ASSERT(reporter, p1 == out); | 4151 REPORTER_ASSERT(reporter, p1 == out); |
4137 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out)); | 4152 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out)); |
4138 REPORTER_ASSERT(reporter, p1 == out); | 4153 REPORTER_ASSERT(reporter, p1 == out); |
4139 p1.moveTo(0, 2); | 4154 p1.moveTo(0, 2); |
4140 p1.lineTo(0, 4); | 4155 p1.lineTo(0, 4); |
4141 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2)); | 4156 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2)); |
(...skipping 28 matching lines...) Expand all Loading... |
4170 | 4185 |
4171 DEF_TEST(PathInterp, reporter) { | 4186 DEF_TEST(PathInterp, reporter) { |
4172 test_interp(reporter); | 4187 test_interp(reporter); |
4173 } | 4188 } |
4174 | 4189 |
4175 DEF_TEST(PathContains, reporter) { | 4190 DEF_TEST(PathContains, reporter) { |
4176 test_contains(reporter); | 4191 test_contains(reporter); |
4177 } | 4192 } |
4178 | 4193 |
4179 DEF_TEST(Paths, reporter) { | 4194 DEF_TEST(Paths, reporter) { |
| 4195 test_crbug_629455(reporter); |
4180 test_fuzz_crbug_627414(reporter); | 4196 test_fuzz_crbug_627414(reporter); |
4181 test_path_crbug364224(); | 4197 test_path_crbug364224(); |
4182 | 4198 |
4183 SkTSize<SkScalar>::Make(3,4); | 4199 SkTSize<SkScalar>::Make(3,4); |
4184 | 4200 |
4185 SkPath p, empty; | 4201 SkPath p, empty; |
4186 SkRect bounds, bounds2; | 4202 SkRect bounds, bounds2; |
4187 test_empty(reporter, p); | 4203 test_empty(reporter, p); |
4188 | 4204 |
4189 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); | 4205 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4326 PathTest_Private::TestPathTo(reporter); | 4342 PathTest_Private::TestPathTo(reporter); |
4327 PathRefTest_Private::TestPathRef(reporter); | 4343 PathRefTest_Private::TestPathRef(reporter); |
4328 PathTest_Private::TestPathrefListeners(reporter); | 4344 PathTest_Private::TestPathrefListeners(reporter); |
4329 test_dump(reporter); | 4345 test_dump(reporter); |
4330 test_path_crbug389050(reporter); | 4346 test_path_crbug389050(reporter); |
4331 test_path_crbugskia2820(reporter); | 4347 test_path_crbugskia2820(reporter); |
4332 test_skbug_3469(reporter); | 4348 test_skbug_3469(reporter); |
4333 test_skbug_3239(reporter); | 4349 test_skbug_3239(reporter); |
4334 test_bounds_crbug_513799(reporter); | 4350 test_bounds_crbug_513799(reporter); |
4335 } | 4351 } |
OLD | NEW |