Flutter Engine
The Flutter Engine
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
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)
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63