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

Function test_pressed_query

src/lib.rs:2421–2450  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2419
2420 #[test]
2421 fn test_pressed_query() {
2422 let mut ply = Ply::<()>::new_headless(Dimensions::new(800.0, 600.0));
2423
2424 // Frame 1: layout
2425 {
2426 let mut ui = ply.begin();
2427 ui.element()
2428 .id("btn")
2429 .width(fixed!(100.0))
2430 .height(fixed!(100.0))
2431 .empty();
2432 ui.eval();
2433 }
2434
2435 // Simulate pointer press at (50, 50)
2436 ply.context.set_pointer_state(Vector2::new(50.0, 50.0), true);
2437
2438 // Frame 2: check pressed() during layout
2439 {
2440 let mut ui = ply.begin();
2441 ui.element()
2442 .id("btn")
2443 .width(fixed!(100.0))
2444 .height(fixed!(100.0))
2445 .children(|ui| {
2446 assert!(ui.pressed(), "element should report as pressed");
2447 });
2448 ui.eval();
2449 }
2450 }
2451
2452 #[test]
2453 fn test_just_pressed_query_one_frame() {

Callers

nothing calls this directly

Calls 9

beginMethod · 0.80
heightMethod · 0.80
idMethod · 0.80
elementMethod · 0.80
evalMethod · 0.80
set_pointer_stateMethod · 0.80
childrenMethod · 0.80
emptyMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected