slint/tests/cases/elements/scaling2.slint
Olivier Goffart 8ce8a94a26
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / files-changed (push) Waiting to run
CI / build_and_test (ubuntu-22.04, 1.88) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, 1.88) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.88) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / material-components (push) Blocked by required conditions
Rename scale* property to transform-scale*
This is to avoid reserving the `scale` property on every element which
is a common property name
2025-10-07 16:15:06 +02:00

64 lines
1.9 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: 800px;
height: 600px;
in-out property <string> result;
r-a := Rectangle {
x: 10px;
y: 10px;
width: 20px;
height: 20px;
rotation-origin-x: 0;
rotation-origin-y: 0;
transform-scale: 2;
TouchArea {
clicked => { result += "A"}
}
}
r-b := Rectangle {
x: 100px;
y: 100px;
width: 20px;
height: 20px;
transform-scale: 3;
transform-scale-x: 0.5;
TouchArea {
clicked => { result += "B"}
}
}
out property <bool> test:
r-a.transform-scale == 2 && r-a.transform-scale-x == 2 && r-a.transform-scale-y == 2 &&
r-b.transform-scale-x == 0.5 && r-b.transform-scale-y == 3;
}
/*
```rust
let instance = TestCase::new().unwrap();
assert_eq!(instance.get_test(), true);
slint_testing::send_mouse_click(&instance, 10.0 + 39.0 , 10.0 + 39.0);
assert_eq!(instance.get_result(), "A", "was just clicked inside");
slint_testing::send_mouse_click(&instance, 10.0 + 19.0 , 10.0 + 41.0);
assert_eq!(instance.get_result(), "A", "was just clicked outside");
slint_testing::send_mouse_click(&instance, 10.0 + 41.0 , 10.0 + 19.0);
assert_eq!(instance.get_result(), "A", "was just clicked outside again");
slint_testing::send_mouse_click(&instance, 100.0 + 6. , 100.0 - 19.0);
assert_eq!(instance.get_result(), "AB", "was just clicked inside");
slint_testing::send_mouse_click(&instance, 100.0 + 4., 100.0);
assert_eq!(instance.get_result(), "AB", "was just clicked outside");
slint_testing::send_mouse_click(&instance, 100.0 + 10., 100. - 21.);
assert_eq!(instance.get_result(), "AB", "was just clicked outside again");
```
*/