From 0264b57783a01fa6b160f7355cfc40a52a549b11 Mon Sep 17 00:00:00 2001 From: Erick Date: Wed, 20 Mar 2024 07:12:54 -0300 Subject: [PATCH] feat: making debug info visible again (#96) * feat: making debug info visible again * fixing tests --- lib/crossword/game/crossword_game.dart | 24 +++++++++++++------- test/crossword/game/crossword_game_test.dart | 8 ++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/crossword/game/crossword_game.dart b/lib/crossword/game/crossword_game.dart index af8d3b7d8..1c5bd9b52 100644 --- a/lib/crossword/game/crossword_game.dart +++ b/lib/crossword/game/crossword_game.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:ui'; import 'package:flame/components.dart'; import 'package:flame/debug.dart'; @@ -59,15 +60,22 @@ class CrosswordGame extends FlameGame with PanDetector { _updateVisibleSections(); if (showDebugOverlay) { - await addAll( - [ - FpsComponent(), - FpsTextComponent(), - ChildCounterComponent( - position: Vector2(0, 30), - target: world, + await add( + RectangleComponent( + size: Vector2( + 200, + 50, ), - ], + paint: Paint()..color = const Color(0xFF000000), + children: [ + FpsComponent(), + FpsTextComponent(), + ChildCounterComponent( + position: Vector2(0, 30), + target: world, + ), + ], + ), ); } } diff --git a/test/crossword/game/crossword_game_test.dart b/test/crossword/game/crossword_game_test.dart index d0675a857..dd8cc59dc 100644 --- a/test/crossword/game/crossword_game_test.dart +++ b/test/crossword/game/crossword_game_test.dart @@ -86,10 +86,12 @@ void main() { mockState(state); await game.ready(); - expect(game.firstChild(), isNotNull); - expect(game.firstChild(), isNotNull); + expect(game.descendants().whereType(), isNotEmpty); + expect(game.descendants().whereType(), isNotNull); expect( - game.firstChild>(), + game + .descendants() + .whereType>(), isNotNull, ); },