mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-02-22 04:20:41 +00:00
refined IsoChangedEvent
tests
This commit is contained in:
parent
7706dc743d
commit
8ce3c9e938
1 changed files with 95 additions and 3 deletions
|
@ -147,7 +147,7 @@ void main() {
|
|||
'`IsoChangedEvent` tests',
|
||||
() {
|
||||
blocTest<MeteringBloc, MeteringState>(
|
||||
'`IsoChangedEvent` -> success',
|
||||
'Pick different ISO (ev100 != null)',
|
||||
build: () => bloc,
|
||||
seed: () => MeteringDataState(
|
||||
ev100: 1.0,
|
||||
|
@ -167,13 +167,43 @@ void main() {
|
|||
isA<MeteringDataState>()
|
||||
.having((state) => state.ev100, 'ev100', 1.0)
|
||||
.having((state) => state.ev, 'ev', 2.0)
|
||||
.having((state) => state.film, 'film', Film.values.first)
|
||||
.having((state) => state.iso, 'iso', const IsoValue(200, StopType.full))
|
||||
.having((state) => state.nd, 'nd', NdValue.values.first)
|
||||
.having((state) => state.isMetering, 'isMetering', false),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<MeteringBloc, MeteringState>(
|
||||
'`IsoChangedEvent` -> same ISO picked',
|
||||
'Pick different ISO (ev100 = null)',
|
||||
build: () => bloc,
|
||||
seed: () => MeteringDataState(
|
||||
ev100: null,
|
||||
film: Film.values[1],
|
||||
iso: const IsoValue(100, StopType.full),
|
||||
nd: NdValue.values.first,
|
||||
isMetering: false,
|
||||
),
|
||||
act: (bloc) async {
|
||||
bloc.add(const IsoChangedEvent(IsoValue(200, StopType.full)));
|
||||
},
|
||||
verify: (_) {
|
||||
verify(() => meteringInteractor.film = Film.values.first).called(1);
|
||||
verify(() => meteringInteractor.iso = const IsoValue(200, StopType.full)).called(1);
|
||||
},
|
||||
expect: () => [
|
||||
isA<MeteringDataState>()
|
||||
.having((state) => state.ev100, 'ev100', null)
|
||||
.having((state) => state.ev, 'ev', null)
|
||||
.having((state) => state.film, 'film', Film.values.first)
|
||||
.having((state) => state.iso, 'iso', const IsoValue(200, StopType.full))
|
||||
.having((state) => state.nd, 'nd', NdValue.values.first)
|
||||
.having((state) => state.isMetering, 'isMetering', false),
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<MeteringBloc, MeteringState>(
|
||||
'Pick same ISO',
|
||||
build: () => bloc,
|
||||
seed: () => MeteringDataState(
|
||||
ev100: 1.0,
|
||||
|
@ -191,13 +221,75 @@ void main() {
|
|||
},
|
||||
expect: () => [],
|
||||
);
|
||||
|
||||
blocTest<MeteringBloc, MeteringState>(
|
||||
'Pick different ISO & measure',
|
||||
build: () => bloc,
|
||||
seed: () => MeteringDataState(
|
||||
ev100: 1.0,
|
||||
film: Film.values[1],
|
||||
iso: const IsoValue(100, StopType.full),
|
||||
nd: NdValue.values.first,
|
||||
isMetering: false,
|
||||
),
|
||||
act: (bloc) async {
|
||||
bloc.add(const IsoChangedEvent(IsoValue(200, StopType.full)));
|
||||
bloc.add(const MeasureEvent());
|
||||
bloc.onCommunicationState(const communication_states.MeteringEndedState(2));
|
||||
},
|
||||
verify: (_) {
|
||||
verify(() => meteringInteractor.film = Film.values.first).called(1);
|
||||
verify(() => meteringInteractor.iso = const IsoValue(200, StopType.full)).called(1);
|
||||
},
|
||||
expect: () => [
|
||||
isA<MeteringDataState>()
|
||||
.having((state) => state.ev100, 'ev100', 1.0)
|
||||
.having((state) => state.ev, 'ev', 2.0)
|
||||
.having((state) => state.film, 'film', Film.values.first)
|
||||
.having((state) => state.iso, 'iso', const IsoValue(200, StopType.full))
|
||||
.having((state) => state.nd, 'nd', NdValue.values.first)
|
||||
.having((state) => state.isMetering, 'isMetering', false),
|
||||
isA<LoadingState>(),
|
||||
isA<MeteringDataState>()
|
||||
.having((state) => state.ev100, 'ev100', 2.0)
|
||||
.having((state) => state.ev, 'ev', 3.0)
|
||||
.having((state) => state.film, 'film', Film.values.first)
|
||||
.having((state) => state.iso, 'iso', const IsoValue(200, StopType.full))
|
||||
.having((state) => state.nd, 'nd', NdValue.values.first)
|
||||
.having((state) => state.isMetering, 'isMetering', false),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
group(
|
||||
'`NdChangedEvent` tests',
|
||||
() {
|
||||
//
|
||||
blocTest<MeteringBloc, MeteringState>(
|
||||
'`NdChangedEvent` -> success',
|
||||
build: () => bloc,
|
||||
seed: () => MeteringDataState(
|
||||
ev100: 1.0,
|
||||
film: Film.values[1],
|
||||
iso: const IsoValue(100, StopType.full),
|
||||
nd: NdValue.values.first,
|
||||
isMetering: false,
|
||||
),
|
||||
act: (bloc) async {
|
||||
bloc.add(const NdChangedEvent(NdValue(2)));
|
||||
},
|
||||
verify: (_) {
|
||||
verify(() => meteringInteractor.film = Film.values.first).called(1);
|
||||
verify(() => meteringInteractor.ndFilter = const NdValue(2)).called(1);
|
||||
},
|
||||
expect: () => [
|
||||
isA<MeteringDataState>()
|
||||
.having((state) => state.ev100, 'ev100', 1.0)
|
||||
.having((state) => state.ev, 'ev', 2.0)
|
||||
.having((state) => state.iso, 'iso', const IsoValue(200, StopType.full))
|
||||
.having((state) => state.isMetering, 'isMetering', false),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue