Initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user