Hi Grady,
Thank you for contacting Syncfusion support.
Based on the shared information, we have checked and your requirement is “Prepare the test case for specific condition in the Flutter Calendar”. We have prepared the simple sample with two test cases in widget_test.dart file. Please find the sample from the following link.
Code snippet:
|
void main() { testWidgets('Calendar Test 1', (WidgetTester tester) async { await tester.pumpWidget(CalendarApp());
await tester.tap(find.byIcon(Icons.refresh)); await tester.pump();
final dynamic startDate = find.byKey(const Key('HeaderText')); final Text selectedWidget = startDate.evaluate().single.widget as Text; expect(startDate, findsOneWidget); final DateTime date = DateTime.now(); final String headerText = date.day.toString() + date.month.toString() + date.year.toString(); expect(selectedWidget.data, headerText); });
testWidgets('Calendar Test 2', (WidgetTester tester) async { await tester.pumpWidget(CalendarApp());
await tester.tap(find.byIcon(Icons.forward)); await tester.pump();
await tester.tap(find.byIcon(Icons.refresh)); await tester.pump(); final dynamic startDate = find.byKey(const Key('HeaderText')); final Text selectedWidget = startDate.evaluate().single.widget as Text; expect(startDate, findsOneWidget); final DateTime date = DateTime.now().add(Duration(days: 1)); final String headerText = date.day.toString() + date.month.toString() + date.year.toString(); expect(selectedWidget.data, headerText); }); } |
We hope that this helps you. If this is not your requirement, please share more details about your requirement clearly? It would be helpful for us to analyze and provide you a solution.
Regards,
Indumathi R