20 lines
540 B
Dart
20 lines
540 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pong/main.dart';
|
|
|
|
void main() {
|
|
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));
|
|
});
|
|
}
|