slint/sixtyfps_compiler/tests/syntax/basic/dialog.60
Simon Hausmann d3dfd43bdc Tweak dialog error messages
Replace "should" with "must"/"can only" to emphasize that this is an error.
2021-09-30 11:27:50 +02:00

51 lines
1.5 KiB
Text

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
import { StandardButton } from "sixtyfps_widgets.60";
MyDiag1 := Dialog {
Rectangle {}
StandardButton { kind: cancel; }
Rectangle {}
// ^error{A Dialog can have only one child element that is not a StandardButton}
}
MyDiag2 := Dialog {
StandardButton { kind: reset; }
StandardButton {
kind: cancel;
col: 42;
// ^error{col used outside of a GridLayout}
rowspan: 2;
// ^error{rowspan used outside of a GridLayout}
}
}
MyDiag3 := Dialog {
Rectangle { }
StandardButton { kind: ok; }
StandardButton { }
// ^error{The `kind` property of the StandardButton in a Dialog must be set}
StandardButton { kind: true ? ok : cancel; }
// ^error{The `kind` property of the StandardButton in a Dialog must be known at compile-time}
StandardButton { kind: ok; }
// ^error{Duplicated `kind`: There are two StandardButton in this Dialog with the same kind}
}
Test := Rectangle {
MyDiag1 {}
MyDiag2 {} // FIXME: not the best place for the error
// ^error{A Dialog must have a single child element that is not StandardButton}
MyDiag3 {}
}