mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 00:40:39 +00:00
fixed CameraContainerBloc
tests
This commit is contained in:
parent
6b645c0ff2
commit
83476a5036
2 changed files with 26 additions and 1 deletions
|
@ -159,7 +159,8 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
|
|||
}
|
||||
|
||||
Future<void> _onDeinitialize(DeinitializeEvent _, Emitter emit) async {
|
||||
emit(const CameraLoadingState());
|
||||
emit(const CameraInitState());
|
||||
communicationBloc.add(communication_event.MeteringEndedEvent(_ev100));
|
||||
await _cameraController?.dispose().then((_) => _cameraController = null);
|
||||
}
|
||||
|
||||
|
|
|
@ -310,6 +310,30 @@ void main() {
|
|||
},
|
||||
expect: () => [
|
||||
...initializedStateSequence,
|
||||
const CameraInitState(),
|
||||
...initializedStateSequence,
|
||||
],
|
||||
);
|
||||
|
||||
blocTest<CameraContainerBloc, CameraContainerState>(
|
||||
'onCommunicationState',
|
||||
setUp: () {
|
||||
when(() => meteringInteractor.checkCameraPermission()).thenAnswer((_) async => true);
|
||||
},
|
||||
build: () => bloc,
|
||||
act: (bloc) async {
|
||||
bloc.add(const InitializeEvent());
|
||||
await Future.delayed(Duration.zero);
|
||||
bloc.onCommunicationState(const communication_states.SettingsOpenedState());
|
||||
await Future.delayed(Duration.zero);
|
||||
bloc.onCommunicationState(const communication_states.SettingsClosedState());
|
||||
},
|
||||
verify: (_) {
|
||||
verify(() => meteringInteractor.checkCameraPermission()).called(2);
|
||||
},
|
||||
expect: () => [
|
||||
...initializedStateSequence,
|
||||
const CameraInitState(),
|
||||
...initializedStateSequence,
|
||||
],
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue