slint/internal/compiler/tests/syntax/layout/min_max_conflict.slint
Olivier Goffart 2ea482da49 Compiler: Change a new error from 1.9 to a warning
To keep compatibility with existing Slint code

Commit 53e79000a4 added a call to
LayoutConstraints::new which is shown to produce error in the crater
run.
2024-12-06 23:04:26 +01:00

45 lines
1.3 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 Test inherits Rectangle {
GridLayout {
Rectangle {
height: 42px;
// ^error{Cannot specify both 'height' and 'min-height'}
min-height: 42px;
max-width: 42px;
}
Rectangle {
width: 42px;
// ^error{Cannot specify both 'width' and 'max-width'}
min-height: 42px;
max-width: 42px;
}
}
// outside a layout
Rectangle {
width: 42px;
// ^error{Cannot specify both 'width' and 'min-width'}
min-width: 5rem;
}
Rectangle {
// Slint 1.8 and earlier did not complain about extra specifications when the item is not in a layout
// contains a layout that's why it's a warning instead now
height: 10rem;
// ^warning{Cannot specify both 'height' and 'min-height'}
min-height: 8rem;
HorizontalLayout {
Rectangle {
height: 42px;
// ^error{Cannot specify both 'height' and 'max-height'}
max-height: 12px;
}
}
}
}