Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
BRDTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8// Make sure SkUserConfig.h is included so #defines are available on
9// Android.
11#ifdef SK_ENABLE_ANDROID_UTILS
15#include "tests/Test.h"
16#include "tools/Resources.h"
17
18DEF_TEST(BRD_types, r) {
19 static const struct {
20 const char* name;
21 bool supported;
22 } gRec[] = {
23 { "images/arrow.png", true },
24 { "images/box.gif", false },
25 { "images/baby_tux.webp", true },
26 { "images/brickwork-texture.jpg", true },
27 { "images/color_wheel.ico", false },
28#ifdef SK_CODEC_DECODES_RAW
29 { "images/sample_1mp.dng", false },
30#endif
31 { "images/mandrill.wbmp", false },
32 { "images/randPixels.bmp", false },
33 };
34
35 for (const auto& rec : gRec) {
36 auto data = GetResourceAsData(rec.name);
37 if (!data) return;
38
39 REPORTER_ASSERT(r, SkCodec::MakeFromData(data) != nullptr);
41
43 if (rec.supported) {
44 if (!brd) ERRORF(r, "Failed to create BRD from %s", rec.name);
45 } else {
46 if (brd) ERRORF(r, "Should *not* create BRD from %s", rec.name);
47 }
48 }
49}
50#endif // SK_ENABLE_ANDROID_UTILS
static const struct @223 gRec[]
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition Resources.cpp:42
#define DEF_TEST(name, reporter)
Definition Test.h:312
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286
#define ERRORF(r,...)
Definition Test.h:293
static std::unique_ptr< SkAndroidCodec > MakeFromData(sk_sp< SkData >, SkPngChunkReader *=nullptr)
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
Definition SkCodec.cpp:241
static std::unique_ptr< BitmapRegionDecoder > Make(sk_sp< SkData > data)
const char * name
Definition fuchsia.cc:50
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41