picture_stream_test.dart 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'dart:ui';
  2. import 'package:flutter_svg/flutter_svg.dart';
  3. import 'package:test/test.dart';
  4. void main() {
  5. test('PictureInfo Tests', () {
  6. final PictureRecorder recorder = PictureRecorder();
  7. final Canvas canvas = Canvas(recorder);
  8. canvas.drawPaint(Paint()..color = const Color(0xFFFA0000));
  9. final Picture picture = recorder.endRecording();
  10. expect(
  11. () => PictureInfo(
  12. picture: null,
  13. viewport: null,
  14. size: null,
  15. ),
  16. throwsA(const TypeMatcher<AssertionError>()));
  17. expect(
  18. () => PictureInfo(
  19. picture: null,
  20. viewport: Rect.zero,
  21. size: null,
  22. ),
  23. throwsA(const TypeMatcher<AssertionError>()));
  24. expect(
  25. () => PictureInfo(
  26. picture: null,
  27. viewport: Rect.zero,
  28. size: Size.zero,
  29. ),
  30. throwsA(const TypeMatcher<AssertionError>()));
  31. final PictureInfo info1 = PictureInfo(
  32. picture: picture,
  33. viewport: Rect.zero,
  34. size: Size.zero,
  35. );
  36. final PictureInfo info2 = PictureInfo(
  37. picture: picture,
  38. viewport: Rect.zero,
  39. size: Size.zero,
  40. );
  41. expect(info1.hashCode, equals(info2.hashCode));
  42. expect(info1, equals(info2));
  43. });
  44. }