create popup_test todo_icon.test
parent
dffa3808dd
commit
8b936e2207
|
@ -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);
|
||||||
|
});
|
||||||
|
}
|
|
@ -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));
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue