mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-22 16:22:17 +00:00

Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
62 lines
2.3 KiB
Text
62 lines
2.3 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
export component TestCase {
|
|
width: 300px;
|
|
height: 300px;
|
|
|
|
popup := PopupWindow {
|
|
x: 100px;
|
|
y: 10px;
|
|
width: 100px;
|
|
height: parent.height - 20px;
|
|
Rectangle { background: blue; }
|
|
TouchArea {
|
|
y: 0px; x: 0px;
|
|
height: 50px;
|
|
width: 50px;
|
|
mouse-cursor: not-allowed;
|
|
}
|
|
}
|
|
|
|
TouchArea {
|
|
mouse-cursor: help;
|
|
x: 0px;
|
|
width: 150px;
|
|
clicked => {
|
|
popup.show()
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
/*
|
|
|
|
```rust
|
|
use slint::{platform::WindowEvent, LogicalPosition};
|
|
use slint::private_unstable_api::re_exports::MouseCursor;
|
|
|
|
let instance = TestCase::new().unwrap();
|
|
assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default);
|
|
|
|
instance.window().dispatch_event(WindowEvent::PointerMoved { position: LogicalPosition::new(35.0, 35.0) });
|
|
assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Help);
|
|
slint_testing::send_mouse_click(&instance, 35., 35.);
|
|
assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default);
|
|
|
|
instance.window().dispatch_event(WindowEvent::PointerMoved { position: LogicalPosition::new(135.0, 35.0) });
|
|
assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::NotAllowed);
|
|
|
|
instance.window().dispatch_event(WindowEvent::PointerMoved { position: LogicalPosition::new(35.0, 35.0) });
|
|
assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Default);
|
|
|
|
// Close the popup
|
|
|
|
slint_testing::send_mouse_click(&instance, 135., 35.);
|
|
// FIXME: it takes two events to get that correctly
|
|
// assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Help);
|
|
instance.window().dispatch_event(WindowEvent::PointerMoved { position: LogicalPosition::new(135.0, 35.0) });
|
|
assert_eq!(slint_testing::access_testing_window(instance.window(), |window| window.mouse_cursor.get()), MouseCursor::Help);
|
|
```
|
|
|
|
*/
|