mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-14 16:45:27 +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
35 lines
2.5 KiB
Text
35 lines
2.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 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);
|
|
// ^error{Angle expression must be an angle followed by a comma}
|
|
property<brush> g3: @linear-gradient(0deg, blue, red);
|
|
property<brush> g4: @linear-gradient(45deg, blue 45%, red red);
|
|
// ^error{Cannot convert color to float}
|
|
property<brush> g5: @linear-gradient(128deg, blue 45%, red);
|
|
property<brush> g6: @linear-gradient(90deg, blue 45%, red 88%);
|
|
property<brush> g7: @linear-gradient(90deg, 42 45%, red 0.3);
|
|
// ^error{Cannot convert float to color}
|
|
property<brush> g8: @linear-gradient(90deg, blue red green);
|
|
// ^error{Cannot convert color to float}
|
|
// ^^error{Expected comma}
|
|
property<brush> g9: @linear-gradient(0deg blue, blue, red);
|
|
// ^error{Angle expression must be an angle followed by a comma}
|
|
property<brush> g10: @linear-gradient(90deg, blue 10% red 20%, yellow);
|
|
// ^error{Expected comma}
|
|
property<brush> g11: @linear-gradient(20deg,);
|
|
property<brush> g12: @linear-gradient(2, blue 45%, red 88%);
|
|
// ^error{Cannot convert float to angle. Use an unit, or multiply by 1deg to convert explicitly}
|
|
property<brush> g13: @linear-gradient(90deg + 0.5turn, true ? blue : red 45%, red 88% + 0.1);
|
|
|
|
property<brush> g14: @linear-gradient(-128deg, white, blue r);
|
|
// ^error{Unknown unqualified identifier 'r'}
|
|
property <brush> g15: @linear-gradient(90deg, brown o, green); // #3241
|
|
// ^error{Unknown unqualified identifier 'o'}
|
|
property<color> g16: @linear-gradient(0deg, red, green, blue); // #6819
|
|
// ^warning{Narrowing conversion from brush to color. This can lead to unexpected behavior because the brush is a gradient}
|
|
}
|