1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/models"# ] |
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 | import { Button, ListView } from "std-widgets.slint" ; |
6 | |
7 | TestCase := Rectangle { |
8 | width: 300phx; |
9 | height: 50phx; |
10 | |
11 | property<[{name: string}]> model: [ |
12 | { name: "1Olivier" , }, |
13 | { name: "1Simon" , }, |
14 | { name: "2Olivier" , }, |
15 | { name: "2Simon" , }, |
16 | { name: "3Olivier" , }, |
17 | { name: "3Simon" , }, |
18 | { name: "4Olivier" , }, |
19 | { name: "4Simon" , }, |
20 | { name: "5Olivier" , }, |
21 | { name: "6Simon" , }, |
22 | { name: "7Olivier" , }, |
23 | { name: "7Simon" , }, |
24 | { name: "8Olivier" , }, |
25 | { name: "8Simon" , }, |
26 | { name: "9Olivier" , }, |
27 | { name: "9Simon" , }, |
28 | { name: "10Olivier" , }, |
29 | { name: "10Simon" , }, |
30 | { name: "11Olivier" , }, |
31 | { name: "11Simon" , } |
32 | ]; |
33 | |
34 | VerticalLayout { |
35 | ListView { |
36 | for data in model : Button { |
37 | height: 20px; |
38 | text: data.name; |
39 | } |
40 | |
41 | viewport-y: -200px; |
42 | } |
43 | } |
44 | } |
45 | |
46 | /* |
47 | ```rust |
48 | let instance = TestCase::new().unwrap(); |
49 | |
50 | // This should not crash: |
51 | slint_testing::send_keyboard_string_sequence(&instance, &"\t"); |
52 | ``` |
53 | |
54 | ```cpp |
55 | auto handle = TestCase::create(); |
56 | const TestCase &instance = *handle; |
57 | |
58 | // This should not crash: |
59 | slint_testing::send_keyboard_string_sequence(&instance, "\t"); |
60 | ``` |
61 | |
62 | ```js |
63 | var instance = new slint.TestCase({}); |
64 | |
65 | // This should not crash: |
66 | slintlib.private_api.send_keyboard_string_sequence(instance, "\t"); |
67 | ``` |
68 | |
69 | */ |
70 | } |
71 | |
72 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
73 | use i_slint_backend_testing as slint_testing; |
74 | slint_testing::init(); |
75 | let instance = TestCase::new().unwrap(); |
76 | |
77 | // This should not crash: |
78 | slint_testing::send_keyboard_string_sequence(&instance, &" \t" ); |
79 | Ok(()) |
80 | } |