@@ -0,0 +1,98 @@
2+ * Copyright 2014 Canonical Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU 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 General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+import Ubuntu.Components 1.1
20+import "../../../../qml/Dash/ScopeSettings"
21+import Unity.Test 0.1 as UT
28+ property var settingData: {
29+ "displayName" : "Mock number setting",
35+ widgetData: settingData
42+ signalName: "updated"
47+ name: "ScopeSettingNumberTest"
50+ property var control: findChild(scopeSetting, "control")
51+ property real newNumber: 11.7
55+ control.focus = false;
56+ control.text = settingData.value;
59+ function test_updated_on_unfocus() {
60+ mouseClick(control, control.width / 2, control.height / 2);
63+ control.insert(0, newNumber);
64+ control.focus = false;
66+ verify(spy.signalArguments[0][0] == newNumber);
69+ function test_updated_on_accepted() {
70+ mouseClick(control, control.width / 2, control.height / 2);
73+ control.insert(0, newNumber);
76+ verify(spy.signalArguments[0][0] == newNumber);
79+ function test_selection_on_listitem_click() {
80+ mouseClick(scopeSetting, 0, scopeSetting.height / 2);
81+ compare(control.focus, true);
82+ // we're checking that selectAll() is being called by omitting it here
84+ control.insert(0, newNumber);
85+ verify(control.displayText == newNumber);
88+ function test_unacceptableInput() {
89+ mouseClick(control, control.width / 2, control.height / 2);
92+ control.insert(0, "not valid");
94+ compare(spy.count, 0);
95+ compare(control.displayText, "");