Skip to content

Commit

Permalink
Fixed list layout dragging unit test logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Nov 8, 2023
1 parent b6086fe commit 71e1676
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/pages/dashboard_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,26 +315,40 @@ 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);

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 {
Expand Down

0 comments on commit 71e1676

Please sign in to comment.