mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 17:00:39 +00:00
fixed evFromImage
test
This commit is contained in:
parent
9223afe404
commit
40e4340bc9
2 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
import 'dart:math' as math;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:exif/exif.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
Future<double> evFromImage(Uint8List bytes) async {
|
||||
|
@ -10,7 +10,7 @@ Future<double> evFromImage(Uint8List bytes) async {
|
|||
final apertureValueRatio = (tags["EXIF FNumber"]?.values as IfdRatios?)?.ratios.first;
|
||||
final speedValueRatio = (tags["EXIF ExposureTime"]?.values as IfdRatios?)?.ratios.first;
|
||||
if (iso == null || apertureValueRatio == null || speedValueRatio == null) {
|
||||
throw 'Error parsing EXIF: ${tags.keys}';
|
||||
throw FlutterError('Error parsing EXIF: ${tags.keys}');
|
||||
}
|
||||
|
||||
final aperture = apertureValueRatio.numerator / apertureValueRatio.denominator;
|
||||
|
|
|
@ -17,7 +17,7 @@ void main() {
|
|||
'no EXIF',
|
||||
() {
|
||||
final bytes = File('assets/launcher_icon_dev_512.png').readAsBytesSync();
|
||||
expectLater(evFromImage(bytes), completion(null));
|
||||
expectLater(evFromImage(bytes), throwsFlutterError);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue