OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 | 9 |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 SkASSERT(FindColor(nameRGB.name, &result) != NULL); | 506 SkASSERT(FindColor(nameRGB.name, &result) != NULL); |
507 SkASSERT(result == (SkColor) (nameRGB.rgb | 0xFF000000)); | 507 SkASSERT(result == (SkColor) (nameRGB.rgb | 0xFF000000)); |
508 } | 508 } |
509 for (index = 0; index < colorNamesSize; index++) { | 509 for (index = 0; index < colorNamesSize; index++) { |
510 result = SK_ColorBLACK; | 510 result = SK_ColorBLACK; |
511 SkNameRGB nameRGB = colorNames[index]; | 511 SkNameRGB nameRGB = colorNames[index]; |
512 char bad[24]; | 512 char bad[24]; |
513 size_t len = strlen(nameRGB.name); | 513 size_t len = strlen(nameRGB.name); |
514 memcpy(bad, nameRGB.name, len); | 514 memcpy(bad, nameRGB.name, len); |
515 bad[len - 1] -= 1; | 515 bad[len - 1] -= 1; |
516 SkASSERT(FindColor(bad, &result) == false); | 516 SkASSERT(FindColor(bad, &result) == NULL); |
517 bad[len - 1] += 2; | 517 bad[len - 1] += 2; |
518 SkASSERT(FindColor(bad, &result) == false); | 518 SkASSERT(FindColor(bad, &result) == NULL); |
519 } | 519 } |
520 result = SK_ColorBLACK; | 520 result = SK_ColorBLACK; |
521 SkASSERT(FindColor("lightGrey", &result)); | 521 SkASSERT(FindColor("lightGrey", &result)); |
522 SkASSERT(result == 0xffd3d3d3); | 522 SkASSERT(result == 0xffd3d3d3); |
523 // SkASSERT(FindColor("12,34,56,78", &result)); | 523 // SkASSERT(FindColor("12,34,56,78", &result)); |
524 // SkASSERT(result == ((12 << 24) | (34 << 16) | (56 << 8) | (78 << 0))); | 524 // SkASSERT(result == ((12 << 24) | (34 << 16) | (56 << 8) | (78 << 0))); |
525 result = SK_ColorBLACK; | 525 result = SK_ColorBLACK; |
526 SkASSERT(FindColor("#ABCdef", &result)); | 526 SkASSERT(FindColor("#ABCdef", &result)); |
527 SkASSERT(result == 0XFFABCdef); | 527 SkASSERT(result == 0XFFABCdef); |
528 SkASSERT(FindColor("#12ABCdef", &result)); | 528 SkASSERT(FindColor("#12ABCdef", &result)); |
529 SkASSERT(result == 0X12ABCdef); | 529 SkASSERT(result == 0X12ABCdef); |
530 result = SK_ColorBLACK; | 530 result = SK_ColorBLACK; |
531 SkASSERT(FindColor("#123", &result)); | 531 SkASSERT(FindColor("#123", &result)); |
532 SkASSERT(result == 0Xff112233); | 532 SkASSERT(result == 0Xff112233); |
533 SkASSERT(FindColor("#abcd", &result)); | 533 SkASSERT(FindColor("#abcd", &result)); |
534 SkASSERT(result == 0Xaabbccdd); | 534 SkASSERT(result == 0Xaabbccdd); |
535 result = SK_ColorBLACK; | 535 result = SK_ColorBLACK; |
536 // SkASSERT(FindColor("71,162,253", &result)); | 536 // SkASSERT(FindColor("71,162,253", &result)); |
537 // SkASSERT(result == ((0xFF << 24) | (71 << 16) | (162 << 8) | (253 << 0))); | 537 // SkASSERT(result == ((0xFF << 24) | (71 << 16) | (162 << 8) | (253 << 0))); |
538 } | 538 } |
539 #endif | 539 #endif |
OLD | NEW |