mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-26 04:27:12 +01:00
Mark Android-only external-storage blocks coverage:ignore
getExternalStorageDirectory() is unavailable on the Linux test host, so the Platform.isAndroid fallback blocks in sync_service/http_server_service can't be exercised in CI. Wrap them in coverage:ignore (honored by flutter test --coverage) so the 100% gate doesn't demand coverage of an Android-only path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PM3auNTifaVgcXWDizZrjH
This commit is contained in:
parent
77151c0013
commit
5b3b15f73c
@ -70,6 +70,9 @@ class HttpServerService {
|
|||||||
// External storage is Android-only; getExternalStorageDirectory() throws an
|
// External storage is Android-only; getExternalStorageDirectory() throws an
|
||||||
// UnsupportedError (not an Exception) on other platforms (desktop / test
|
// UnsupportedError (not an Exception) on other platforms (desktop / test
|
||||||
// host), so guard the call rather than trying to catch it.
|
// host), so guard the call rather than trying to catch it.
|
||||||
|
// coverage:ignore-start
|
||||||
|
// Android-only: getExternalStorageDirectory is unavailable on the Linux
|
||||||
|
// test host, so this block can't be exercised in CI.
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
try {
|
try {
|
||||||
final dir = await getExternalStorageDirectory();
|
final dir = await getExternalStorageDirectory();
|
||||||
@ -77,6 +80,7 @@ class HttpServerService {
|
|||||||
} on Exception {
|
} on Exception {
|
||||||
// Ignore; the /sdcard path is tried first.
|
// Ignore; the /sdcard path is tried first.
|
||||||
}
|
}
|
||||||
|
// coverage:ignore-end
|
||||||
}
|
}
|
||||||
for (final path in candidates) {
|
for (final path in candidates) {
|
||||||
final file = File(path);
|
final file = File(path);
|
||||||
|
|||||||
@ -31,6 +31,9 @@ class SyncService {
|
|||||||
|
|
||||||
// External storage is Android-only; getExternalStorageDirectory() throws an
|
// External storage is Android-only; getExternalStorageDirectory() throws an
|
||||||
// UnsupportedError (not an Exception) on other platforms, so guard the call.
|
// UnsupportedError (not an Exception) on other platforms, so guard the call.
|
||||||
|
// coverage:ignore-start
|
||||||
|
// Android-only: getExternalStorageDirectory is unavailable on the Linux
|
||||||
|
// test host, so this block can't be exercised in CI.
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
try {
|
try {
|
||||||
final dir = await getExternalStorageDirectory();
|
final dir = await getExternalStorageDirectory();
|
||||||
@ -43,6 +46,7 @@ class SyncService {
|
|||||||
// Fallback failed.
|
// Fallback failed.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// coverage:ignore-end
|
||||||
|
|
||||||
return const SyncResult(
|
return const SyncResult(
|
||||||
success: false,
|
success: false,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user