524 {
526 return;
527 }
528
531 if (!stream1.isValid()) {
532 ERRORF(r,
"Could not create SkFILEStream from %s", filename.
c_str());
533 return;
534 }
537
538
539
540
541 const size_t size = stream1.getLength();
542 const size_t middle =
size / 2;
543 if (!stream1.seek(middle)) {
544 ERRORF(r,
"Could not seek SkFILEStream to %zu out of %zu", middle,
size);
545 return;
546 }
548
551 ERRORF(r,
"Could not open %s as a FILE", filename.
c_str());
552 return;
553 }
554
555 if (fseek(
file, (
long) middle, SEEK_SET) != 0) {
556 ERRORF(r,
"Could not fseek FILE to %zu out of %zu", middle,
size);
557 return;
558 }
560
561 const size_t remaining =
size - middle;
563 REPORTER_ASSERT(r, stream1.read(expected.get(), remaining) == remaining);
564
565 auto test_full_read = [&r, &expected, remaining](
SkStream*
stream) {
569
572 };
573
575
581 };
582
584
587
590
594
597
598
602 };
603
604 auto test_seek = [&r, &expected, middle, remaining](
SkStream*
stream) {
605
606 const size_t arbitrary = middle / 2;
609 const size_t miniRemaining = remaining - arbitrary;
612 REPORTER_ASSERT(r, !memcmp(expected.get() + arbitrary, actual.get(), miniRemaining));
613 };
614
615 auto test_seek_beginning = [&r, &expected, remaining](
SkStream*
stream) {
616
622 };
623
625
627
631
632 const size_t middle = remaining / 2;
636
640
644 };
645
646
651
656 test_seek_beginning(
stream);
658
659 if (recurse) {
660
661 auto duplicate =
stream->duplicate();
662 if (!duplicate) {
663 ERRORF(r,
"Failed to duplicate the stream!");
664 } else {
665 test_all(duplicate.get(), false);
666 }
667
668
669 auto fork =
stream->fork();
670 if (!fork) {
671 ERRORF(r,
"Failed to fork the stream!");
672 } else {
676
677 test_all(fork.get(), false);
678 }
679 }
680 };
681
682 test_all(&stream2, true);
683}
SkString GetResourcePath(const char *resource)
FILE * sk_fopen(const char path[], SkFILE_Flags)
static void test_rewind(skiatest::Reporter *reporter)
const char * c_str() const
Dart_NativeFunction function
static float max(float r, float g, float b)
static float min(float r, float g, float b)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size