1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4
5
6component DeltasList {
7 in property <string> delta;
8}
9
10component Changelog inherits Rectangle {
11 in-out property <int> count-files-changed;
12 in-out property <[string]> changes_log: [];
13 in-out property <int> selected: -2;
14 callback selection-changed(/*new selection*/ int);
15}
16
17export component TestCase inherits Window {
18 in-out property <[string]> changes_log <=> log.changes_log;
19 in-out property <int> count-files-changed <=> log.count-files-changed;
20 in-out property <string> delta <=> deltas.delta;
21 callback request-change-delta(string);
22 callback request-diff-delta(string);
23
24 function fill-diff-view() {
25 if log.selected >= 0 && log.selected < changes_log.length {
26 root.request-change-delta(changes_log[log.selected])
27 } else if log.selected == -1 {
28 root.request-diff-delta("channel name")
29 } else {
30 delta = "";
31 }
32 }
33
34 HorizontalLayout {
35 log := Changelog {
36 selection-changed => {
37 fill-diff-view();
38 }
39 }
40
41 deltas := DeltasList {
42 horizontal-stretch: 3;
43 }
44 }
45
46 //----
47
48 in-out property <int> abc : 25;
49 in-out property <int> new-value: 45;
50 function test-abc() {
51 if new-value != 45 && abc > 0 && abc < 10 {
52 debug("XXX", abc);
53 } else if abc > 45 || new-value == 8 {
54 debug(abc)
55 } else {
56 new-value = abc
57 }
58 }
59 init => { test-abc(); }
60 out property <bool> test: new-value == 25;
61}
62
63/*
64```rust
65let instance = TestCase::new().unwrap();
66assert!(instance.get_test());
67```
68
69```cpp
70auto handle = TestCase::create();
71const TestCase &instance = *handle;
72assert(instance.get_test());
73```
74
75```js
76let instance = new slint.TestCase({});
77assert(instance.test);
78```
79
80*/
81