Initial commit
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
for-solutions.com
2026-02-06 21:42:17 +01:00
commit 869dd771c9
132 changed files with 5261 additions and 0 deletions

50
test/widget_test.dart Normal file
View File

@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:kalkulator/main.dart';
void main() {
testWidgets('displays 0 on start', (tester) async {
await tester.pumpWidget(const KalkulatorApp());
// '0' appears on both the display and the '0' button
expect(find.text('0'), findsWidgets);
});
testWidgets('tapping digit updates display', (tester) async {
await tester.pumpWidget(const KalkulatorApp());
await tester.tap(find.text('5'));
await tester.pump();
expect(find.text('5'), findsWidgets);
});
testWidgets('simple addition 3 + 2 = 5', (tester) async {
await tester.pumpWidget(const KalkulatorApp());
await tester.tap(find.text('3'));
await tester.pump();
await tester.tap(find.text('+'));
await tester.pump();
await tester.tap(find.text('2'));
await tester.pump();
await tester.tap(find.text('='));
await tester.pump();
expect(find.text('5'), findsWidgets);
});
testWidgets('clear resets display to 0', (tester) async {
await tester.pumpWidget(const KalkulatorApp());
await tester.tap(find.text('7'));
await tester.pump();
await tester.tap(find.text('C'));
await tester.pump();
expect(find.text('0'), findsWidgets);
});
testWidgets('all buttons are rendered', (tester) async {
await tester.pumpWidget(const KalkulatorApp());
for (final label in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']) {
expect(find.text(label), findsWidgets);
}
for (final label in ['+', '-', '*', '/', '=', 'C', '.', '%', '+/-']) {
expect(find.text(label), findsOneWidget);
}
});
}