CPD/test/unit_test.dart

20 lines
540 B
Dart
Raw Normal View History

2024-01-10 14:36:14 +01:00
import 'package:flutter_test/flutter_test.dart';
import 'package:pong/main.dart';
void main() {
2024-01-10 14:36:24 +01:00
test('moveRacket adjusts racketX correctly', () {
// Arrange
final gameScreenState = GameScreenState();
const initialRacketX = 20.0;
const racketWidth = 100.0;
// Act
gameScreenState.moveRacket(initialRacketX +
50.0); // Simuliere einen horizontalen Drag an der Position initialRacketX + 50
// Assert
expect(gameScreenState.racketX,
equals(initialRacketX + 50.0 - racketWidth / 2));
2024-01-10 14:36:14 +01:00
});
}