1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4// Test that structs work if they are only referenced by functions
5
6struct Foo1 { member: int, }
7struct Foo2 { a: Foo1 }
8struct Foo3 { b: int }
9
10TestCase := TouchArea {
11 // Based on Issue #2655
12 public function fn1(foo2: Foo2) -> Foo3 {
13 return { b: foo2.a.member+1 };
14 }
15}
16
17
18/*
19```rust
20let instance = TestCase::new().unwrap();
21
22assert_eq!(instance.invoke_fn1(Foo2{ a: Foo1{ member: 123 } }).b, 124);
23```
24
25```cpp
26auto handle = TestCase::create();
27const TestCase &instance = *handle;
28
29assert_eq(instance.invoke_fn1(Foo2{ Foo1{ 123 } }).b, 124);
30```
31
32*/
33