From 71e167618d2277c2463f899b48d97ec496c78ea0 Mon Sep 17 00:00:00 2001 From: Gold872 Date: Wed, 8 Nov 2023 00:20:43 -0500 Subject: [PATCH] Fixed list layout dragging unit test logic --- test/pages/dashboard_page_test.dart | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/pages/dashboard_page_test.dart b/test/pages/dashboard_page_test.dart index d74862c2..8becd51c 100644 --- a/test/pages/dashboard_page_test.dart +++ b/test/pages/dashboard_page_test.dart @@ -315,6 +315,14 @@ void main() { await widgetTester.tap(closeButton); await widgetTester.pumpAndSettle(); + final listLayout = find.ancestor( + of: find.widgetWithText(WidgetContainer, 'List Layout'), + matching: find.byType(DraggableListLayout)); + expect(listLayout, findsOneWidget); + + DraggableListLayout listLayoutWidget = + listLayout.evaluate().first.widget as DraggableListLayout; + final testBooleanContainer = find.widgetWithText(WidgetContainer, 'Test Boolean'); expect(testBooleanContainer, findsOneWidget); @@ -322,19 +330,25 @@ void main() { final testBooleanInLayout = find.descendant( of: find.widgetWithText(WidgetContainer, 'List Layout'), matching: find.byType(BooleanBox)); + expect(testBooleanInLayout, findsNothing); + expect(listLayoutWidget.children.length, 0); // Drag into layout - await widgetTester.timedDrag(testBooleanContainer, const Offset(256, 32), + await widgetTester.timedDrag(testBooleanContainer, const Offset(250, 32), const Duration(milliseconds: 500)); await widgetTester.pumpAndSettle(); expect(testBooleanInLayout, findsOneWidget); + expect(listLayoutWidget.children.length, 1); // Drag out of layout - await widgetTester.timedDrag(testBooleanContainer, const Offset(-300, -48), + await widgetTester.timedDrag(testBooleanInLayout, const Offset(-200, -60), const Duration(milliseconds: 500)); await widgetTester.pumpAndSettle(); + + expect(testBooleanInLayout, findsNothing); + expect(listLayoutWidget.children.length, 0); }); testWidgets('Adding widgets from shuffleboard api', (widgetTester) async {