1+ import 'package:box_transform/box_transform.dart' ;
2+ import 'package:test/test.dart' ;
3+ import 'package:vector_math/vector_math.dart' ;
4+
5+ void main () {
6+ test ('RawTransformResult equality tests' , (){
7+ final result1 = RawTransformResult (
8+ rect: Box .fromLTRB (100 , 100 , 500 , 400 ),
9+ handle: HandlePosition .bottomRight,
10+ flip: Flip .none,
11+ maxHeightReached: false ,
12+ maxWidthReached: false ,
13+ minHeightReached: false ,
14+ minWidthReached: false ,
15+ oldRect: Box .fromLTRB (100 , 100 , 300 , 200 ),
16+ resizeMode: ResizeMode .freeform,
17+ largestRect: Box .fromLTRB (100 , 100 , 1000 , 1000 ),
18+ rawSize: Dimension (400 , 300 ),
19+ delta: Vector2 (200 , 200 ),
20+ );
21+
22+ final result2 = RawTransformResult (
23+ rect: Box .fromLTRB (100 , 100 , 500 , 400 ),
24+ handle: HandlePosition .bottomRight,
25+ flip: Flip .none,
26+ maxHeightReached: false ,
27+ maxWidthReached: false ,
28+ minHeightReached: false ,
29+ minWidthReached: false ,
30+ oldRect: Box .fromLTRB (100 , 100 , 300 , 200 ),
31+ resizeMode: ResizeMode .freeform,
32+ largestRect: Box .fromLTRB (100 , 100 , 1000 , 1000 ),
33+ rawSize: Dimension (400 , 300 ),
34+ delta: Vector2 (200 , 200 ),
35+ );
36+
37+ expect (result1, result2);
38+ expect (result1.toString (), result2.toString ());
39+ expect (result1.hashCode, result2.hashCode);
40+ expect (result1 == result2, isTrue);
41+ });
42+
43+ test ('RawResizeResult equality tests' , (){
44+ final result1 = RawResizeResult (
45+ rect: Box .fromLTRB (100 , 100 , 500 , 400 ),
46+ handle: HandlePosition .bottomRight,
47+ flip: Flip .none,
48+ maxHeightReached: false ,
49+ maxWidthReached: false ,
50+ minHeightReached: false ,
51+ minWidthReached: false ,
52+ oldRect: Box .fromLTRB (100 , 100 , 300 , 200 ),
53+ resizeMode: ResizeMode .freeform,
54+ largestRect: Box .fromLTRB (100 , 100 , 1000 , 1000 ),
55+ rawSize: Dimension (400 , 300 ),
56+ delta: Vector2 (200 , 200 ),
57+ );
58+
59+ final result2 = RawResizeResult (
60+ rect: Box .fromLTRB (100 , 100 , 500 , 400 ),
61+ handle: HandlePosition .bottomRight,
62+ flip: Flip .none,
63+ maxHeightReached: false ,
64+ maxWidthReached: false ,
65+ minHeightReached: false ,
66+ minWidthReached: false ,
67+ oldRect: Box .fromLTRB (100 , 100 , 300 , 200 ),
68+ resizeMode: ResizeMode .freeform,
69+ largestRect: Box .fromLTRB (100 , 100 , 1000 , 1000 ),
70+ rawSize: Dimension (400 , 300 ),
71+ delta: Vector2 (200 , 200 ),
72+ );
73+
74+ expect (result1, result2);
75+ expect (result1.toString (), result2.toString ());
76+ expect (result1.hashCode, result2.hashCode);
77+ expect (result1 == result2, isTrue);
78+ });
79+
80+ test ('RawMoveResult equality tests' , (){
81+ final result1 = RawMoveResult (
82+ rect: Box .fromLTRB (100 , 100 , 500 , 400 ),
83+ oldRect: Box .fromLTRB (100 , 100 , 300 , 200 ),
84+ largestRect: Box .fromLTRB (100 , 100 , 1000 , 1000 ),
85+ rawSize: Dimension (400 , 300 ),
86+ delta: Vector2 (200 , 200 ),
87+ );
88+
89+ final result2 = RawMoveResult (
90+ rect: Box .fromLTRB (100 , 100 , 500 , 400 ),
91+ oldRect: Box .fromLTRB (100 , 100 , 300 , 200 ),
92+ largestRect: Box .fromLTRB (100 , 100 , 1000 , 1000 ),
93+ rawSize: Dimension (400 , 300 ),
94+ delta: Vector2 (200 , 200 ),
95+ );
96+
97+ expect (result1, result2);
98+ expect (result1.toString (), result2.toString ());
99+ expect (result1.hashCode, result2.hashCode);
100+ expect (result1 == result2, isTrue);
101+ });
102+ }
0 commit comments