Files
holo_shiny/test/shiny_controller_test.dart
T
2026-04-15 00:51:17 +02:00

29 lines
867 B
Dart

import 'dart:async';
import 'package:flutter_test/flutter_test.dart';
import 'package:holo_shiny/holo_shiny.dart';
void main() {
test('ShinyController uses external stream when provided', () async {
final StreamController<Offset> source =
StreamController<Offset>.broadcast();
final ShinyController controller =
ShinyController(useSensor: true, tiltStream: source.stream);
final Future<Offset> next = controller.stream.first;
source.add(const Offset(0.5, -0.25));
expect(await next, const Offset(0.5, -0.25));
await controller.dispose();
await source.close();
});
test('ShinyController emits nothing by default', () async {
final ShinyController controller = ShinyController();
final bool hasEvent = await controller.stream.isEmpty;
expect(hasEvent, isTrue);
await controller.dispose();
});
}