mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 17:00:39 +00:00
mock light meter lux stream
This commit is contained in:
parent
b68e6384d9
commit
5a06669372
1 changed files with 20 additions and 0 deletions
20
integration_test/utils/platform_channel_mock.dart
Normal file
20
integration_test/utils/platform_channel_mock.dart
Normal file
|
@ -0,0 +1,20 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
Future<void> sendMockLux([int lux = 100]) async {
|
||||
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
|
||||
"light.eventChannel",
|
||||
const StandardMethodCodec().encodeSuccessEnvelope(lux),
|
||||
(ByteData? data) {},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> sendMockIncidentEv(double ev) async {
|
||||
await TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
|
||||
"light.eventChannel",
|
||||
const StandardMethodCodec().encodeSuccessEnvelope((2.5 * pow(2, ev)).toInt()),
|
||||
(ByteData? data) {},
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue