++ tests and analyze

main
plush2408 2024-06-13 12:34:45 +02:00
parent 298390170c
commit f6fa31196e
5 changed files with 10 additions and 12 deletions

View File

@ -27,7 +27,7 @@ class _GameSettingsState extends State<GameSettings> {
appBar: AppBar( appBar: AppBar(
title: Text( title: Text(
"Werwolf", "Werwolf",
style: Theme.of(context).textTheme.titleLarge, // Apply text theme style: Theme.of(context).textTheme.titleLarge,
), ),
centerTitle: true, centerTitle: true,
), ),
@ -37,7 +37,7 @@ class _GameSettingsState extends State<GameSettings> {
children: [ children: [
Text( Text(
"Anzahl der Spieler ${widget.playernames.length}", "Anzahl der Spieler ${widget.playernames.length}",
style: Theme.of(context).textTheme.titleLarge, // Apply text theme style: Theme.of(context).textTheme.titleLarge,
), ),
const Divider( const Divider(
height: 60, height: 60,
@ -49,7 +49,7 @@ class _GameSettingsState extends State<GameSettings> {
Text( Text(
"Anzahl der Werwölfe ${game.getWolves()}", "Anzahl der Werwölfe ${game.getWolves()}",
style: style:
Theme.of(context).textTheme.bodyLarge, // Apply text theme Theme.of(context).textTheme.bodyLarge,
), ),
IconButton( IconButton(
onPressed: () { onPressed: () {
@ -77,7 +77,7 @@ class _GameSettingsState extends State<GameSettings> {
child: Text( child: Text(
"Spezielle Rollen", "Spezielle Rollen",
style: style:
Theme.of(context).textTheme.titleLarge, // Apply text theme Theme.of(context).textTheme.titleLarge,
), ),
), ),
Expanded( Expanded(
@ -92,7 +92,7 @@ class _GameSettingsState extends State<GameSettings> {
role.stringValue, role.stringValue,
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.bodyLarge, // Apply text theme .bodyLarge,
), ),
trailing: Switch( trailing: Switch(
value: game.specialRoles[role], value: game.specialRoles[role],

View File

@ -481,5 +481,5 @@ packages:
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
sdks: sdks:
dart: ">=3.3.0 <4.0.0" dart: ">=3.4.3 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54" flutter: ">=3.18.0-18.0.pre.54"

View File

@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0 version: 1.0.0
environment: environment:
sdk: '>=3.0.0-313.0.dev <4.0.0' sdk: '>=3.4.3 <4.0.0'
dependencies: dependencies:
flip_card: ^0.7.0 flip_card: ^0.7.0
@ -20,5 +20,3 @@ dev_dependencies:
flutter: flutter:
uses-material-design: true uses-material-design: true

View File

@ -6,7 +6,7 @@ import 'package:werwolf/screens/settings.dart';
void main() { void main() {
group('PlayerRegistry Tests', () { group('PlayerRegistry Tests', () {
testWidgets('Adds a player to the list', (WidgetTester tester) async { testWidgets('Adds a player to the list', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: PlayerRegistry())); await tester.pumpWidget(const MaterialApp(home: PlayerRegistry()));
await tester.enterText(find.byType(TextField), 'Alice'); await tester.enterText(find.byType(TextField), 'Alice');
await tester.testTextInput.receiveAction(TextInputAction.done); await tester.testTextInput.receiveAction(TextInputAction.done);
@ -16,7 +16,7 @@ void main() {
}); });
testWidgets('Shows error for duplicate player', (WidgetTester tester) async { testWidgets('Shows error for duplicate player', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: PlayerRegistry())); await tester.pumpWidget(const MaterialApp(home: PlayerRegistry()));
await tester.enterText(find.byType(TextField), 'Alice'); await tester.enterText(find.byType(TextField), 'Alice');
await tester.testTextInput.receiveAction(TextInputAction.done); await tester.testTextInput.receiveAction(TextInputAction.done);
@ -30,7 +30,7 @@ void main() {
}); });
testWidgets('Navigates to GameSettings when enough players are added', (WidgetTester tester) async { testWidgets('Navigates to GameSettings when enough players are added', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(home: PlayerRegistry())); await tester.pumpWidget(const MaterialApp(home: PlayerRegistry()));
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
await tester.enterText(find.byType(TextField), 'Player $i'); await tester.enterText(find.byType(TextField), 'Player $i');