mock light meter lux stream

This commit is contained in:
Vadim 2023-10-17 11:58:48 +02:00
parent b68e6384d9
commit 5a06669372

View 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) {},
);
}