Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Added assertion up to cv99 for FontFeature.characterVariant #27745

Merged
merged 2 commits into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ui/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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")}');
}

Expand Down
1 change: 1 addition & 0 deletions testing/dart/text_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down