Warning, /sdk/cutehmi/extensions/CuteHMI.2/tests/tst_Messenger.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.12
0002 import QtQuick.Controls 2.5
0003 import QtTest 1.2
0004 
0005 import CuteHMI 2.0 as CuteHMI
0006 
0007 Item {
0008         id: root
0009 
0010         width: 320
0011         height: 200
0012 
0013         Dialog {
0014                 id: dialog
0015 
0016                 width: 320
0017                 height: 200
0018                 visible: true
0019                 title: "Dialog"
0020 
0021                 function createDialog(message) {
0022                         if (message) {
0023                                 switch (message.type) {
0024                                         case CuteHMI.Message.NOTE:
0025                                                 title = "Note"
0026                                                 break
0027                                         case CuteHMI.Message.WARNING:
0028                                                 title = "Warning"
0029                                                 break
0030                                         case CuteHMI.Message.QUESTION:
0031                                                 title = "Question"
0032                                                 break
0033                                         case CuteHMI.Message.CRITICAL:
0034                                                 title = "Critical"
0035                                                 break
0036                                         default:
0037                                                 title = "Unrecognized dialog type (" + message.type + ")."
0038                                 }
0039 
0040                                 text.text = message.text
0041                                 informativeText.text = message.informativeText
0042                                 detailedText.text = message.detailedText
0043                                 standardButtons = message.buttons
0044                         }
0045                 }
0046 
0047                 Column {
0048                         Text { id: text }
0049 
0050                         Text { id: informativeText }
0051 
0052                         Text { id: detailedText }
0053                 }
0054         }
0055 
0056         TestCase {
0057                 name: "Messenger"
0058                 when: windowShown
0059 
0060                 function initTestCase() {
0061                         messenger.resetAdvertiser(dialog)
0062                 }
0063 
0064                 function test_advertise() {
0065                         var message = Qt.createQmlObject('
0066                                 import CuteHMI 2.0
0067 
0068                                 Message {
0069                                         type: Message.QUESTION
0070                                         text: "Text?"
0071                                         informativeText: "Informative text."
0072                                         detailedText: "Detailed text."
0073                                         buttons: { Message.BUTTON_YES | Message.BUTTON_NO }
0074                                 }', root);
0075 
0076                         messenger.advertise(message)
0077                         waitForRendering(root)
0078 
0079                         verify(dialog.standardButton(Dialog.Yes))
0080                         verify(dialog.standardButton(Dialog.No))
0081                 }
0082         }
0083 }
0084 
0085 //(c)C: Copyright © 2019-2020, Michał Policht <michal@policht.pl>. All rights reserved.
0086 //(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
0087 //(c)C: This file is a part of CuteHMI.
0088 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
0089 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
0090 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI.  If not, see <https://www.gnu.org/licenses/>.
0091 //(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
0092 //(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
0093 //(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
0094 //(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.