~artmello/ubuntu-system-settings/ubuntu-system-settings-notifications_remove_list_check

« back to all changes in this revision

Viewing changes to tests/plugins/notifications/tst_ClickAppNotifications.qml

Implement extended Notifications panel using Gsettings to store notifications settings for each app

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of system-settings
 
3
 *
 
4
 * Copyright (C) 2016 Canonical Ltd.
 
5
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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/>.
 
17
 */
 
18
 
 
19
import QtQuick 2.4
 
20
import QtTest 1.0
 
21
import Ubuntu.Components 1.3
 
22
import Ubuntu.SystemSettings.Notifications 1.0 
 
23
 
 
24
import NotificationsSource 1.0
 
25
 
 
26
ClickAppNotifications {
 
27
    id: root
 
28
 
 
29
    width: 300
 
30
    height: 500
 
31
 
 
32
    TestCase {
 
33
        name: "ClickAppNotifications"
 
34
        when: windowShown
 
35
 
 
36
        /*
 
37
        function clickItem(item, button) {
 
38
            waitForRendering(item)
 
39
            if (button === undefined) button = Qt.LeftButton
 
40
            mouseClick(item, button)
 
41
            waitForRendering(item)
 
42
        }
 
43
 
 
44
        function init() {
 
45
            root.enableNotifications = true
 
46
 
 
47
            root.soundsNotify = true
 
48
            root.vibrationsNotify = true
 
49
            root.bubblesNotify = true
 
50
            root.listNotify = true
 
51
        }
 
52
 
 
53
        function test_verify_enabled_when_top_enabled() {
 
54
            var enableSwitch = findChild(root, "enableNotificationsSwitch")
 
55
 
 
56
            var soundsChecked = findChild(root, "soundsChecked")
 
57
            var vibrationsChecked = findChild(root, "vibrationsChecked")
 
58
            var bubblesChecked = findChild(root, "bubblesChecked")
 
59
            var listChecked = findChild(root, "listChecked")
 
60
 
 
61
            verify(enableSwitch.checked)
 
62
 
 
63
            verify(soundsChecked.enabled)
 
64
            verify(vibrationsChecked.enabled)
 
65
            verify(bubblesChecked.enabled)
 
66
            verify(listChecked.enabled)
 
67
        }
 
68
 
 
69
        function test_verify_disabled_when_top_disabled() {
 
70
            var enableSwitch = findChild(root, "enableNotificationsSwitch")
 
71
 
 
72
            var soundsChecked = findChild(root, "soundsChecked")
 
73
            var vibrationsChecked = findChild(root, "vibrationsChecked")
 
74
            var bubblesChecked = findChild(root, "bubblesChecked")
 
75
            var listChecked = findChild(root, "listChecked")
 
76
 
 
77
            verify(enableSwitch.checked)
 
78
            clickItem(enableSwitch)
 
79
            tryCompare(enableSwitch, "checked", false)
 
80
 
 
81
            verify(!soundsChecked.enabled)
 
82
            verify(!vibrationsChecked.enabled)
 
83
            verify(!bubblesChecked.enabled)
 
84
            verify(!listChecked.enabled)
 
85
        }
 
86
 
 
87
        function test_verify_unchecking_all_will_disable_top() {
 
88
            var enableSwitch = findChild(root, "enableNotificationsSwitch")
 
89
 
 
90
            var soundsChecked = findChild(root, "soundsChecked")
 
91
            var vibrationsChecked = findChild(root, "vibrationsChecked")
 
92
            var bubblesChecked = findChild(root, "bubblesChecked")
 
93
            var listChecked = findChild(root, "listChecked")
 
94
 
 
95
            verify(enableSwitch.checked)
 
96
 
 
97
            verify(soundsChecked.checked)
 
98
            clickItem(soundsChecked)
 
99
            tryCompare(soundsChecked, "checked", false)
 
100
 
 
101
            verify(vibrationsChecked.checked)
 
102
            clickItem(vibrationsChecked)
 
103
            tryCompare(vibrationsChecked, "checked", false)
 
104
 
 
105
            verify(bubblesChecked.checked)
 
106
            clickItem(bubblesChecked)
 
107
            tryCompare(bubblesChecked, "checked", false)
 
108
 
 
109
            verify(listChecked.checked)
 
110
            clickItem(listChecked)
 
111
            tryCompare(listChecked, "checked", false)
 
112
 
 
113
            tryCompare(enableSwitch, "checked", false)
 
114
        }
 
115
        */
 
116
    }
 
117
}