Compare commits

...

No commits in common. "main" and "master" have entirely different histories.
main ... master

132 changed files with 107 additions and 146 deletions

View File

View File

@ -1,34 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pong/main.dart';
import 'package:mockito/mockito.dart'
class MockGameScreen extends Mock implements GameScreen {}
void main() {
// Test for the 'moveRacket' function
test('moveRacket', () {});
// Test for the 'moveBall' function, checking ball position updates and collision handling
test('moveBall updates ball position and handles collisions', () {
final gameScreenState = GameScreenState();
// Set the ball to an initial position
gameScreenState.ballPositionX = 50;
gameScreenState.ballPositionY = 50;
// Move the ball to the right and check the position
gameScreenState.moveBall(1.0);
expect(gameScreenState.ballPositionX, greaterThan(50));
// Move the ball down and check the position
gameScreenState.moveBall(1.0);
expect(gameScreenState.ballPositionY, greaterThan(50));
// Test collision with the walls
gameScreenState.ballPositionX = 0;
gameScreenState.ballSpeedX = -1.0;
gameScreenState.moveBall(1.0);
expect(gameScreenState.ballSpeedX, greaterThan(0));
});
}

View File

@ -1,47 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pong/main.dart';
void main() {
// Widget test for the "Berühren um zu beginnen!" message
testWidgets('Tests "Berühren um zu beginnen!"', (WidgetTester tester) async {
final tapToStart = find.text("Berühren um zu beginnen!");
// Build the widget tree with StartScreen and pump the widget tree
await tester.pumpWidget(const MaterialApp(home: StartScreen()));
// Verify that the "Berühren um zu beginnen!" text is displayed
expect(tapToStart, findsOneWidget);
});
// Widget test for the "Punkte:" message in GameScreen
testWidgets('Tests "Punkte:"', (WidgetTester tester) async {
final points = find.text("Punkte: 0");
// Build the widget tree with GameScreen and pump the widget tree
await tester.pumpWidget(const MaterialApp(home: GameScreen()));
// Verify that the "Punkte: 0" text is displayed
expect(points, findsOneWidget);
});
// Widget test for the UI of StartScreen
testWidgets('StartScreen UI Test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MaterialApp(
home: StartScreen(),
));
// Verify that the "Berühren um zu beginnen!" Text is displayed.
expect(find.text('Berühren um zu beginnen!'), findsOneWidget);
// Tap on the GestureDetector to navigate to GameScreen.
await tester.tap(find.byType(GestureDetector));
await tester.pump();
// Verify that the transition to GameScreen has occurred.
expect(find.byType(GameScreen), findsOneWidget);
});
}

View File

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 544 B

View File

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 442 B

View File

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 721 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 68 B

View File

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 68 B

View File

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 68 B

View File

@ -1,65 +1,65 @@
import 'package:flutter/material.dart';
class PongMenu extends StatelessWidget {
// Constructor to initialize the PongMenu with required properties
const PongMenu({
super.key,
required this.title,
required this.subTitle,
required this.child,
});
final String title;
final String subTitle;
final Widget child;
@override
Widget build(BuildContext context) {
// Get the size of the screen
final mq = MediaQuery.of(context).size;
// Calculate the height and width of the dialog
final dialogHeight = mq.height * 0.4;
final dialogWidth = mq.width * 0.8;
// Return a custom-styled Dialog with specified properties
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
elevation: 0,
backgroundColor: Colors.transparent,
child: Container(
width: dialogWidth,
height: dialogHeight,
decoration: BoxDecoration(
color: const Color.fromARGB(255, 33, 33, 33),
borderRadius: BorderRadius.circular(25),
),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// Display the title with custom styling
Text(
title,
style: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
// Display the subTitle with custom styling
Text(
subTitle,
style: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
// Display the child widget
child,
],
),
),
);
}
}
import 'package:flutter/material.dart';
class PongMenu extends StatelessWidget {
// Constructor to initialize the PongMenu with required properties
const PongMenu({
super.key,
required this.title,
required this.subTitle,
required this.child,
});
final String title;
final String subTitle;
final Widget child;
@override
Widget build(BuildContext context) {
// Get the size of the screen
final mq = MediaQuery.of(context).size;
// Calculate the height and width of the dialog
final dialogHeight = mq.height * 0.4;
final dialogWidth = mq.width * 0.8;
// Return a custom-styled Dialog with specified properties
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
elevation: 0,
backgroundColor: Colors.transparent,
child: Container(
width: dialogWidth,
height: dialogHeight,
decoration: BoxDecoration(
color: const Color.fromARGB(255, 33, 33, 33),
borderRadius: BorderRadius.circular(25),
),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// Display the title with custom styling
Text(
title,
style: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
// Display the subTitle with custom styling
Text(
subTitle,
style: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
// Display the child widget
child,
],
),
),
);
}
}

View File

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Some files were not shown because too many files have changed in this diff Show More