()
| 100 | |
| 101 | #[test] |
| 102 | fn test_align() { |
| 103 | let parent = rect([0.0, 0.0], [10.0, 10.0]); |
| 104 | |
| 105 | let off = align( |
| 106 | rect([0.0, 0.0], [1.0, 1.0]), |
| 107 | parent, |
| 108 | HAlignment::Center, |
| 109 | VAlignment::Middle, |
| 110 | ); |
| 111 | assert_eq!(off.x, 4.5); |
| 112 | assert_eq!(off.y, 4.5); |
| 113 | |
| 114 | let off = align( |
| 115 | rect([0.0, 0.0], [1.0, 1.0]), |
| 116 | parent, |
| 117 | HAlignment::Leading, |
| 118 | VAlignment::Bottom, |
| 119 | ); |
| 120 | assert_eq!(off.x, 0.0); |
| 121 | assert_eq!(off.y, 0.0); |
| 122 | } |
| 123 | } |