~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-zesty-2202

« back to all changes in this revision

Viewing changes to tests/qmltests/Menus/tst_StandardMenu.qml

  • Committer: Bileto Bot
  • Date: 2016-10-24 11:32:00 UTC
  • mfrom: (146.3.110 slots-layout)
  • Revision ID: ci-train-bot@canonical.com-20161024113200-85dvkl9m1o0msi5i
* Menus: rewrite components using ListItemLayout's and SlotsLayout's
* Bump revision to 0.10, as per Components removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2016 Canonical Ltd.
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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/>.
 
15
 *
 
16
 * Authored by Marco Trevisan <marco.trevisan@canonical.com>
 
17
 */
 
18
 
 
19
import QtQuick 2.4
 
20
import QtTest 1.0
 
21
import Ubuntu.Test 0.1
 
22
import Ubuntu.Settings.Menus 0.1
 
23
 
 
24
Item {
 
25
    width: units.gu(42)
 
26
    height: units.gu(75)
 
27
 
 
28
    Column {
 
29
        anchors.fill: parent
 
30
 
 
31
        StandardMenu {
 
32
            id: standardMenu
 
33
            text: "Label"
 
34
        }
 
35
 
 
36
        StandardMenu {
 
37
            id: iconMenu
 
38
            text: "Icon Menu"
 
39
            iconName: "view-fullscreen"
 
40
        }
 
41
 
 
42
        StandardMenu {
 
43
            id: emptyMenu
 
44
        }
 
45
    }
 
46
 
 
47
    UbuntuTestCase {
 
48
        name: "StandardMenu"
 
49
        when: windowShown
 
50
 
 
51
        function test_iconInvisible() {
 
52
            var menuIcon = findChild(standardMenu, "standardMenuIcon")
 
53
            verify(menuIcon !== undefined)
 
54
            compare(menuIcon.visible, false)
 
55
        }
 
56
 
 
57
        function test_iconVisible() {
 
58
            var menuIcon = findChild(iconMenu, "standardMenuIcon")
 
59
            verify(menuIcon !== undefined)
 
60
            compare(menuIcon.visible, true)
 
61
        }
 
62
 
 
63
        function test_iconVisibilityChanges() {
 
64
            var menuIcon = findChild(emptyMenu, "standardMenuIcon")
 
65
            verify(menuIcon !== undefined)
 
66
            compare(menuIcon.visible, false)
 
67
 
 
68
            emptyMenu.iconName = "close"
 
69
            compare(menuIcon.visible, true)
 
70
 
 
71
            emptyMenu.iconName = ""
 
72
            compare(menuIcon.visible, false)
 
73
 
 
74
            emptyMenu.iconSource = "image://theme/tick"
 
75
            compare(menuIcon.visible, true)
 
76
 
 
77
            emptyMenu.iconSource = ""
 
78
            compare(menuIcon.visible, false)
 
79
        }
 
80
    }
 
81
}