mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 00:10:47 +00:00
Compare commits
3 commits
2a7463184b
...
33274ad1f6
Author | SHA1 | Date | |
---|---|---|---|
|
33274ad1f6 | ||
|
801ddd9589 | ||
|
604ee097a6 |
4 changed files with 94 additions and 6 deletions
|
@ -25,20 +25,17 @@ void main() {
|
|||
late MeteringBloc bloc;
|
||||
const iso100 = IsoValue(100, StopType.full);
|
||||
|
||||
setUpAll(() {
|
||||
setUp(() {
|
||||
meteringInteractor = _MockMeteringInteractor();
|
||||
communicationBloc = _MockMeteringCommunicationBloc();
|
||||
|
||||
when<IsoValue>(() => meteringInteractor.iso).thenReturn(iso100);
|
||||
when<NdValue>(() => meteringInteractor.ndFilter).thenReturn(NdValue.values.first);
|
||||
when<Film>(() => meteringInteractor.film).thenReturn(Film.values.first);
|
||||
|
||||
when(meteringInteractor.quickVibration).thenAnswer((_) async {});
|
||||
when(meteringInteractor.responseVibration).thenAnswer((_) async {});
|
||||
when(meteringInteractor.errorVibration).thenAnswer((_) async {});
|
||||
});
|
||||
|
||||
setUp(() {
|
||||
communicationBloc = _MockMeteringCommunicationBloc();
|
||||
|
||||
bloc = MeteringBloc(
|
||||
meteringInteractor,
|
||||
communicationBloc,
|
||||
|
@ -47,6 +44,7 @@ void main() {
|
|||
|
||||
tearDown(() {
|
||||
bloc.close();
|
||||
communicationBloc.close();
|
||||
});
|
||||
|
||||
group(
|
||||
|
@ -471,6 +469,7 @@ void main() {
|
|||
verify: (_) {
|
||||
verify(() => meteringInteractor.film = const Film.other()).called(1);
|
||||
verifyNever(() => meteringInteractor.iso = const IsoValue(0, StopType.full));
|
||||
verifyNever(() => meteringInteractor.responseVibration());
|
||||
},
|
||||
expect: () => [
|
||||
isA<MeteringDataState>()
|
||||
|
|
|
@ -46,6 +46,7 @@ void main() {
|
|||
bloc.add(const MeteringInProgressEvent(2));
|
||||
bloc.add(const MeasureEvent());
|
||||
bloc.add(const MeteringEndedEvent(2));
|
||||
bloc.add(const MeteringEndedEvent(2));
|
||||
},
|
||||
expect: () => [
|
||||
isA<MeasureState>(),
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
// ignore_for_file: prefer_const_constructors
|
||||
|
||||
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group(
|
||||
'`MeteringInProgressEvent`',
|
||||
() {
|
||||
final a = MeteringInProgressEvent(1.0);
|
||||
final b = MeteringInProgressEvent(1.0);
|
||||
final c = MeteringInProgressEvent(2.0);
|
||||
test('==', () {
|
||||
expect(a == b && b == a, true);
|
||||
expect(a != c && c != a, true);
|
||||
expect(b != c && c != b, true);
|
||||
});
|
||||
test('hashCode', () {
|
||||
expect(a.hashCode == b.hashCode, true);
|
||||
expect(a.hashCode != c.hashCode, true);
|
||||
expect(b.hashCode != c.hashCode, true);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
group(
|
||||
'`MeteringEndedEvent`',
|
||||
() {
|
||||
final a = MeteringEndedEvent(1.0);
|
||||
final b = MeteringEndedEvent(1.0);
|
||||
final c = MeteringEndedEvent(2.0);
|
||||
test('==', () {
|
||||
expect(a == b && b == a, true);
|
||||
expect(a != c && c != a, true);
|
||||
expect(b != c && c != b, true);
|
||||
});
|
||||
test('hashCode', () {
|
||||
expect(a.hashCode == b.hashCode, true);
|
||||
expect(a.hashCode != c.hashCode, true);
|
||||
expect(b.hashCode != c.hashCode, true);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// ignore_for_file: prefer_const_constructors
|
||||
|
||||
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group(
|
||||
'`MeteringInProgressState`',
|
||||
() {
|
||||
final a = MeteringInProgressState(1.0);
|
||||
final b = MeteringInProgressState(1.0);
|
||||
final c = MeteringInProgressState(2.0);
|
||||
test('==', () {
|
||||
expect(a == b && b == a, true);
|
||||
expect(a != c && c != a, true);
|
||||
expect(b != c && c != b, true);
|
||||
});
|
||||
test('hashCode', () {
|
||||
expect(a.hashCode == b.hashCode, true);
|
||||
expect(a.hashCode != c.hashCode, true);
|
||||
expect(b.hashCode != c.hashCode, true);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
group(
|
||||
'`MeteringEndedState`',
|
||||
() {
|
||||
final a = MeteringEndedState(1.0);
|
||||
final b = MeteringEndedState(1.0);
|
||||
final c = MeteringEndedState(2.0);
|
||||
test('==', () {
|
||||
expect(a == b && b == a, true);
|
||||
expect(a != c && c != a, true);
|
||||
expect(b != c && c != b, true);
|
||||
});
|
||||
test('hashCode', () {
|
||||
expect(a.hashCode == b.hashCode, true);
|
||||
expect(a.hashCode != c.hashCode, true);
|
||||
expect(b.hashCode != c.hashCode, true);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue