slint/tests/cases/callbacks/callback_name_conflicts.60
2021-07-02 15:55:54 +02:00

41 lines
1 KiB
Text

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
TestCase := Rectangle {
width: 100phx;
height: 100phx;
property <int> value;
callback clicked; // this callback shouldn't conflict with the other callback
TouchArea {
clicked => { value += 1; }
}
}
/*
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
sixtyfps::testing::send_mouse_click(&instance, 5., 5.);
assert_eq(instance.get_value(), 1);
```
```rust
let instance = TestCase::new();
sixtyfps::testing::send_mouse_click(&instance, 5., 5.);
assert_eq!(instance.get_value(), 1);
```
```js
var instance = new sixtyfps.TestCase();
instance.send_mouse_click(5., 5.);
assert.equal(instance.value, 1);
```
*/