Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Use variable name on toString in component_test.dart #2377

Merged
merged 4 commits into from
Mar 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/flame/test/components/component_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void main() {
testWithFlameGame(
'component.removed completes if obtained before the game was ready',
(game) async {
final component = LifecycleComponent('component');
final component = LifecycleComponent();
final removed = component.removed;
await game.add(component);
await game.ready();
Expand All @@ -48,7 +48,7 @@ void main() {
testWithFlameGame(
'component removed completes when set after game is ready',
(game) async {
final component = LifecycleComponent('component');
final component = LifecycleComponent();
await game.add(component);
await game.ready();
final removed = component.removed;
Expand Down Expand Up @@ -1149,9 +1149,9 @@ class TwoChildrenComponent extends Component {

class LifecycleComponent extends Component {
final List<String> events = [];
final String? name;
final String name;

LifecycleComponent([this.name]);
LifecycleComponent([this.name = '']);

int countEvents(String event) {
return events.where((e) => e == event).length;
Expand Down Expand Up @@ -1188,6 +1188,9 @@ class LifecycleComponent extends Component {
super.onGameResize(size);
events.add('onGameResize $size');
}

@override
String toString() => 'LifecycleComponent($name)';
}

class _SlowLoadingComponent extends Component {
Expand Down