Move examples from dart:ui ui/lib/text.dart to examples/api (#96557)
This extracts the examples that are in flutter/engine@main/lib/ui/text.dart into examples in the examples/api/lib/ui directory and adds some simple tests for them. Also, fixes some inconsistent test file naming. This is step 1: the next step is to remove the examples from the dart:ui code.
This commit is contained in:
29
examples/api/test/ui/text/font_feature.0_test.dart
Normal file
29
examples/api/test/ui/text/font_feature.0_test.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsNWidgets(9));
|
||||
expect((tester.widget(find.byType(Text).at(0)) as Text).style!.fontSize, equals(18.0));
|
||||
expect((tester.widget(find.byType(Text).at(1)) as Text).style!.fontFamily, equals('Cardo'));
|
||||
expect((tester.widget(find.byType(Text).at(3)) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.oldstyleFigures()]));
|
||||
expect((tester.widget(find.byType(Text).at(5)) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.alternativeFractions()]));
|
||||
expect((tester.widget(find.byType(Text).at(8)) as Text).style!.fontFeatures,
|
||||
equals(<FontFeature>[FontFeature.stylisticSet(1)]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_alternative.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Raleway'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.alternative(1)]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_alternative_fractions.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Ubuntu Mono'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.alternativeFractions()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.caseSensitiveForms()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_character_variant.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro'));
|
||||
expect(
|
||||
(tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(<FontFeature>[
|
||||
FontFeature.characterVariant(1),
|
||||
FontFeature.characterVariant(2),
|
||||
FontFeature.characterVariant(4),
|
||||
]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_contextual_alternates.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Barriecito'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.contextualAlternates()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_denominator.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.denominator()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_fractions.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Ubuntu Mono'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.fractions()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_historical_forms.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.historicalForms()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_historical_ligatures.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.historicalForms(), FontFeature.historicalLigatures()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_lining_figures.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.liningFigures()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_locale_aware.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Noto Sans'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).locale, equals(const Locale('zh', 'CN')));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_notational_forms.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Gothic A1'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.notationalForms(3)]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_numerators.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.numerators()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_oldstyle_figures.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.oldstyleFigures()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_ordinal_forms.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.ordinalForms()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_proportional_figures.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Kufam'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.proportionalFigures()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_scientific_inferiors.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.scientificInferiors()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_slashed_zero.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.slashedZero()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_alternates.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro'));
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.stylisticAlternates()]));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_set.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro'));
|
||||
expect(
|
||||
(tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(
|
||||
<FontFeature>[
|
||||
FontFeature.stylisticSet(2),
|
||||
FontFeature.stylisticSet(3),
|
||||
FontFeature.stylisticSet(4),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_set.1.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect(
|
||||
(tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(
|
||||
<FontFeature>[
|
||||
FontFeature.stylisticSet(1),
|
||||
FontFeature.stylisticSet(2),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_subscripts.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect(
|
||||
(tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.subscripts()]),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_superscripts.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy'));
|
||||
expect(
|
||||
(tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.superscripts()]),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_swash.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('BioRhyme Expanded'));
|
||||
expect(
|
||||
(tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.swash()]),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_api_samples/ui/text/font_feature.font_feature_tabular_figures.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('shows font features', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: example.ExampleWidget(),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(Text), findsOneWidget);
|
||||
expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla'));
|
||||
expect(
|
||||
(tester.widget(find.byType(Text).first) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.tabularFigures()]),
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user