| 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 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| 11 #include "SkPath.h" | 11 #include "SkPath.h" |
| 12 #include "SkParse.h" | 12 #include "SkParse.h" |
| 13 #include "SkParsePath.h" | 13 #include "SkParsePath.h" |
| 14 #include "SkPathEffect.h" | 14 #include "SkPathEffect.h" |
| 15 #include "SkRandom.h" | 15 #include "SkRandom.h" |
| 16 #include "SkReader32.h" | 16 #include "SkReader32.h" |
| 17 #include "SkSize.h" | 17 #include "SkSize.h" |
| 18 #include "SkSurface.h" |
| 19 #include "SkTypes.h" |
| 18 #include "SkWriter32.h" | 20 #include "SkWriter32.h" |
| 19 #include "SkSurface.h" | |
| 20 | 21 |
| 21 #if defined(WIN32) | 22 #if defined(WIN32) |
| 22 #define SUPPRESS_VISIBILITY_WARNING | 23 #define SUPPRESS_VISIBILITY_WARNING |
| 23 #else | 24 #else |
| 24 #define SUPPRESS_VISIBILITY_WARNING __attribute__((visibility("hidden"))) | 25 #define SUPPRESS_VISIBILITY_WARNING __attribute__((visibility("hidden"))) |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 static SkSurface* new_surface(int w, int h) { | 28 static SkSurface* new_surface(int w, int h) { |
| 28 SkImage::Info info = { | 29 SkImage::Info info = { |
| 29 w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType | 30 w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType |
| 30 }; | 31 }; |
| 31 return SkSurface::NewRaster(info); | 32 return SkSurface::NewRaster(info); |
| 32 } | 33 } |
| 33 | 34 |
| 35 static void test_android_specific_behavior(skiatest::Reporter* reporter) { |
| 36 #ifdef SK_BUILD_FOR_ANDROID |
| 37 // Copy constructor should preserve generation ID, but assignment shouldn't. |
| 38 SkPath original; |
| 39 original.moveTo(0, 0); |
| 40 original.lineTo(1, 1); |
| 41 REPORTER_ASSERT(original.getGenerationID() > 0); |
| 42 |
| 43 const SkPath copy(original); |
| 44 REPORTER_ASSERT(copy.getGenerationID() == original.getGenerationID()); |
| 45 |
| 46 SkPath assign; |
| 47 assign = original; |
| 48 REPORTER_ASSERT(assign.getGenerationID() != original.getGenerationID()); |
| 49 #endif |
| 50 } |
| 51 |
| 34 // This used to assert in the debug build, as the edges did not all line-up. | 52 // This used to assert in the debug build, as the edges did not all line-up. |
| 35 static void test_bad_cubic_crbug234190() { | 53 static void test_bad_cubic_crbug234190() { |
| 36 SkPath path; | 54 SkPath path; |
| 37 path.moveTo(13.8509f, 3.16858f); | 55 path.moveTo(13.8509f, 3.16858f); |
| 38 path.cubicTo(-2.35893e+08f, -4.21044e+08f, | 56 path.cubicTo(-2.35893e+08f, -4.21044e+08f, |
| 39 -2.38991e+08f, -4.26573e+08f, | 57 -2.38991e+08f, -4.26573e+08f, |
| 40 -2.41016e+08f, -4.30188e+08f); | 58 -2.41016e+08f, -4.30188e+08f); |
| 41 | 59 |
| 42 SkPaint paint; | 60 SkPaint paint; |
| 43 paint.setAntiAlias(true); | 61 paint.setAntiAlias(true); |
| (...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2443 test_isfinite(reporter); | 2461 test_isfinite(reporter); |
| 2444 test_isfinite_after_transform(reporter); | 2462 test_isfinite_after_transform(reporter); |
| 2445 test_arb_round_rect_is_convex(reporter); | 2463 test_arb_round_rect_is_convex(reporter); |
| 2446 test_arb_zero_rad_round_rect_is_rect(reporter); | 2464 test_arb_zero_rad_round_rect_is_rect(reporter); |
| 2447 test_addrect_isfinite(reporter); | 2465 test_addrect_isfinite(reporter); |
| 2448 test_tricky_cubic(); | 2466 test_tricky_cubic(); |
| 2449 test_clipped_cubic(); | 2467 test_clipped_cubic(); |
| 2450 test_crbug_170666(); | 2468 test_crbug_170666(); |
| 2451 test_bad_cubic_crbug229478(); | 2469 test_bad_cubic_crbug229478(); |
| 2452 test_bad_cubic_crbug234190(); | 2470 test_bad_cubic_crbug234190(); |
| 2471 test_android_specific_behavior(reporter); |
| 2453 } | 2472 } |
| 2454 | 2473 |
| 2455 #include "TestClassDef.h" | 2474 #include "TestClassDef.h" |
| 2456 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) | 2475 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) |
| OLD | NEW |