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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3053 q.close(); | 3053 q.close(); |
3054 p.addPath(q, -4, -4); | 3054 p.addPath(q, -4, -4); |
3055 SkRect expected = {0, 0, 4, 4}; | 3055 SkRect expected = {0, 0, 4, 4}; |
3056 REPORTER_ASSERT(reporter, p.getBounds() == expected); | 3056 REPORTER_ASSERT(reporter, p.getBounds() == expected); |
3057 p.reset(); | 3057 p.reset(); |
3058 p.reverseAddPath(q); | 3058 p.reverseAddPath(q); |
3059 SkRect reverseExpected = {4, 4, 8, 8}; | 3059 SkRect reverseExpected = {4, 4, 8, 8}; |
3060 REPORTER_ASSERT(reporter, p.getBounds() == reverseExpected); | 3060 REPORTER_ASSERT(reporter, p.getBounds() == reverseExpected); |
3061 } | 3061 } |
3062 | 3062 |
3063 static void test_joinPath(skiatest::Reporter* reporter) { | |
3064 SkPath p, q; | |
3065 p.moveTo(1, 1); | |
3066 p.lineTo(1, 2); | |
3067 q.moveTo(2, 1); | |
3068 q.lineTo(2, 2); | |
3069 p.addPath(q, SkPath::kJoin_AddPathMode); | |
reed1
2014/02/07 17:13:06
Seems like we should have parallel tests for both
| |
3070 uint8_t verbs[4]; | |
3071 int verbcount = p.getVerbs(verbs, 4); | |
3072 REPORTER_ASSERT(reporter, verbcount == 4); | |
3073 REPORTER_ASSERT(reporter, verbs[0] == SkPath::kMove_Verb); | |
3074 REPORTER_ASSERT(reporter, verbs[1] == SkPath::kLine_Verb); | |
3075 REPORTER_ASSERT(reporter, verbs[2] == SkPath::kLine_Verb); | |
3076 REPORTER_ASSERT(reporter, verbs[3] == SkPath::kLine_Verb); | |
3077 } | |
3078 | |
3063 static void test_conicTo_special_case(skiatest::Reporter* reporter) { | 3079 static void test_conicTo_special_case(skiatest::Reporter* reporter) { |
3064 SkPath p; | 3080 SkPath p; |
3065 p.conicTo(1, 2, 3, 4, -1); | 3081 p.conicTo(1, 2, 3, 4, -1); |
3066 check_path_is_line_and_reset(reporter, &p, 3, 4); | 3082 check_path_is_line_and_reset(reporter, &p, 3, 4); |
3067 p.conicTo(1, 2, 3, 4, SK_ScalarInfinity); | 3083 p.conicTo(1, 2, 3, 4, SK_ScalarInfinity); |
3068 check_path_is_line_pair_and_reset(reporter, &p, 1, 2, 3, 4); | 3084 check_path_is_line_pair_and_reset(reporter, &p, 1, 2, 3, 4); |
3069 p.conicTo(1, 2, 3, 4, 1); | 3085 p.conicTo(1, 2, 3, 4, 1); |
3070 check_path_is_quad_and_reset(reporter, &p, 1, 2, 3, 4); | 3086 check_path_is_quad_and_reset(reporter, &p, 1, 2, 3, 4); |
3071 } | 3087 } |
3072 | 3088 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3370 test_bad_cubic_crbug229478(); | 3386 test_bad_cubic_crbug229478(); |
3371 test_bad_cubic_crbug234190(); | 3387 test_bad_cubic_crbug234190(); |
3372 test_android_specific_behavior(reporter); | 3388 test_android_specific_behavior(reporter); |
3373 test_gen_id(reporter); | 3389 test_gen_id(reporter); |
3374 test_path_close_issue1474(reporter); | 3390 test_path_close_issue1474(reporter); |
3375 test_path_to_region(reporter); | 3391 test_path_to_region(reporter); |
3376 test_rrect(reporter); | 3392 test_rrect(reporter); |
3377 test_arc(reporter); | 3393 test_arc(reporter); |
3378 test_arcTo(reporter); | 3394 test_arcTo(reporter); |
3379 test_addPath(reporter); | 3395 test_addPath(reporter); |
3396 test_joinPath(reporter); | |
3380 test_conicTo_special_case(reporter); | 3397 test_conicTo_special_case(reporter); |
3381 test_get_point(reporter); | 3398 test_get_point(reporter); |
3382 test_contains(reporter); | 3399 test_contains(reporter); |
3383 PathTest_Private::TestPathTo(reporter); | 3400 PathTest_Private::TestPathTo(reporter); |
3384 PathRefTest_Private::TestPathRef(reporter); | 3401 PathRefTest_Private::TestPathRef(reporter); |
3385 } | 3402 } |
OLD | NEW |