Added assertion up to cv99 for FontFeature.characterVariant (flutter/engine#27745)
* Added assertion up to cv99 for FontFeature.characterVariant * Added FontFeature.characterVariant(99) test
This commit is contained in:
@@ -472,7 +472,7 @@ class FontFeature {
|
||||
/// * <https://docs.microsoft.com/en-us/typography/opentype/spec/features_ae#cv01-cv99>
|
||||
factory FontFeature.characterVariant(int value) {
|
||||
assert(value >= 1);
|
||||
assert(value <= 20);
|
||||
assert(value <= 99);
|
||||
return FontFeature('cv${value.toString().padLeft(2, "0")}');
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ void testFontFeatureClass() {
|
||||
expect(const FontFeature.caseSensitiveForms(), const FontFeature('case', 1));
|
||||
expect( FontFeature.characterVariant(1), const FontFeature('cv01', 1));
|
||||
expect( FontFeature.characterVariant(18), const FontFeature('cv18', 1));
|
||||
expect( FontFeature.characterVariant(99), const FontFeature('cv99', 1));
|
||||
expect(const FontFeature.denominator(), const FontFeature('dnom', 1));
|
||||
expect(const FontFeature.fractions(), const FontFeature('frac', 1));
|
||||
expect(const FontFeature.historicalForms(), const FontFeature('hist', 1));
|
||||
|
||||
Reference in New Issue
Block a user