1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/bindings"#]
2// Copyright © SixtyFPS GmbH <info@slint.dev>
3// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
4
5// hello, hello2 and alias are aliases
6SubElem := Rectangle {
7 property <string> hello <=> hello2;
8 property <string> hello2;
9 t := Text {
10 text <=> hello;
11 }
12 property <string> alias <=> t.text;
13
14 property <string> binding: hello2;
15}
16
17TestCase := Rectangle {
18 property <string> public_alias: "ABC";
19
20 sub_alias := SubElem {
21 hello <=> public_alias;
22 property <string> indirection: binding;
23 }
24
25 property <string> sub_text <=> sub_alias.indirection;
26 property <bool> test: sub_text == "ABC";
27}
28
29
30/*
31
32```rust
33let instance = TestCase::new().unwrap();
34assert_eq!(instance.get_sub_text(), slint::SharedString::from("ABC"));
35instance.set_public_alias(slint::SharedString::from("EFG"));
36assert_eq!(instance.get_sub_text(), slint::SharedString::from("EFG"));
37```
38
39
40```cpp
41auto handle = TestCase::create();
42const TestCase &instance = *handle;
43assert_eq(instance.get_sub_text(), slint::SharedString("ABC"));
44instance.set_public_alias(slint::SharedString("EFG"));
45assert_eq(instance.get_sub_text(), slint::SharedString("EFG"));
46```
47
48```js
49var instance = new slint.TestCase({});
50assert.equal(instance.sub_text, "ABC");
51instance.public_alias = "EFG";
52assert.equal(instance.sub_text, "EFG");
53```
54
55*/
56}
57
58#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
59 use i_slint_backend_testing as slint_testing;
60 slint_testing::init();
61 let instance = TestCase::new().unwrap();
62 assert_eq!(instance.get_sub_text(), slint::SharedString::from("ABC"));
63 instance.set_public_alias(slint::SharedString::from("EFG"));
64 assert_eq!(instance.get_sub_text(), slint::SharedString::from("EFG"));
65 Ok(())
66}