From 8b936e2207dc2b18358712584668cfedc0b46b87 Mon Sep 17 00:00:00 2001 From: "h.ehrenfried" <2012537@stud.hs-mannheim.de> Date: Mon, 6 Mar 2023 15:50:36 +0100 Subject: [PATCH] create popup_test todo_icon.test --- test/widget_missing_config_popup_test.dart | 17 ++++++++++++++ test/widget_todo_icon_test.dart | 26 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/widget_missing_config_popup_test.dart create mode 100644 test/widget_todo_icon_test.dart diff --git a/test/widget_missing_config_popup_test.dart b/test/widget_missing_config_popup_test.dart new file mode 100644 index 0000000..a4c3f3d --- /dev/null +++ b/test/widget_missing_config_popup_test.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:smoke_cess_app/widgets/missing_config_popup.dart'; + +void main() { + testWidgets('MissingConfigPopup displays title and text', (WidgetTester tester) async { + final String title = 'Missing Configuration'; + final String text = 'Please configure the app before using it.'; + + await tester.pumpWidget(MaterialApp( + home: MissingConfigPopup(title: title, text: text), + )); + + expect(find.text(title), findsOneWidget); + expect(find.text(text), findsOneWidget); + }); +} diff --git a/test/widget_todo_icon_test.dart b/test/widget_todo_icon_test.dart new file mode 100644 index 0000000..faefdbd --- /dev/null +++ b/test/widget_todo_icon_test.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:smoke_cess_app/widgets/todo_icon.dart'; + + + +void main() { + testWidgets('MyToDoIcon has a red dot', (WidgetTester tester) async { + // Build the widget tree + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + + body: MyToDoIcon ( + Icon(Icons.check), + ), + ), + ), + ); + + // Verify that the red dot is present + expect(find.byIcon(Icons.brightness_1), findsOneWidget); + // paints => verifys that a widget paints a certain shape or color v^1.15.30 + expect(find.byIcon(Icons.brightness_1).first, paints..circle(color: Colors.redAccent)); + }); +}