info_test.dart 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import 'package:fis_lib_print/printing.dart';
  17. import 'package:flutter_test/flutter_test.dart';
  18. void main() {
  19. setUp(() {
  20. TestWidgetsFlutterBinding.ensureInitialized();
  21. });
  22. test('PrintingInfo', () async {
  23. const info = PrintingInfo.unavailable;
  24. expect(info.canConvertHtml, false);
  25. expect(info.directPrint, false);
  26. expect(info.dynamicLayout, false);
  27. expect(info.canPrint, false);
  28. expect(info.canConvertHtml, false);
  29. expect(info.canShare, false);
  30. expect(info.canRaster, false);
  31. expect(info.toString(), isA<String>());
  32. });
  33. test('PrintingInfo.fromMap', () async {
  34. final info = PrintingInfo.fromMap(
  35. <dynamic, dynamic>{
  36. 'canPrint': true,
  37. },
  38. );
  39. expect(info.canConvertHtml, false);
  40. expect(info.directPrint, false);
  41. expect(info.dynamicLayout, false);
  42. expect(info.canPrint, true);
  43. expect(info.canConvertHtml, false);
  44. expect(info.canShare, false);
  45. expect(info.canRaster, false);
  46. });
  47. }