slint/internal/compiler/tests/syntax/callbacks/property-changes.slint
2024-06-28 10:45:45 +02:00

49 lines
1.5 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export component Sub {
in-out property <int> zoo;
private property <int> clou;
callback clicked;
public function hello() {}
out property <invalid> invalid;
// ^error{Unknown type 'invalid'}
}
export component Test {
Sub {
changed zoo => { }
changed clou => { }
// ^error{Change callback on a private property 'clou'}
changed zoo => { }
// ^error{Duplicated change callback on 'zoo'}
changed not-exist => {}
// ^error{Property 'not-exist' does not exist}
changed clicked => { }
// ^error{Change callback can only be set on properties, and 'clicked' is a callback}
changed hello => { }
// ^error{Change callback can only be set on properties, and 'hello' is a function}
changed invalid => { }
// ^error{Property 'invalid' does not exist}
property <invalid2> invalid2;
// ^error{Unknown type 'invalid2'}
changed invalid2 => { }
// ^error{Property 'invalid2' does not exist}
property <Sub> invalid3;
// ^error{'Sub' is not a valid type}
changed invalid3 => { }
// ^error{Property 'invalid3' does not exist}
}
property <int> xyz: 42;
changed xyz => { }
}