mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-06 03:38:48 +00:00

* syntax_tests: allow to "bless" tests, and don't use a regexp
A regexp was used at the beginning because I thought we would want to
allow error to contains things that were not predictable or that would
often change. But this is not the case¹. It is better to actually test
for the full error message
¹ well actually it was the case for path, but there is another substitution to
`📂` for the manifest directory
* syntax_tests: Bless the tests
* syntax_tests: Manual adjust after bless
Because there used to be comments on the same line of the message which
bless don't support
* Fix error message with path on windows
- The debug implementation of path make double slash, that's not what
we want to show the user
- normalize paths to use `/` so the test passes
106 lines
2.8 KiB
Text
106 lines
2.8 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
|
|
|
|
component Compo inherits Rectangle {
|
|
property <int> priv1: 42;
|
|
private property <int> priv2: priv1;
|
|
out property <int> output1: priv2;
|
|
in property <int> input1: output1;
|
|
in-out property <int> inout1: input1;
|
|
|
|
TouchArea {
|
|
clicked => {
|
|
priv1 = 32;
|
|
priv2 = 78;
|
|
output1 = input1;
|
|
input1 = 75;
|
|
// ^error{Assignment on a input property}
|
|
inout1 = 75;
|
|
}
|
|
|
|
pressed: true;
|
|
// ^error{Cannot assign to output property 'pressed'}
|
|
|
|
}
|
|
|
|
states [
|
|
xxx when false : {
|
|
priv1: 42;
|
|
priv2: 55;
|
|
output1: 55;
|
|
input1: 12;
|
|
// ^error{'input1' cannot be set in a state because it is input}
|
|
inout1: 78;
|
|
}
|
|
]
|
|
|
|
animate input1 {}
|
|
// ^error{Cannot animate input property 'input1'}
|
|
}
|
|
|
|
OldCompo := Rectangle {
|
|
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
|
|
property <int> inout2: 42;
|
|
private property <int> priv2: inout2;
|
|
out property <int> output1: priv2;
|
|
in property <int> input1: output1;
|
|
in-out property <int> inout1: input1;
|
|
|
|
TouchArea {
|
|
clicked => {
|
|
pub1 = 32;
|
|
// ^error{Unknown unqualified identifier 'pub1'}
|
|
priv2 = 78;
|
|
output1 = input1;
|
|
input1 = 75;
|
|
// ^error{Assignment on a input property}
|
|
inout1 = 75;
|
|
}
|
|
}
|
|
}
|
|
|
|
export component Foo inherits Rectangle {
|
|
|
|
c1 := OldCompo {
|
|
inout2: 42;
|
|
priv2: 55;
|
|
// ^error{Cannot assign to private property 'priv2'}
|
|
output1: 855;
|
|
// ^error{Cannot assign to output property 'output1'}
|
|
input1: 12;
|
|
inout1: 78;
|
|
|
|
animate output1 {}
|
|
// ^error{Cannot animate output property 'output1'}
|
|
|
|
animate priv2 {}
|
|
// ^error{Cannot animate private property 'priv2'}
|
|
|
|
}
|
|
|
|
c2 := Compo {
|
|
priv1: 42;
|
|
// ^error{Cannot assign to private property 'priv1'}
|
|
priv2: 55;
|
|
// ^error{Cannot assign to private property 'priv2'}
|
|
output1: 585;
|
|
// ^error{Cannot assign to output property 'output1'}
|
|
input1: 12;
|
|
inout1: 78;
|
|
}
|
|
|
|
states [
|
|
foo when true: {
|
|
c2.priv1: 45;
|
|
// ^error{'c2.priv1' cannot be set in a state because it is private}
|
|
|
|
c1.priv2: 89;
|
|
// ^error{'c1.priv2' cannot be set in a state because it is private}
|
|
|
|
c2.output1: 55;
|
|
// ^error{'c2.output1' cannot be set in a state because it is output}
|
|
}
|
|
]
|
|
|
|
}
|
|
|