Skip to content

Commit

Permalink
test: Remove duplicate tests (#3398)
Browse files Browse the repository at this point in the history
This PR removes all the duplicates tests.

Co-authored-by: Lukas Klingsbo <[email protected]>
  • Loading branch information
ufrshubham and spydon authored Dec 14, 2024
1 parent 3833130 commit 65f90f9
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 109 deletions.
11 changes: 0 additions & 11 deletions packages/flame/test/components/position_component_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,6 @@ void main() {
expect(component.containsPoint(point), false);
});

test('component with zero size does not contain point', () {
final component = PositionComponent();
component.position.setValues(2.0, 2.0);
component.size.setValues(0.0, 0.0);
component.angle = 0.0;
component.anchor = Anchor.center;

final point = Vector2(2.0, 2.0);
expect(component.containsPoint(point), false);
});

test('scaled component contains point', () {
final component = PositionComponent();
component.anchor = Anchor.center;
Expand Down
17 changes: 0 additions & 17 deletions packages/flame/test/components/priority_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,6 @@ void main() {
},
);

testWithFlameGame(
'changing priority should reorder component list',
(game) async {
final firstComponent = _PriorityComponent(-1);
final priorityComponents = List.generate(10, _PriorityComponent.new)
..add(firstComponent);
priorityComponents.shuffle();
final components = game.world.children;
await game.world.ensureAddAll(priorityComponents);
componentsSorted(components);
expect(components.first, firstComponent);
firstComponent.priority = 11;
game.update(0);
expect(components.last, firstComponent);
},
);

testWithFlameGame(
'changing priority with the priority setter should reorder the list',
(game) async {
Expand Down
25 changes: 0 additions & 25 deletions packages/flame/test/components/text_box_component_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:flame/components.dart';
import 'package:flame/palette.dart';
import 'package:flame_test/flame_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';

void main() {
group('TextBoxComponent', () {
Expand Down Expand Up @@ -122,26 +121,6 @@ void main() {
},
);

testWithFlameGame(
'onComplete is called when no scrolling is required',
(game) async {
final onComplete = _MockOnCompleteCallback();

when(onComplete.call).thenReturn(null);

final component = ScrollTextBoxComponent(
size: Vector2(200, 100),
text: 'Short text',
onComplete: onComplete.call,
);
await game.ensureAdd(component);

game.update(0.1);

verify(onComplete.call).called(1);
},
);

testWithFlameGame(
'TextBoxComponent notifies if a new line is added and requires space',
(game) async {
Expand Down Expand Up @@ -254,7 +233,3 @@ class _FramedTextBox extends TextBoxComponent {
super.render(canvas);
}
}

class _MockOnCompleteCallback extends Mock {
void call();
}
6 changes: 0 additions & 6 deletions packages/flame/test/extensions/vector2_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,6 @@ void main() {
});

group('inversion', () {
test('invert', () {
final v = Vector2.all(1);
v.invert();
expect(v, Vector2.all(-1));
});

test('inverted', () {
final v = Vector2.all(1);
final w = v.inverted();
Expand Down
50 changes: 0 additions & 50 deletions packages/flame/test/game/game_widget/game_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,38 +348,6 @@ void main() {
expect(gameFocusNode.hasPrimaryFocus, isTrue);
},
);

testWidgets('autofocus on overlay', (tester) async {
final gameFocusNode = FocusNode();
final overlayFocusNode = FocusNode();

final game = FlameGame();

await tester.pumpWidget(
GameWidget(
focusNode: gameFocusNode,
game: game,
autofocus: false,
initialActiveOverlays: const ['some-overlay'],
overlayBuilderMap: {
'some-overlay': (buildContext, game) {
return Focus(
focusNode: overlayFocusNode,
autofocus: true,
child: const SizedBox.shrink(),
);
},
},
),
);

await game.toBeLoaded();
await tester.pump();

expect(gameFocusNode.hasPrimaryFocus, isFalse);
expect(gameFocusNode.hasFocus, isTrue);
expect(overlayFocusNode.hasPrimaryFocus, isTrue);
});
});
});

Expand Down Expand Up @@ -422,24 +390,6 @@ void main() {
},
);

testWidgets('handles keys when KeyboardEvents', (tester) async {
final game = _GameWithKeyboardEvents();

await tester.pumpWidget(
GameWidget(
game: game,
),
);

await game.toBeLoaded();
await tester.pump();

await simulateKeyDownEvent(LogicalKeyboardKey.keyA);
await tester.pump();

expect(game.keyEvents, [LogicalKeyboardKey.keyA]);
});

testWidgets('overlay handles keys', (tester) async {
final overlayKeyEvents = <LogicalKeyboardKey>[];
final overlayFocusNode = FocusNode(
Expand Down

0 comments on commit 65f90f9

Please sign in to comment.