widget_test.dart 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // This is a basic Flutter widget test.
  2. //
  3. // To perform an interaction with a widget in your test, use the WidgetTester
  4. // utility that Flutter provides. For example, you can send tap and scroll
  5. // gestures. You can also use WidgetTester to find child widgets in the widget
  6. // tree, read text, and verify that the values of widget properties are correct.
  7. import 'dart:math' as math;
  8. import 'package:fis_measure/interfaces/date_types/point.dart';
  9. import 'package:fis_measure/interfaces/date_types/skew_transform.dart';
  10. import 'package:fis_measure/values/unit_desc.dart';
  11. import 'package:flutter_test/flutter_test.dart';
  12. import 'package:vid/us/vid_us_unit.dart';
  13. import 'ellipse.dart';
  14. void main() {
  15. test('ellipse ad', () {
  16. var startPoint = DPoint(0, 400);
  17. var endPoint = DPoint(400, 0);
  18. // var startPoint = DPoint(0, 400);
  19. // var endPoint = DPoint(400, 400);
  20. EllipseTest.calculateYAxisPoints(
  21. startPoint, startPoint, startPoint, endPoint, endPoint, false);
  22. });
  23. test('Unit Description', () {
  24. print(UnitDescriptionMap.getDesc(VidUsUnit.HR));
  25. print(UnitDescriptionMap.getDescByInt(60));
  26. });
  27. testWidgets('Counter increments smoke test', (WidgetTester tester) async {
  28. // Build our app and trigger a frame.
  29. });
  30. test("linear_tissue", () {
  31. const steer = 3.0;
  32. const depthStart = 1.0;
  33. const depthEnd = 3.99999991059303;
  34. final back = DSkewTransform(steer, 0, 0, (depthEnd - depthStart) / 2);
  35. final inverse = back.inverse;
  36. final p1 = inverse.transform(DPoint(0.84, 0.24907692307692308));
  37. final p2 = inverse.transform(DPoint(0.84, 0.4989230769230769));
  38. final d = (p2 - p1).lengthSquared;
  39. print(p1);
  40. print(p2);
  41. print(d);
  42. });
  43. test("convex_tissue", () {
  44. const zeroRadius = 5.1225;
  45. final logicalPoint = DPoint(1, 1);
  46. double depth = math.sqrt(math.pow(logicalPoint.x, 2) +
  47. math.pow(logicalPoint.y + zeroRadius, 2)) -
  48. zeroRadius;
  49. double tilt =
  50. toDegrees(math.atan2(logicalPoint.x, logicalPoint.y + zeroRadius));
  51. final d = DPoint(tilt, depth);
  52. print(d);
  53. });
  54. }
  55. double toDegrees(double angle) {
  56. return angle / math.pi * 180;
  57. }