mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-11 15:08:13 +01:00
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
Tests / lock-popup-safety (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
The Flutter coverage gate blocked the push on 8 lines, all from the desktop target's commit. Seven of them are one branch: didChangeAppLifecycleState returns on its first line under Platform.isLinux, and the suite runs on Linux, so the switch below it is unreachable from any test this repo can run. Covering it would mean threading a platform seam through the nine Platform.isLinux checks in this app for test reachability alone, so it is marked instead -- the same treatment, and the same shape, as storage_service_schema's platform edge. The eighth was just untested: parseLockMode is a pure function, and it now has the cases that matter, including the flag arriving next to --demo-escape. main_lifecycle_test covers the observer's initState/dispose either way. 408 tests, 2759/2759 lines. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DfJC1Wu1SEgJ6X49k5Jqtg
44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
// The lifecycle observer that starts and stops the phone's HTTP socket.
|
|
//
|
|
// Linux returns early because main() never starts the socket there, so a
|
|
// resume must not start one behind the lock screen's back.
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
|
import 'package:workout_app/main.dart';
|
|
import 'package:workout_app/services/storage_service.dart';
|
|
|
|
import 'fake_secure_storage.dart';
|
|
|
|
void main() {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
setUpAll(() {
|
|
// The widget-test host has no Android sqflite plugin; the FFI factory
|
|
// drives the same schema, as everywhere else in this suite.
|
|
sqfliteFfiInit();
|
|
databaseFactory = databaseFactoryFfi;
|
|
});
|
|
|
|
setUp(() async {
|
|
StorageService.resetForTesting();
|
|
await StorageService.init();
|
|
installFakeSecureStorage();
|
|
});
|
|
|
|
testWidgets('every lifecycle transition is handled without throwing', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(const WorkoutApp());
|
|
await tester.pump();
|
|
|
|
// Drives didChangeAppLifecycleState for each state the switch names.
|
|
for (final state in AppLifecycleState.values) {
|
|
tester.binding.handleAppLifecycleStateChanged(state);
|
|
await tester.pump();
|
|
}
|
|
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|