Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
TestFontDataProvider.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 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#ifndef RasterTestData_DEFINED
9#define RasterTestData_DEFINED
10
12#include "src/utils/SkJSON.h"
13
14#include <regex>
15#include <string>
16
17// Iterates over test data from the font tests CIPD, allows filtering for fonts and test samples
18// languages using C++ regular expressions.
20public:
26
27 struct TestSet {
30 std::vector<LangSample> langSamples;
31 };
32
33 TestFontDataProvider(const std::string& fontFilterRegexp, const std::string& langFilterRegexp);
34
35 bool next(TestSet* testSet);
36
37 void rewind();
38
39private:
40 std::vector<LangSample> getLanguageSamples(const skjson::ArrayValue* languages);
41 std::regex fFontFilter;
42 std::regex fLangFilter;
43 size_t fFontsIndex = 0;
44 std::unique_ptr<skjson::DOM> fJsonDom;
45 const skjson::ArrayValue* fFonts;
46 const skjson::ObjectValue* fSamples;
47};
48
49namespace skiatest {
50
51/**
52 * Set font test data directory. Overrides the location of the extracted googlefonts_testdata CIPD
53 * archive.
54 */
56
57} // namespace skiatest
58
59#endif
static const ConicPts testSet[]
bool next(TestSet *testSet)
void SetFontTestDataDirectory()
std::vector< LangSample > langSamples