2
* This file is part of system-settings
4
* Copyright (C) 2016 Canonical Ltd.
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 3, as published
8
* by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranties of
12
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13
* PURPOSE. See the GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program. If not, see <http://www.gnu.org/licenses/>.
21
import Ubuntu.Components 1.3
22
import Ubuntu.SystemSettings.Notifications 1.0
24
import NotificationsSource 1.0
26
ClickAppNotifications {
33
name: "ClickAppNotifications"
37
function clickItem(item, button) {
38
waitForRendering(item)
39
if (button === undefined) button = Qt.LeftButton
40
mouseClick(item, button)
41
waitForRendering(item)
45
root.enableNotifications = true
47
root.soundsNotify = true
48
root.vibrationsNotify = true
49
root.bubblesNotify = true
50
root.listNotify = true
53
function test_verify_enabled_when_top_enabled() {
54
var enableSwitch = findChild(root, "enableNotificationsSwitch")
56
var soundsChecked = findChild(root, "soundsChecked")
57
var vibrationsChecked = findChild(root, "vibrationsChecked")
58
var bubblesChecked = findChild(root, "bubblesChecked")
59
var listChecked = findChild(root, "listChecked")
61
verify(enableSwitch.checked)
63
verify(soundsChecked.enabled)
64
verify(vibrationsChecked.enabled)
65
verify(bubblesChecked.enabled)
66
verify(listChecked.enabled)
69
function test_verify_disabled_when_top_disabled() {
70
var enableSwitch = findChild(root, "enableNotificationsSwitch")
72
var soundsChecked = findChild(root, "soundsChecked")
73
var vibrationsChecked = findChild(root, "vibrationsChecked")
74
var bubblesChecked = findChild(root, "bubblesChecked")
75
var listChecked = findChild(root, "listChecked")
77
verify(enableSwitch.checked)
78
clickItem(enableSwitch)
79
tryCompare(enableSwitch, "checked", false)
81
verify(!soundsChecked.enabled)
82
verify(!vibrationsChecked.enabled)
83
verify(!bubblesChecked.enabled)
84
verify(!listChecked.enabled)
87
function test_verify_unchecking_all_will_disable_top() {
88
var enableSwitch = findChild(root, "enableNotificationsSwitch")
90
var soundsChecked = findChild(root, "soundsChecked")
91
var vibrationsChecked = findChild(root, "vibrationsChecked")
92
var bubblesChecked = findChild(root, "bubblesChecked")
93
var listChecked = findChild(root, "listChecked")
95
verify(enableSwitch.checked)
97
verify(soundsChecked.checked)
98
clickItem(soundsChecked)
99
tryCompare(soundsChecked, "checked", false)
101
verify(vibrationsChecked.checked)
102
clickItem(vibrationsChecked)
103
tryCompare(vibrationsChecked, "checked", false)
105
verify(bubblesChecked.checked)
106
clickItem(bubblesChecked)
107
tryCompare(bubblesChecked, "checked", false)
109
verify(listChecked.checked)
110
clickItem(listChecked)
111
tryCompare(listChecked, "checked", false)
113
tryCompare(enableSwitch, "checked", false)