~ci-train-bot/unity8/unity8-ubuntu-zesty-2167

« back to all changes in this revision

Viewing changes to tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
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.
 
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 General Public License for more details.
 
12
 *
 
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/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import QtTest 1.0
 
19
import "../.."
 
20
import "../../../../Panel/Menus"
 
21
import Ubuntu.Components 0.1
 
22
import Unity.Test 0.1 as UT
 
23
 
 
24
Item {
 
25
    id: testIndicatorMenuWindowItem
 
26
    width: units.gu(9)
 
27
    height: units.gu(3)
 
28
 
 
29
    MouseArea {
 
30
        id: mouseArea
 
31
        anchors.fill: parent
 
32
    }
 
33
 
 
34
    IndicatorMenuWindow {
 
35
        id: indicatorMenuWindow
 
36
        name: "TestIndicatorMenuWindow"
 
37
        anchors.fill: parent
 
38
    }
 
39
 
 
40
    UT.UnityTestCase {
 
41
        name: "IndicatorMenuWindow"
 
42
        when: windowShown
 
43
 
 
44
        function test_mouseEvent_data() {
 
45
            return [
 
46
                {tag: "visible", shown: true, opacity: 1.0, mouseClicks: 0},
 
47
                {tag: "invisible", shown: false, opacity: 0.0, mouseClicks: 1},
 
48
            ]
 
49
        }
 
50
 
 
51
        function test_mouseEvent(data) {
 
52
            indicatorMenuWindow.shown = data.shown
 
53
            tryCompare(indicatorMenuWindow, "opacity", data.opacity)
 
54
 
 
55
            clickedSpy.clear()
 
56
            mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2,
 
57
                       indicatorMenuWindow.height / 2)
 
58
            compare(clickedSpy.count, data.mouseClicks,
 
59
                  "Check for Mouse event eating by indicatorMenuWindow failed")
 
60
        }
 
61
    }
 
62
 
 
63
    SignalSpy {
 
64
        id: clickedSpy
 
65
        target: mouseArea
 
66
        signalName: "clicked"
 
67
    }
 
68
}