MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / test_visual_rotation_config_values

Function test_visual_rotation_config_values

src/lib.rs:2096–2124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2094 #[rustfmt::skip]
2095 #[test]
2096 fn test_visual_rotation_config_values() {
2097 let mut ply = Ply::<()>::new_headless(Dimensions::new(800.0, 600.0));
2098 let mut ui = ply.begin();
2099
2100 ui.element()
2101 .width(fixed!(100.0)).height(fixed!(100.0))
2102 .background_color(0xFF0000)
2103 .rotate_visual(|r| r
2104 .radians(std::f32::consts::FRAC_PI_2)
2105 .pivot((0.25, 0.75))
2106 .flip_x()
2107 .flip_y()
2108 )
2109 .empty();
2110
2111 let items = ui.eval();
2112
2113 match &items[0].config {
2114 render_commands::RenderCommandConfig::GroupBegin { visual_rotation, .. } => {
2115 let vr = visual_rotation.as_ref().unwrap();
2116 assert!((vr.rotation_radians - std::f32::consts::FRAC_PI_2).abs() < 0.001);
2117 assert_eq!(vr.pivot_x, 0.25);
2118 assert_eq!(vr.pivot_y, 0.75);
2119 assert!(vr.flip_x);
2120 assert!(vr.flip_y);
2121 }
2122 other => panic!("Expected GroupBegin, got {:?}", other),
2123 }
2124 }
2125
2126 #[rustfmt::skip]
2127 #[test]

Callers

nothing calls this directly

Calls 12

beginMethod · 0.80
rotate_visualMethod · 0.80
background_colorMethod · 0.80
heightMethod · 0.80
elementMethod · 0.80
flip_yMethod · 0.80
flip_xMethod · 0.80
pivotMethod · 0.80
radiansMethod · 0.80
evalMethod · 0.80
emptyMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected