From dc065306a7a4f696d4af8eb3de5a9fd616432067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20L=C3=B6ffler?= <1911374@stud.hs-mannheim.de> Date: Thu, 11 Jan 2024 02:35:21 +0100 Subject: [PATCH] Update Pong/test/unit_test.dart --- Pong/test/unit_test.dart | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Pong/test/unit_test.dart b/Pong/test/unit_test.dart index d88cb02..2a4881d 100644 --- a/Pong/test/unit_test.dart +++ b/Pong/test/unit_test.dart @@ -6,30 +6,29 @@ 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(); - // Setze den Ball in eine Ausgangsposition + // Set the ball to an initial position gameScreenState.ballPositionX = 50; gameScreenState.ballPositionY = 50; - // Bewege den Ball nach rechts und überprüfe die Position + // Move the ball to the right and check the position gameScreenState.moveBall(1.0); expect(gameScreenState.ballPositionX, greaterThan(50)); - // Bewege den Ball nach unten und überprüfe die Position + // Move the ball down and check the position gameScreenState.moveBall(1.0); expect(gameScreenState.ballPositionY, greaterThan(50)); - // Teste die Kollision mit den Wänden + // Test collision with the walls gameScreenState.ballPositionX = 0; gameScreenState.ballSpeedX = -1.0; gameScreenState.moveBall(1.0); - expect(gameScreenState.ballSpeedX, - greaterThan(0)); // Die Richtung des Balls sollte sich ändern - - // Füge weitere Tests für Kollisionen hinzu + expect(gameScreenState.ballSpeedX, greaterThan(0)); }); }