Browse Source
修复录音文件名中可能包含路径分隔符的问题,新增 sanitizeRecordingFileStem 方法处理本地化标题中的特殊字符 修复文件遍历时未递归查找子目录的问题,使用 recursive: true 参数 修复活动录音文件比较时未统一使用 basename 的问题,避免路径不匹配newdev_shunjiawei
3 changed files with 90 additions and 14 deletions
@ -0,0 +1,31 @@ |
|||
import 'package:flutter_test/flutter_test.dart'; |
|||
import 'package:voitrans/modules/meeting/controllers/meeting_record_controller.dart'; |
|||
|
|||
void main() { |
|||
group('MeetingRecordController.sanitizeRecordingFileStem', () { |
|||
test('removes path separators from localized titles', () { |
|||
final safe = MeetingRecordController.sanitizeRecordingFileStem( |
|||
'Audio/Video Recording', |
|||
); |
|||
expect(safe.contains('/'), isFalse); |
|||
expect(safe.contains('\\'), isFalse); |
|||
expect(safe, isNotEmpty); |
|||
}); |
|||
|
|||
test('works for other locales that contain "/"', () { |
|||
final safe = MeetingRecordController.sanitizeRecordingFileStem( |
|||
'تسجيل صوت/فيديو', |
|||
); |
|||
expect(safe.contains('/'), isFalse); |
|||
expect(safe, isNotEmpty); |
|||
}); |
|||
|
|||
test('falls back when sanitized result is empty', () { |
|||
final safe = MeetingRecordController.sanitizeRecordingFileStem( |
|||
'///', |
|||
fallback: 'fallback', |
|||
); |
|||
expect(safe, 'fallback'); |
|||
}); |
|||
}); |
|||
} |
|||
Loading…
Reference in new issue