~saviq/unity/8.run-device-delete

« back to all changes in this revision

Viewing changes to tests/qmltests/Components/tst_OpenEffect.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 "../../../Components"
 
20
 
 
21
TestCase {
 
22
    name: "OpenEffectTest"
 
23
 
 
24
    function test_openeffect_enabled() {
 
25
        compare(openEffect1.enabled, true, "OpenEffect should be enabled if gap is greather than 0.0")
 
26
    }
 
27
 
 
28
    function test_openeffect_shadereffectsource() {
 
29
        compare(openEffect1.source.hideSource, true, "OpenEffect ShaderEffectSource is incorrect")
 
30
        compare(openEffect1.source.sourceItem, rectangle2, "OpenEffect ShaderEffectSource is incorrect")
 
31
        compare(openEffect1.source.live, true, "OpenEffect ShaderEffectSource is incorrect")
 
32
        compare(openEffect1.source.sourceRect.x, 0, "OpenEffect ShaderEffectSource is incorrect")
 
33
        compare(openEffect1.source.sourceRect.y, 0, "OpenEffect ShaderEffectSource is incorrect")
 
34
        compare(openEffect1.source.sourceRect.width, 50, "OpenEffect ShaderEffectSource is incorrect")
 
35
        compare(openEffect1.source.sourceRect.height, 71, "OpenEffect ShaderEffectSource is incorrect")
 
36
        openEffect1.gap=2.0
 
37
        compare(openEffect1.source.sourceRect.x, 0, "OpenEffect ShaderEffectSource is incorrect")
 
38
        compare(openEffect1.source.sourceRect.y, 0, "OpenEffect ShaderEffectSource is incorrect")
 
39
        compare(openEffect1.source.sourceRect.width, 50, "OpenEffect ShaderEffectSource is incorrect")
 
40
        compare(openEffect1.source.sourceRect.height, 72, "OpenEffect ShaderEffectSource is incorrect")
 
41
    }
 
42
 
 
43
    Rectangle {
 
44
        id: rectangle1
 
45
 
 
46
        width: 100; height: 100
 
47
 
 
48
        Rectangle {
 
49
            id: rectangle2
 
50
            width: 50; height: 50
 
51
        }
 
52
 
 
53
        OpenEffect {
 
54
            id: openEffect1
 
55
            anchors {
 
56
                fill: parent
 
57
            }
 
58
 
 
59
            property real gap: 1.0
 
60
 
 
61
            topGapPx: (1 - gap) * positionPx
 
62
            topOpacity: (1 - gap * 1.2)
 
63
            bottomGapPx: positionPx + gap * 10
 
64
            bottomOverflow: 20 + gap
 
65
            bottomOpacity: 1 - (gap * 0.8)
 
66
 
 
67
            positionPx: gap
 
68
            sourceItem: rectangle2
 
69
        }
 
70
    }
 
71
}