Skip to content

Commit e1b94e3

Browse files
ersanKolayjonbhansonThexXTURBOXx
authored
chore: minor housekeeping - format, ci update, more tests (#824)
* chore: minor housekeeping - format, ci update, more tests - ran dart format on example app - bumped actions/checkout from v2 to v4 - added more parseColor test cases (edge cases for int input, invalid strings, null handling) * Apply suggestion from @ThexXTURBOXx Co-authored-by: Nico Mexis <nico.mexis@kabelmail.de> --------- Co-authored-by: Jon Hanson <32202698+jonbhanson@users.noreply.github.com> Co-authored-by: Nico Mexis <nico.mexis@kabelmail.de>
1 parent 5f338b0 commit e1b94e3

3 files changed

Lines changed: 28 additions & 10 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v6
1818
- uses: subosito/flutter-action@v2
1919
- name: Install Dependencies
2020
run: flutter pub get

example/lib/main.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ class _MyHomePageState extends State<MyHomePage> {
129129
// wireframe for each widget.
130130
mainAxisAlignment: MainAxisAlignment.center,
131131
children: <Widget>[
132-
const Text(
133-
'You have pushed the button this many times:',
134-
),
132+
const Text('You have pushed the button this many times:'),
135133
Text(
136134
'$_counter',
137135
style: Theme.of(context).textTheme.headlineMedium,

test/flutter_native_splash_test.dart

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,32 @@ import 'package:flutter_test/flutter_test.dart';
55
import 'package:path/path.dart' as p;
66

77
void main() {
8-
test('parseColor parses values correctly', () {
9-
expect(parseColor('#ffffff'), 'ffffff');
10-
expect(parseColor(' FAFAFA '), 'FAFAFA');
11-
expect(parseColor('121212'), '121212');
12-
expect(parseColor(null), null);
13-
expect(() => parseColor('badcolor'), throwsException);
8+
group('parseColor', () {
9+
test('parses string values correctly', () {
10+
expect(parseColor('#ffffff'), 'ffffff');
11+
expect(parseColor(' FAFAFA '), 'FAFAFA');
12+
expect(parseColor('121212'), '121212');
13+
expect(parseColor('#000000'), '000000');
14+
expect(parseColor('F9E524'), 'F9E524');
15+
});
16+
17+
test('returns null for null input', () {
18+
expect(parseColor(null), null);
19+
});
20+
21+
test('throws for invalid color strings', () {
22+
expect(() => parseColor('badcolor'), throwsException);
23+
expect(() => parseColor('#12345'), throwsException);
24+
expect(() => parseColor('1234567'), throwsException);
25+
expect(() => parseColor(''), throwsException);
26+
});
27+
28+
test('handles integer values from YAML parsing', () {
29+
// YAML parses unquoted numeric values like 000000 as int 0
30+
expect(parseColor(0), '000000');
31+
// YAML parses 123456 as int
32+
expect(parseColor(123456), '123456');
33+
});
1434
});
1535

1636
group('config file from args', () {

0 commit comments

Comments
 (0)