2
* Copyright 2016 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by Marco Trevisan <marco.trevisan@canonical.com>
21
import Ubuntu.Test 0.1
22
import Ubuntu.Settings.Components 0.1
39
id: activatedSignalSpy
41
signalName: "activated"
45
name: "ActionTextField"
48
property QtObject replyText
49
property QtObject sendButton
52
replyText = findChild(actionField, "replyText");
53
verify(replyText !== undefined)
55
sendButton = findChild(actionField, "sendButton");
56
verify(sendButton !== undefined)
60
activatedSignalSpy.clear()
63
function test_replyText() {
64
actionField.text = "FoooBar"
65
compare(replyText.text, "FoooBar")
68
function test_replyTextLosesFocusOnDisabled() {
69
mouseClick(replyText, replyText.width/2, replyText.height/2)
70
compare(replyText.focus, true)
72
replyText.enabled = false
73
compare(replyText.focus, false)
76
function test_buttonText() {
77
actionField.buttonText = "BarBar"
78
compare(sendButton.text, "BarBar")
81
function test_buttonState() {
82
actionField.activateEnabled = false
83
actionField.text = "Send me"
84
compare(sendButton.enabled, false)
86
actionField.activateEnabled = true
87
compare(sendButton.enabled, true)
90
compare(sendButton.enabled, false)
92
actionField.text = "Enable again"
93
compare(sendButton.enabled, true)
96
function test_buttonClickActivatesTextArea() {
97
actionField.activateEnabled = true
98
mouseClick(sendButton, sendButton.width/2, sendButton.height/2)
99
compare(activatedSignalSpy.count, 1)
100
compare(activatedSignalSpy.signalArguments[0][0], replyText.text)