syntax_tests: allow to update tests, and don't use a regexp (#8589)

* 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
This commit is contained in:
Olivier Goffart 2025-06-02 16:47:33 +02:00 committed by GitHub
parent 05c2b38a52
commit 12393e21bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
156 changed files with 701 additions and 418 deletions

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
animate x {
duration: 1000ms;
@ -15,7 +16,7 @@ export SuperSimple := Rectangle {
animate y {
nonexistent: 42;
// ^error{Unknown property nonexistent}
// ^error{Unknown property nonexistent in PropertyAnimation}
}
animate text {

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export Test := Window {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
a: [,];
// ^error{invalid expression}
}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
TouchArea {
clicked => { root.x = 1phx; }
}

View file

@ -2,10 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Foo := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
drop-shadow-color: red;
}
export SuperSimple := Window {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
drop-shadow-color: #00000080;
// ^warning{The drop-shadow-color property cannot be used on the root element, the shadow will not be visible}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export NotInIf := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
if true: Rectangle {
@children
// ^error{The @children placeholder cannot appear in a conditional element}
@ -9,6 +10,7 @@ export NotInIf := Rectangle {
}
export NotInFor := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
HorizontalLayout {
for xxx in 12: Rectangle {
VerticalLayout {
@ -20,12 +22,14 @@ export NotInFor := Rectangle {
}
TestBox := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
@children
@children
// ^error{The @children placeholder can only appear once in an element}
}
export TestBox2 := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {
@children
}
@ -34,6 +38,7 @@ export TestBox2 := Rectangle {
}
export Final := TestBox {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {
@children
}

View file

@ -2,8 +2,10 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
MyTouchArea := TouchArea { }
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
export SubElements := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {
clip: 42;
// ^error{Cannot convert float to bool}

View file

@ -5,6 +5,7 @@
// line comment
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
/* block comment */
background: green;
@ -15,7 +16,7 @@ export SuperSimple := Rectangle {
lines
*/
background: /* . */ blue;
// ^error{Duplicated property}
// ^error{Duplicated property binding}
}
/* another comment

View file

@ -4,6 +4,7 @@
import { StandardButton } from "std-widgets.slint";
MyDiag1 := Dialog {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {}
StandardButton { kind: cancel; }
Rectangle {}
@ -11,7 +12,8 @@ MyDiag1 := Dialog {
}
MyDiag2 := Dialog {
// ^error{A Dialog must have a single child element that is not StandardButton}
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
// ^^error{A Dialog must have a single child element that is not StandardButton}
StandardButton { kind: reset; }
StandardButton {
kind: cancel;
@ -23,6 +25,7 @@ MyDiag2 := Dialog {
}
MyDiag3 := Dialog {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle { }
StandardButton { kind: ok; }
StandardButton { }
@ -35,6 +38,7 @@ MyDiag3 := Dialog {
}
MyDialog4 := Dialog {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
StandardButton { kind: ok; }
r := Rectangle { dialog-button-role: accept; }
Rectangle { dialog-button-role: none; }
@ -53,6 +57,7 @@ MyDialog4 := Dialog {
}
export Test := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
MyDiag1 {}
MyDiag2 {}
MyDiag3 {}

View file

@ -4,7 +4,8 @@
import { StandardButton } from "std-widgets.slint";
export Test := Dialog {
// ^error{A Dialog must have a single child element that is not StandardButton}
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
// ^^error{A Dialog must have a single child element that is not StandardButton}
StandardButton { kind: ok; }
StandardButton { }
// ^error{The `kind` property of the StandardButton in a Dialog must be set}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
x: 42phx;
x: 32phx;

View file

@ -3,7 +3,8 @@
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
background: green;
background: red;
// ^error{Duplicated property}
// ^error{Duplicated property binding}
}

View file

@ -3,6 +3,7 @@
SubElement := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
foo := Rectangle {
background: yellow;
@ -27,6 +28,7 @@ SubElement := Rectangle {
}
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
unique := Rectangle {
foo := SubElement { }

View file

@ -2,20 +2,21 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
animate x { easing: ease-in; }
animate y { easing: foo; }
// ^error{Unknown unqualified identifier 'foo'}
// ^error{Unknown unqualified identifier 'foo'}
animate background { easing: a; }
// ^error{Cannot convert int to easing}
// ^error{Cannot convert int to easing}
property <int> a; animate a { easing: cubic-bezier(0.01,1.46,0.94,1.37); }
property <int> b; animate b { easing: cubic-bezier(0.01,1.46,0.94); }
// ^error{Not enough arguments}
// ^error{Not enough arguments}
property <int> c; animate c { easing: cubic-bezier(); }
// ^error{Not enough arguments}
// ^error{Not enough arguments}
property <int> d; animate d { easing: cubic-bezier(0,0,0,0,0,0); }
// ^error{Too many argument for bezier curve}
// ^error{Too many argument for bezier curve}
property <int> e; animate e { easing: cubic-bezier(0, a, b, c); }
// ^error{Arguments to cubic bezier curve must be number literal}
// ^error{Arguments to cubic bezier curve must be number literal}
property <int> f; animate f { easing: cubic-bezier(0,0+0,0,0,0); }
// ^error{Arguments to cubic bezier curve must be number literal}
// ^error{Arguments to cubic bezier curve must be number literal}
}

View file

@ -4,6 +4,7 @@
// Cannot be put in the easing.slint test because it is in a different pass
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property <int> g; animate g { easing: cubic-bezier; }
// ^error{must be called}
// ^error{Builtin function must be called. Did you forgot the '()'?}
}

View file

@ -3,6 +3,7 @@
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
background: green;
for xx Text {}
@ -21,7 +22,7 @@ export SuperSimple := Rectangle {
}
for x in 0..32: Rectangle { }
// ^error{Parse error. Range expressions are not supported in Slint. You can use an integer as a model to repeat something multiple time. Eg: `for i in 32 : ...`}
// ^error{Parse error. Range expressions are not supported in Slint. You can use an integer as a model to repeat something multiple time. Eg: `for i in 32 : ...`}
}

View file

@ -6,17 +6,17 @@ export component Foo {
in property <int> count;
for x in 0..count: Rectangle { }
// ^error{Cannot access the field 'count' of float. Range expressions are not supported in Slint, but you can use an integer as a model to repeat something multiple time. Eg: `for i in count`}
// ^error{Cannot access the field 'count' of float. Range expressions are not supported in Slint, but you can use an integer as a model to repeat something multiple time. Eg: `for i in count`}
// In these case, we should not suggest to use a model with a count
property <float> invalid: 0..count;
// ^error{Cannot access the field 'count' of float$}
// ^error{Cannot access the field 'count' of float}
for x in invalid.count: Rectangle { }
// ^error{Cannot access the field 'count' of float$}
// ^error{Cannot access the field 'count' of float}
for x in 0.px.count: Rectangle { }
// ^error{Cannot access the field 'count' of length$}
// ^error{Cannot access the field 'count' of length}
}

View file

@ -3,6 +3,7 @@
export SubElements := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
background: blue;

View file

@ -2,12 +2,14 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Inline1 := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {
x: 66phx;
}
}
export SubElements := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Inline1 {
background: yellow;
invalid: yellow;

View file

@ -2,9 +2,11 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
struct Str := { foo: Rectangle }
// ^error{'Rectangle' is not a valid type}
// ^warning{':=' to declare a struct is deprecated. Remove the ':='}
// ^^error{'Rectangle' is not a valid type}
Comp := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property <Rectangle> r;
// ^error{'Rectangle' is not a valid type}
@ -20,10 +22,11 @@ Comp := Rectangle {
}
export Foo := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
xx := Rectangle { }
Comp {
r: xx;
// ^error{Unknown property}
// ^error{Unknown property r in Comp}
// ^^error{Cannot take reference of an element}
}
}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
lay := GridLayout {
property<string> foo: "hello";

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
lay := GridLayout {
property<string> foo: "hello";

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property<brush> g1: @linear-gradient();
// ^error{Expected angle expression}
property<brush> g2: @linear-gradient(to left, blue, red);

View file

@ -2,11 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export H := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
x: {foo: "42"};
// ^error{Cannot convert \{ foo: string,\} to length}
// ^error{Cannot convert { foo: string,} to length}
y: [ 45, 45, 45, 45 ];
// ^error{Cannot convert \[float\] to length}
// ^error{Cannot convert [float] to length}
background: [ { a: 45, b: 55, }, {a: 44, b: 54},];
// ^error{Cannot convert \[\{ a: float,b: float,\}\] to brush}
// ^error{Cannot convert [{ a: float,b: float,}] to brush}
}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export SuperSimple := Window {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
opacity: 0.5;
// ^warning{The opacity property cannot be used on the root element, it will not be applied}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
88;
// ^error{Parse error}
* / - + // no error there as this is already reported in the previous line
@ -15,7 +16,7 @@ export SuperSimple := Rectangle {
there was already parse error in this scope, so no more
property <string> xyz = 425;
// ^error{Syntax error: expected ';'}
// ^error{Syntax error: expected ';'}
Image {
* .

View file

@ -3,6 +3,7 @@
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Path {
LineTo { x: 100; y: 0; }
LineTo { x: 100; y: 0; }

View file

@ -2,18 +2,20 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Test2 := Path {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
width: 640px;
height: 480px;
commands: "M 0 0 M -100 0 A 100 100 0 1 0 100 0 Å 100 100 0 1 0 100 0 Z";
// ^error{Error parsing SVG commands}
// ^error{Error parsing SVG commands (Number { src: "", line: 0, column: 37 })}
}
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Path {
width: 100px;
height: 100px;
commands: "hello world";
// ^error{Error parsing SVG commands}
// ^error{Error parsing SVG commands (Number { src: "e", line: 0, column: 1 })}
stroke: red;
stroke-width: 1px;
}
@ -28,17 +30,17 @@ export TestCase := Rectangle {
width: 640px;
height: 480px;
commands: "M 0 0 M -100 0 A 100 100 0 1 0 0 A 100 100 0 1 0 100 0 Z";
// ^error{Error parsing SVG commands}
// ^error{Error parsing SVG commands (Number { src: "", line: 0, column: 33 })}
}
TouchArea {
clicked => {
p.commands = "M 0 0 M -100 0 A 100 100 0 1 0 100 0 A 100 100 0 1 0 100 0 Z";
// ^error{This special property can only be used to make a binding and cannot be accessed}
// ^error{This special property can only be used to make a binding and cannot be accessed}
}
}
Text { text: p.commands; }
// ^error{This special property can only be used to make a binding and cannot be accessed}
// ^error{This special property can only be used to make a binding and cannot be accessed}
Test2 {}

View file

@ -3,13 +3,14 @@
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Path {
MoveTo {
x: 0;
y: 0;
}
for sample[i] in [ 0, 1, 2, 3 ] : LineTo {
// ^error{Path elements are not supported with `for`-`in` syntax, yet \(https://github.com/slint-ui/slint/issues/754\)}
// ^error{Path elements are not supported with `for`-`in` syntax, yet (https://github.com/slint-ui/slint/issues/754)}
x: i;
y: sample;
}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Foo := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
width: 30%;
preferred-width: 50%;
@ -17,6 +18,7 @@ Foo := Rectangle {
}
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
height: 30%;
// ^error{Cannot find parent property to apply relative length}
Foo {

View file

@ -22,13 +22,15 @@ component Issue5852 {
export X := PopupWindow {
// ^error{PopupWindow cannot be the top level}
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
// ^^error{PopupWindow cannot be the top level}
Rectangle {
// ^error{Access to property 'inner.opacity' which is inlined into a PopupWindow via @children is forbidden} // FIXME, the error should be located on property access (#4438)
Rectangle { // FIXME, the error should be located on property access (#4438)
// ^error{Access to property 'inner.opacity' which is inlined into a PopupWindow via @children is forbidden}
popup := PopupWindow { // FIXME, the error should be located on property access (#4438)
// ^error{Cannot access the inside of a PopupWindow from enclosing component}
popup := PopupWindow {
// ^error{Cannot access the inside of a PopupWindow from enclosing component} // FIXME, the error should be located on property access (#4438)
r := Rectangle {
}
}
@ -43,9 +45,9 @@ export X := PopupWindow {
if true : PopupWindow {}
// ^error{PopupWindow cannot be directly repeated or conditional}
// ^error{PopupWindow cannot be directly repeated or conditional}
for abc in [1] : PopupWindow {}
// ^error{PopupWindow cannot be directly repeated or conditional}
// ^error{PopupWindow cannot be directly repeated or conditional}
Issue5852 {}
}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
animate x {
duration: 1000ms;
}

View file

@ -2,10 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Comp := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
callback pressed;
}
export Test := Comp {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property<int> foo;
foo: 100;
property<NonExistent> bar;

View file

@ -2,10 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Comp := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property<int> prop;
}
export Test := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Comp {
prop: 45;
}

View file

@ -2,20 +2,21 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property<brush> g1: @radial-gradient();
// ^error{Expected 'circle': currently, only @radial-gradient\(circle, ...\) are supported}
// ^error{Expected 'circle': currently, only @radial-gradient(circle, ...) are supported}
property<brush> g2: @radial-gradient(circle at 100%, #333, #333 50%, #eee 75%, #333 75%);
// ^error{'at' in @radial-gradient is not yet supported}
property<brush> g3: @radial_gradient(circle, blue, red);
property<brush> g4: @radial_gradient(circle, blue 45%, red red);
// ^error{Cannot convert color to float}
property<brush> g5: @radial-gradient(ellipse at top, #e66465, transparent);
// ^error{Expected 'circle': currently, only @radial-gradient\(circle, ...\) are supported}
// ^error{Expected 'circle': currently, only @radial-gradient(circle, ...) are supported}
property<brush> g6: @radial-gradient(circle, blue 45%, red 88%);
property<brush> g7: @radial-gradient(circle, 42 45%, red 0.3);
// ^error{Cannot convert float to color}
property<brush> g8: @radial-gradient(90px, blue, red ,green);
// ^error{Expected 'circle': currently, only @radial-gradient\(circle, ...\) are supported}
// ^error{Expected 'circle': currently, only @radial-gradient(circle, ...) are supported}
property<brush> g9: @radial-gradient(circle blue, blue, red);
// ^error{'circle' must be followed by a comma}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export X := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
background: {
return 42;
// ^error{Cannot convert float to brush}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export Ex1 := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {
rotation-origin-x: width / 2;
rotation-angle: 45deg;
@ -20,16 +21,20 @@ export Ex1 := Rectangle {
}
RotImg := Image {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
rotation-angle: 45deg;
}
JustAnImage := Image {}
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
ImageWithChild := Image {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {}
}
export Ex2 := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Image {
// ^error{Elements with rotation properties cannot have children elements}
rotation-angle: 45deg;
@ -52,6 +57,7 @@ export Ex2 := Rectangle {
export Ex3 := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
i1 := Image {
// ^error{Elements with rotation properties cannot have children elements}
Rectangle {}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
TouchArea {
clicked => { root.x += 1phx; }
}
@ -25,7 +26,7 @@ export SuperSimple := Rectangle {
TouchArea {
property <string> text;
clicked => { text *= 2; }
// ^error{the \*= operation cannot be done on a string}
// ^error{the *= operation cannot be done on a string}
}
TouchArea {
@ -39,7 +40,7 @@ export SuperSimple := Rectangle {
text /= "hello";
// ^error{the /= operation cannot be done on a string}
text *= 2;
// ^error{the \*= operation cannot be done on a string}
// ^error{the *= operation cannot be done on a string}
text -= text;
// ^error{the -= operation cannot be done on a string}
}
@ -48,18 +49,18 @@ export SuperSimple := Rectangle {
TouchArea {
property <brush> color;
clicked => { color += color; }
// ^error{the \+= operation cannot be done on a brush}
// ^error{the += operation cannot be done on a brush}
}
TouchArea {
property <brush> color;
clicked => { color *= 3; }
// ^error{the \*= operation cannot be done on a brush}
// ^error{the *= operation cannot be done on a brush}
}
TouchArea {
clicked => { height /= height; }
// ^error{Cannot convert length to float}
// ^error{Cannot convert length to float. Divide by 1px to convert to a plain number}
}
}

View file

@ -2,10 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
Base := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
callback blah;
}
export SubElements := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
callback foobar;
callback foobar;
// ^error{Duplicated callback declaration}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property<bool> checked;
property <int> border;
states [
@ -14,15 +15,15 @@ export TestCase := Rectangle {
color: green;
border: 88;
text.foo.bar: 0;
/// ^error{'text.foo.bar' is not a valid property}
// ^error{'text.foo.bar' is not a valid property}
colour: yellow;
/// ^error{'colour' is not a valid property}
/// ^^error{Unknown unqualified identifier 'yellow'}
// ^error{'colour' is not a valid property}
// ^^error{Unknown unqualified identifier 'yellow'}
fox.color: yellow;
/// ^error{'fox' is not a valid element id}
// ^error{'fox' is not a valid element id}
text.fox: yellow;
/// ^error{'fox' not found in 'text'}
/// ^^error{Unknown unqualified identifier 'yellow'}
// ^error{'fox' not found in 'text'}
// ^^error{Unknown unqualified identifier 'yellow'}
}
]
@ -33,11 +34,11 @@ export TestCase := Rectangle {
}
out pressed: {
animate color, foo.x { duration: 300ms; }
/// ^error{'foo' is not a valid element id}
// ^error{'foo' is not a valid element id}
//pause: 20ms;
animate border { duration: 120ms; }
animate color, text.text { duration: 300ms; }
/// ^error{'text.text' is not a property that can be animated}
// ^error{'text.text' is not a property that can be animated}
}
in-out checked: {
@ -69,15 +70,15 @@ export component NewSyntax {
color: green;
border: 88;
text.foo.bar: 0;
/// ^error{'text.foo.bar' is not a valid property}
// ^error{'text.foo.bar' is not a valid property}
colour: yellow;
/// ^error{'colour' is not a valid property}
/// ^^error{Unknown unqualified identifier 'yellow'}
// ^error{'colour' is not a valid property}
// ^^error{Unknown unqualified identifier 'yellow'}
fox.color: yellow;
/// ^error{'fox' is not a valid element id}
// ^error{'fox' is not a valid element id}
text.fox: yellow;
/// ^error{'fox' not found in 'text'}
/// ^^error{Unknown unqualified identifier 'yellow'}
// ^error{'fox' not found in 'text'}
// ^^error{Unknown unqualified identifier 'yellow'}
in {
animate * { duration: 88ms; }
@ -85,10 +86,10 @@ export component NewSyntax {
}
out {
animate color, foo.x { duration: 300ms; }
/// ^error{'foo' is not a valid element id}
// ^error{'foo' is not a valid element id}
animate border { duration: 120ms; }
animate color, text.text { duration: 300ms; }
/// ^error{'text.text' is not a property that can be animated}
// ^error{'text.text' is not a property that can be animated}
}
}
]
@ -112,30 +113,30 @@ export component OldInNewSyntax {
color: green;
border: 88;
text.foo.bar: 0;
/// ^error{'text.foo.bar' is not a valid property}
// ^error{'text.foo.bar' is not a valid property}
colour: yellow;
/// ^error{'colour' is not a valid property}
/// ^^error{Unknown unqualified identifier 'yellow'}
// ^error{'colour' is not a valid property}
// ^^error{Unknown unqualified identifier 'yellow'}
fox.color: yellow;
/// ^error{'fox' is not a valid element id}
// ^error{'fox' is not a valid element id}
text.fox: yellow;
/// ^error{'fox' not found in 'text'}
/// ^^error{Unknown unqualified identifier 'yellow'}
// ^error{'fox' not found in 'text'}
// ^^error{Unknown unqualified identifier 'yellow'}
}
]
transitions [
/// ^error{'transitions' block are no longer supported. Use 'in \{...\}' and 'out \{...\}' directly in the state definition}
// ^error{'transitions' block are no longer supported. Use 'in {...}' and 'out {...}' directly in the state definition}
in pressed: {
animate * { duration: 88ms; }
animate color { duration: 88ms; }
}
out pressed: {
animate color, foo.x { duration: 300ms; }
/// ^error{'foo' is not a valid element id}
// ^error{'foo' is not a valid element id}
animate border { duration: 120ms; }
animate color, text.text { duration: 300ms; }
/// ^error{'text.text' is not a property that can be animated}
// ^error{'text.text' is not a property that can be animated}
}
]

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
property<bool> checked;
property <int> border;
animate background { }

View file

@ -3,6 +3,7 @@
export Demo := Window {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
width: 300px;
height: 300px;
property <bool> toggle;
@ -20,11 +21,11 @@ export Demo := Window {
transitions [
in moving: {
animate y { duration: 5s; }
// ^error{The property is not changed as part of this transition}
// ^error{The property is not changed as part of this transition}
}
out moving: {
animate t.x { duration: 100ms; }
// ^error{The property is not changed as part of this transition}
// ^error{The property is not changed as part of this transition}
}
]
}

View file

@ -3,6 +3,7 @@
export Demo := Window {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
width: 300px;
height: 300px;
property <bool> toggle;

View file

@ -3,6 +3,7 @@
export SubElements := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Rectangle {
background: yellow;

View file

@ -3,5 +3,6 @@
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
background: green;
}

View file

@ -3,6 +3,7 @@
export TestCase := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
Path {
commands: "M 350 300 L 550 300 ";
LineTo { x: 10; y: 100; }

View file

@ -3,35 +3,35 @@
export component X {
property <string> t1: @tr(boo);
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
// ^^^error{Parse error}
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
// ^^^error{Parse error}
property <string> t2: @tr("boo\{t1}oo");
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
property <string> t3: @tr("boo" + "foo");
// ^error{Syntax error: expected '\)'}
// ^^error{Syntax error: expected ';'}
// ^error{Syntax error: expected ')'}
// ^^error{Syntax error: expected ';'}
property <string> t4: @tr("foo{}", t1);
property <string> t4: @tr("foo{}", t1 t2);
// ^error{Syntax error: expected '\)'}
// ^^error{Syntax error: expected ';'}
// ^error{Syntax error: expected ')'}
// ^^error{Syntax error: expected ';'}
property <string> c1: @tr("boo" => );
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
property <string> c2: @tr("boo" => "foo\{ff}");
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
property <string> e: @tr();
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}
// ^error{Expected plain string literal}
// ^^error{Syntax error: expected ';'}

View file

@ -3,39 +3,39 @@
export component X {
property <string> t1: @tr("fo{}oo", 42px);
// ^error{Cannot convert length to string. Divide by 1px to convert to a plain number}
// ^error{Cannot convert length to string. Divide by 1px to convert to a plain number}
property <string> t2: @tr("foo{0⃣}bar", 45);
// ^error{Invalid '\{...\}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '\{\{' and '\}\}'}
// ^error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
property <string> t6: @tr("foo{", 45);
// ^error{Unterminated placeholder in format string. '\{' must be escaped with '\{\{'}
// ^error{Unterminated placeholder in format string. '{' must be escaped with '{{'}
property <string> t7: @tr("foo{bar", 45);
// ^error{Unterminated placeholder in format string. '\{' must be escaped with '\{\{'}
// ^error{Unterminated placeholder in format string. '{' must be escaped with '{{'}
property <string> t8: @tr("foo{bar}bar", 45);
// ^error{Invalid '\{...\}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '\{\{' and '\}\}'}
// ^error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
property <string> t9: @tr("foo{}bar");
// ^error{Format string contains 1 placeholders, but only 0 extra arguments were given}
// ^error{Format string contains 1 placeholders, but only 0 extra arguments were given}
property <string> t10: @tr("foo{}ba{}r", 42);
// ^error{Format string contains 2 placeholders, but only 1 extra arguments were given}
// ^error{Format string contains 2 placeholders, but only 1 extra arguments were given}
property <string> t11: @tr("foo{65535}ba{2147483647}r");
// ^error{Invalid '\{...\}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '\{\{' and '\}\}'}
// ^^error{Format string contains 65536 placeholders, but only 0 extra arguments were given}
// ^error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
// ^^error{Format string contains 65536 placeholders, but only 0 extra arguments were given}
property <string> t12: @tr("foo{45}bar", 44);
// ^error{Format string contains 46 placeholders, but only 1 extra arguments were given}
// ^error{Format string contains 46 placeholders, but only 1 extra arguments were given}
property <string> t13: @tr("foo{0}ba{}r", 44, 42);
// ^error{Cannot mix positional and non-positional placeholder in format string}
// ^error{Cannot mix positional and non-positional placeholder in format string}
property <string> t14: @tr("foo{}ba{1}r", 44, 42);
// ^error{Cannot mix positional and non-positional placeholder in format string}
// ^error{Cannot mix positional and non-positional placeholder in format string}
property <string> t15: @tr("fooba🥸{3}🥸r", 44, 42, 45);
// ^error{Format string contains 4 placeholders, but only 3 extra arguments were given}
// ^error{Format string contains 4 placeholders, but only 3 extra arguments were given}
property <string> t16: @tr("foo{} {}ba{}r", 44, 42);
// ^error{Format string contains 3 placeholders, but only 2 extra arguments were given}
// ^error{Format string contains 3 placeholders, but only 2 extra arguments were given}
property <string> t17: @tr("fo{}o}r", 44, 42);
// ^error{Unescaped '\}' in format string. Escape '\}' with '\}\}'}
// ^error{Unescaped '}' in format string. Escape '}' with '}}'}
property <string> ctx: @tr("foo" => "fo{}or{}", 42px);
// ^error{Cannot convert length to string. Divide by 1px to convert to a plain number}
// ^^error{Format string contains 2 placeholders, but only 1 extra arguments were given}
// ^error{Format string contains 2 placeholders, but only 1 extra arguments were given}
// ^^error{Cannot convert length to string. Divide by 1px to convert to a plain number}
}

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
global MyType := {
// ^warning{':=' to declare a global is deprecated. Remove the ':='}
property <int> aaa;
property <int> aaa;
// ^error{Cannot override property 'aaa'}
@ -21,17 +22,18 @@ global MyType := {
// ^error{A global component cannot have sub elements}
for x in mod : Text { }
// ^error{A global component cannot have sub elements}
// ^^error{Builtin function must be called}
// ^^error{Builtin function must be called. Did you forgot the '()'?}
aaa <=> bbb;
property <int> eee <=> aaa;
qqq: 42;
// ^error{Unknown property qqq}
// ^error{Unknown property qqq in }
}
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
MyType {
// ^error{Cannot create an instance of a global component}
ccc: "hello";

View file

@ -2,8 +2,10 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
struct Struct := { def: int, }
// ^warning{':=' to declare a struct is deprecated. Remove the ':='}
export SuperSimple := Rectangle {
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
DoesNotExist {
// ^error{Unknown element 'DoesNotExist'}
}
@ -48,9 +50,9 @@ export SuperSimple := Rectangle {
}
NativeLineEdit { }
// ^error{Unknown element 'NativeLineEdit'. \(The type exists as an internal type, but cannot be accessed in this scope\)}
// ^error{Unknown element 'NativeLineEdit'. (The type exists as an internal type, but cannot be accessed in this scope)}
Opacity { }
// ^error{Unknown element 'Opacity'. \(The type exists as an internal type, but cannot be accessed in this scope\)}
// ^error{Unknown element 'Opacity'. (The type exists as an internal type, but cannot be accessed in this scope)}
}