diff options
author | Thiago Marcos P. Santos <thiago.santos@nokia.com> | 2011-02-16 15:50:31 +0100 |
---|---|---|
committer | Jens Bache-Wiig <jens.bache-wiig@nokia.com> | 2011-02-16 15:50:31 +0100 |
commit | 6451f4e594cd8c41b7cadb109a25fb75d7e2fd7a (patch) | |
tree | 97c08fa8e5a57b2156fb16785ea74f71d61c4af7 /tests | |
parent | dc192054c757e6f977b01a733f5230e9582dc541 (diff) | |
download | qtquickcontrols-6451f4e594cd8c41b7cadb109a25fb75d7e2fd7a.tar.gz |
Added CheckBox tests
Merge-request: 282
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/SpecCheckBox.qml | 62 | ||||
-rw-r--r-- | tests/auto/tst_CheckBox.qml | 70 |
2 files changed, 132 insertions, 0 deletions
diff --git a/tests/auto/SpecCheckBox.qml b/tests/auto/SpecCheckBox.qml new file mode 100644 index 00000000..bf1acd50 --- /dev/null +++ b/tests/auto/SpecCheckBox.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Components API Conformance Test Suite. +** +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions contained +** in the Technology Preview License Agreement accompanying this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +****************************************************************************/ + +import QtQuick 1.0 +import "../../components" + +QtObject { + property Component raw: + Component { + CheckBox { + } + } + + property Component api: + Component { + QtObject { + property bool checked + property bool pressed + + signal clicked + } + } + + property Component defaults: + Component { + CheckBox { + checked: false + pressed: false + } + } + + property Component basic: + Component { + CheckBox { + width: 200 + height: 200 + } + } +} diff --git a/tests/auto/tst_CheckBox.qml b/tests/auto/tst_CheckBox.qml new file mode 100644 index 00000000..626e26b2 --- /dev/null +++ b/tests/auto/tst_CheckBox.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Components API Conformance Test Suite. +** +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions contained +** in the Technology Preview License Agreement accompanying this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +****************************************************************************/ + +import QtQuick 1.0 +import QtQuickTest 1.0 + +ComponentTestCase { + name: "CheckBox" + + SpecCheckBox { + id: testSubject + } + + SignalSpy { + id: spy + signalName: "clicked" + } + + function test_clicked() { + spy.target = obj; + + var message = + "Clicking on the Checkbox must emit the signal clicked()."; + mouseClick(obj, obj.width / 2, obj.height / 2); + mouseClick(obj, obj.width / 2, obj.height / 2); + mouseClick(obj, obj.width / 2, obj.height / 2); + compare(spy.count, 3, message); + } + + function test_checked() { + var message = + "Clicking on the Checkbox should change the checked value."; + mouseClick(obj, obj.width / 2, obj.height / 2); + compare(obj.checked, true, message); + mouseClick(obj, obj.width / 2, obj.height / 2); + compare(obj.checked, false, message); + } + + function test_pressed() { + var message = + "Pressing and releasing the mouse must change pressed property."; + mousePress(obj, obj.width / 2, obj.height / 2); + compare(obj.pressed, true, message); + mouseRelease(obj, obj.width / 2, obj.height / 2); + compare(obj.pressed, false, message); + } +} |