on xenial help sign in
OpenEffect is not used anywhere either
f3b7d29Albert Astals
qml/Components/OpenEffect.qmldeleted−138
@@ -1,138 +0,0 @@
1−/*
2− * Copyright (C) 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−
19−Item {
20− id: effect
21− property bool enabled: topGapPx != positionPx || bottomGapPx != positionPx
22− property alias live: effectSource.live
23− property Item sourceItem
24− property ShaderEffectSource source: ShaderEffectSource {
25− id: effectSource
26− sourceItem: effect.enabled ? effect.sourceItem : null
27− hideSource: effect.enabled
28− live: false
29− sourceRect: {
30− if (effect.enabled) {
31− Qt.rect(0, -effect.topOverflow, sourceItem.width, sourceItem.height + effect.topOverflow + effect.bottomOverflow)
32− } else {
33− Qt.rect(0, 0, 0, 0)
34− }
35− }
36− }
37−
38− onEnabledChanged: if (!live && enabled) scheduleUpdate()
39−
40− /*!
41− \qmlproperty real positionPx
42− The y coordinate of where to perform the split.
43−
44− \qmlproperty real topGapPx
45− Gap's top edge.
46−
47− \qmlproperty real bottomGapPx
48− Gap's bottom edge.
49−
50− \qmlproperty real topOverflow
51− How much of the sourceItem should be sourced above its bounds.
52−
53− \qmlproperty real bottomOverflow
54− How much of the sourceItem should be sourced below its bounds.
55− */
56−
57− property real positionPx: 0
58− property real topGapPx: 0
59− property real bottomGapPx: height
60− property real topOverflow: 0.0
61− property real bottomOverflow: 0.0
62− property real topOpacity: 1.0
63− property real bottomOpacity: 1.0
64−
65− property real __roundedPositionPx: Math.round(positionPx)
66−
67− function scheduleUpdate() {
68− source.scheduleUpdate();
69− }
70−
71− ShaderEffect {
72− id: top
73− visible: effect.enabled
74− opacity: topOpacity
75− property ShaderEffectSource source: effect.source
76− property real positionPx: __roundedPositionPx
77− property real factor: effect.height / height
78−
79− clip: true
80−
81− anchors {
82− top: parent.top
83− left: parent.left
84− right: parent.right
85− topMargin: -topOverflow - positionPx + topGapPx
86− }
87− height: topOverflow + positionPx
88−
89− vertexShader: "
90− uniform highp mat4 qt_Matrix;
91− attribute highp vec4 qt_Vertex;
92− attribute highp vec2 qt_MultiTexCoord0;
93− varying highp vec2 qt_TexCoord0;
94− uniform highp float factor;
95−
96− void main() {
97− highp vec4 pos = qt_Vertex;
98− pos.y *= factor;
99− gl_Position = qt_Matrix * pos;
100− qt_TexCoord0 = qt_MultiTexCoord0;
101− }
102− "
103− }
104−
105− ShaderEffect {
106− id: bottom
107− visible: effect.enabled
108− opacity: bottomOpacity
109− property ShaderEffectSource source: effect.source
110− property real offset: effect.topOverflow + __roundedPositionPx
111− property real factor: effect.height / height
112−
113− clip: true
114−
115− anchors {
116− left: parent.left
117− right: parent.right
118− }
119− y: topOverflow + bottomGapPx
120− height: sourceItem.height - positionPx + bottomOverflow
121−
122− vertexShader: "
123− uniform highp mat4 qt_Matrix;
124− attribute highp vec4 qt_Vertex;
125− attribute highp vec2 qt_MultiTexCoord0;
126− varying highp vec2 qt_TexCoord0;
127− uniform highp float factor;
128− uniform highp float offset;
129−
130− void main() {
131− highp vec4 pos = qt_Vertex;
132− pos.y = (pos.y * factor) - offset;
133− gl_Position = qt_Matrix * pos;
134− qt_TexCoord0 = qt_MultiTexCoord0;
135− }
136− "
137− }
138−}
tests/qmltests/CMakeLists.txt−1
@@ -13,7 +13,6 @@ set(qmltest_DEFAULT_NO_ADD_TEST FALSE)
13set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
13set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
14add_qml_test(Components AnimationControllerWithSignals)
14add_qml_test(Components AnimationControllerWithSignals)
15add_qml_test(Components Carousel)
15add_qml_test(Components Carousel)
16−add_qml_test(Components OpenEffect)
17add_qml_test(Components RatingStars)
16add_qml_test(Components RatingStars)
18add_qml_test(Panel IndicatorItem)
17add_qml_test(Panel IndicatorItem)
19add_qml_test(utils/Unity/Test UnityTest)
18add_qml_test(utils/Unity/Test UnityTest)
tests/qmltests/Components/tst_OpenEffect.qmldeleted−71
@@ -1,71 +0,0 @@
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 "../../../qml/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, false, "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−}