447 {
449
450
451
452
453
454
455
456 auto test = [&](
SkTypeface* typeface,
const Axis* expected,
int expectedCount,
457 int alsoAcceptedAxisTagCount)
458 {
459 if (!typeface) {
460 return;
461 }
462
464 if (actualCount == -1) {
465 return;
466 }
468 actualCount == alsoAcceptedAxisTagCount);
469
470 std::unique_ptr<Axis[]> actual(new Axis[actualCount]);
472 if (actualCount == -1) {
473 return;
474 }
476 actualCount == alsoAcceptedAxisTagCount);
477
478
479 std::unique_ptr<bool[]> expectedUsed(new bool[expectedCount]());
480 for (int actualIdx = 0; actualIdx < actualCount; ++actualIdx) {
481 bool actualFound = false;
482 for (int expectedIdx = 0; expectedIdx < expectedCount; ++expectedIdx) {
483 if (expectedUsed[expectedIdx]) {
484 continue;
485 }
486
487 if (actual[actualIdx].tag != expected[expectedIdx].tag) {
488 continue;
489 }
490
491
494 if (!(
SkTAbs(fixedActualMin - fixedExpectedMin) < 2)) {
495 continue;
496 }
497
500 if (!(
SkTAbs(fixedActualMax - fixedExpectedMax) < 2)) {
501 continue;
502 }
503
506 if (!(
SkTAbs(fixedActualDefault - fixedExpectedDefault) < 2)) {
507 continue;
508 }
509
510
511
512 if (actual[actualIdx].isHidden() &&
513 actual[actualIdx].isHidden() != expected[expectedIdx].isHidden())
514 {
515 continue;
516 }
517
518
519 actualFound = true;
520 expectedUsed[expectedIdx] = true;
521 break;
522 }
524 "Actual axis '%c%c%c%c' with min %f max %f default %f hidden %s not expected",
525 (char)((actual[actualIdx].tag >> 24) & 0xFF),
526 (char)((actual[actualIdx].tag >> 16) & 0xFF),
527 (char)((actual[actualIdx].tag >> 8) & 0xFF),
528 (char)((actual[actualIdx].tag ) & 0xFF),
529 actual[actualIdx].
min,
530 actual[actualIdx].def,
531 actual[actualIdx].
max,
532 actual[actualIdx].isHidden() ? "true" : "false");
533 }
534 };
535
537
538
539 {
541 if (!variable) {
543 return;
544 }
545 constexpr Axis expected[] = {
548 };
551 }
552
553
554 {
556 if (!dupTags) {
558 return;
559 }
560
561
562
563 constexpr Axis expected[] = {
566 };
569 }
570
571
572 {
574 if (!distortable) {
576 return;
577 }
578 constexpr Axis expected[] = {
580 };
583 }
584}
int getVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], int parameterCount) const
static float max(float r, float g, float b)
static float min(float r, float g, float b)