Skip to content

Commit

Permalink
[main] Fix ticker provider regression
Browse files Browse the repository at this point in the history
Also adds regression test. It's unclear why I thought this worked. I appear to have changed this deliberately in 9525483 and remember doing some testing.
  • Loading branch information
AsturaPhoenix committed Jul 26, 2023
1 parent 2082b9f commit 92a0377
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ class _Panel extends StatefulWidget {
_PanelState createState() => _PanelState();
}

class _PanelState extends State<_Panel> with SingleTickerProviderStateMixin {
class _PanelState extends State<_Panel> with TickerProviderStateMixin {
late TabController tabController;
// This is needed to persist plot panel state between states with different
// available tabs, such as between station selections with and without
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class MapController extends Controller {
super.dispose();
}

/// [mayUnlock]: Whether this operation may unlock camera tracking.
void selectStation(Station? station, {bool mayUnlock = true}) => setState(() {
selectedStation.value = station;

Expand Down
17 changes: 17 additions & 0 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ void main() {
await tester.pump(Duration.zero);
});

testWidgets(
'can select a station without an associated tide/current station',
(tester) async {
await tester.pumpWidget(harness.buildTripPlanner());
await tester.flushAsync();
await tester.pumpAndSettle();

final TripPlannerState state = tester.state(find.byType(TripPlanner));
state.mapController.selectStation(kDatapoints.values.firstWhere(
(station) =>
!station.type.isTideCurrent &&
station.tideCurrentStationId == null));
await tester.pump();

expect(find.text('Tides'), findsNothing);
});

group('in portrait layout', () {
setUp(() {
final window = TestWidgetsFlutterBinding.instance.window;
Expand Down

0 comments on commit 92a0377

Please sign in to comment.