Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
TestFontDataProvider Class Reference

#include <TestFontDataProvider.h>

Classes

struct  LangSample
 
struct  TestSet
 

Public Member Functions

 TestFontDataProvider (const std::string &fontFilterRegexp, const std::string &langFilterRegexp)
 
bool next (TestSet *testSet)
 
void rewind ()
 

Detailed Description

Definition at line 19 of file TestFontDataProvider.h.

Constructor & Destructor Documentation

◆ TestFontDataProvider()

TestFontDataProvider::TestFontDataProvider ( const std::string &  fontFilterRegexp,
const std::string &  langFilterRegexp 
)

Definition at line 52 of file TestFontDataProvider.cpp.

54 : fFontFilter(fontFilterRegexp), fLangFilter(langFilterRegexp) {
55 SkString testDataLocation = prefixWithTestDataPath(SkString(kTestDataJsonFilename));
56 sk_sp<SkData> jsonTestData = SkData::MakeFromFileName(testDataLocation.c_str());
57 SkASSERTF(jsonTestData && jsonTestData->size(),
58 "Unable to access font test metadata at location %s, check bin/fetch-fonts-testdata.",
59 testDataLocation.c_str());
60 fJsonDom = std::make_unique<skjson::DOM>(reinterpret_cast<const char*>(jsonTestData->bytes()),
61 jsonTestData->size());
62 const skjson::ObjectValue& root = fJsonDom->root().as<skjson::ObjectValue>();
63 fFonts = root["fonts"];
64 SkASSERT(fFonts);
65 SkASSERTF(fFonts->size() == kExpectNumFonts,
66 "Unable to access all %zu test fonts (only got %zu), check bin/fetch-fonts-testdata.",
67 kExpectNumFonts,
68 fFonts->size());
69 fSamples = root["samples"];
70 SkASSERT(fSamples);
71}
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkASSERTF(cond, fmt,...)
Definition: SkAssert.h:117
const char kTestDataJsonFilename[]
const uint8_t * bytes() const
Definition: SkData.h:43
static sk_sp< SkData > MakeFromFileName(const char path[])
Definition: SkData.cpp:148
size_t size() const
Definition: SkData.h:30
const char * c_str() const
Definition: SkString.h:133
size_t size() const
Definition: SkJSON.h:262
string root
Definition: scale_cpu.py:20

Member Function Documentation

◆ next()

bool TestFontDataProvider::next ( TestSet testSet)

Definition at line 73 of file TestFontDataProvider.cpp.

73 {
74 while (testSet && fFontsIndex < fFonts->size()) {
75 const skjson::ObjectValue* fontsEntry = (*fFonts)[fFontsIndex++];
76 SkASSERT(fontsEntry);
77 const skjson::StringValue* fontName = (*fontsEntry)["name"];
78 SkASSERT(fontName);
79 std::smatch match;
80 std::string fontNameStr(fontName->str());
81 if (std::regex_match(fontNameStr, match, fFontFilter)) {
82 testSet->fontName = SkString(fontNameStr);
83 const skjson::StringValue* fontFilename = (*fontsEntry)["path"];
84 testSet->fontFilename = prefixWithFontsPath(
85 SkString(fontFilename->str().data(), fontFilename->str().size()));
86 testSet->langSamples =
87 getLanguageSamples((*fontsEntry)["languages"].as<skjson::ArrayValue>());
88 return true;
89 }
90 }
91 return false;
92}
static const ConicPts testSet[]
std::string_view str() const
Definition: SkJSON.h:327
def match(bench, filt)
Definition: benchmark.py:23
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
Definition: switches.h:259

◆ rewind()

void TestFontDataProvider::rewind ( )

Definition at line 94 of file TestFontDataProvider.cpp.

94{ fFontsIndex = 0; }

The documentation for this class was generated from the following files: