slint/internal/compiler/tests/syntax/expressions/math-macro.slint
2024-05-08 19:04:22 +02:00

44 lines
No EOL
1.5 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.2 OR LicenseRef-Slint-commercial
export component Foo {
property <float> m1: mod(4);
// ^error{Needs 2 arguments}
property <float> m2: mod(4, 5, 5);
// ^error{Needs 2 arguments}
property <float> m3: mod("455", "465");
// ^error{Cannot convert string to float}
// ^^error{Cannot convert string to float}
property <float> m4: mod(455, "465");
// ^error{Cannot convert string to float}
property <length> m5: mod(45px, 4);
// ^error{Cannot convert float to length}
property <length> m6: mod(45px, 4ms);
// ^error{Cannot convert duration to length}
property <duration> m7: mod(5, 4ms);
// ^error{Cannot convert float to duration}
property <float> a1: abs();
// ^error{Needs 1 argument}
property <float> a2: abs(4, 5, 5);
// ^error{Needs 1 argument}
property <float> a3: abs(1, 2);
// ^error{Needs 1 argument}
property <float> a4: abs("465");
// ^error{Cannot convert string to float}
property <string> a5: abs(45px);
// ^error{Cannot convert length to string}
}