diff options
author | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-12-27 13:06:36 +0200 |
---|---|---|
committer | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-12-27 13:06:36 +0200 |
commit | a9baa55456aff95e7797dbe1f9b19d2afb5034e1 (patch) | |
tree | 0ba8d0f606b632231796bd8f65b4c6d02d591d16 /tests/manual | |
download | qtgraphicaleffects-a9baa55456aff95e7797dbe1f9b19d2afb5034e1.tar.gz |
Initial commit
Diffstat (limited to 'tests/manual')
77 files changed, 5524 insertions, 0 deletions
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro new file mode 100644 index 0000000..0e7e6e4 --- /dev/null +++ b/tests/manual/manual.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +OTHER_FILES = testbed/*.qml +#SUBDIRS += testbed + diff --git a/tests/manual/testbed/BGColorPicker.qml b/tests/manual/testbed/BGColorPicker.qml new file mode 100644 index 0000000..176d9e7 --- /dev/null +++ b/tests/manual/testbed/BGColorPicker.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Label { + id: bgColorPicker + property string color: "#242424" + caption: "Background color" + Image { + id: highlight + source: "images/color_selection_hl.png" + width: 18; height: 18; + x: 37 + y: 0 + } + + Row { + y: 3 + spacing: 8 + Rectangle { width: 12; height: 12; color: "#ffffff" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Rectangle { width: 12; height: 12; color: "#ababab" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Rectangle { width: 12; height: 12; color: "#242424" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Rectangle { width: 12; height: 12; color: "#000000" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Image {source: "images/background.png" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.source + highlight.x = parent.x - 3 + } + } + } + } +} diff --git a/tests/manual/testbed/CheckBox.qml b/tests/manual/testbed/CheckBox.qml new file mode 100644 index 0000000..15ef837 --- /dev/null +++ b/tests/manual/testbed/CheckBox.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: checkBox + property string caption: "" + property bool selected: true + property bool pressed: mouse.pressed + anchors {left: parent.left; right: parent.right} + height: 20 + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: checkBox.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Image { + id: button + anchors {left: captionText.right; leftMargin: 5; verticalCenter: parent.verticalCenter} + source: "images/checkbox_outer.png" + smooth: true + Image { + id: buttonFill + anchors.centerIn: parent + source: "images/checkbox_inner.png" + smooth: true + visible: checkBox.selected + } + } + + MouseArea { + id: mouse + anchors.fill: parent + anchors.rightMargin: 160 + onClicked: checkBox.selected = !checkBox.selected + preventStealing: true + } +} diff --git a/tests/manual/testbed/ColorPicker.qml b/tests/manual/testbed/ColorPicker.qml new file mode 100755 index 0000000..1683771 --- /dev/null +++ b/tests/manual/testbed/ColorPicker.qml @@ -0,0 +1,273 @@ +/***************************************************************************** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Add-On Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** +** You may use this file under the terms of the BSD license as follows: +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE. +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: root + property color color: Qt.hsla(hue, saturation, lightness, alpha) + + property alias hue: hueSlider.value + property alias saturation: saturationSlider.value + property alias lightness: lightnessSlider.value + property alias alpha: alphaSlider.value + + width: parent.width + height: 100 + + Image { + anchors.fill: map + source: "images/background.png" + fillMode: Image.Tile + } + + Rectangle { + id: colorBox + anchors.fill: map + color: root.color + } + + ShaderEffect { + id: map + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + width: 68 + height: width + property real hue: root.hue + opacity: 0.01 + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform highp float hue; + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l, l, l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 c = vec4(1.0); + //c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s)); + c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.y, 0.5 * qt_TexCoord0.x * (qt_TexCoord0.y + 1.0))); + gl_FragColor = c * qt_Opacity; + } + " + + MouseArea { + id: mapMouseArea + anchors.fill: parent + hoverEnabled: true + onPositionChanged: { + if (pressed) { + var xx = Math.max(0, Math.min(mouse.x, parent.width)) + var yy = Math.max(0, Math.min(mouse.y, parent.height)) + crosshair.x = xx - crosshair.width / 2 + crosshair.y = yy - crosshair.height / 2 + root.saturation = 1.0 - yy / parent.height + root.lightness = 0.5 * xx / parent.width * (yy / parent.height + 1.0) + } + } + onEntered: map.opacity = 1 + onReleased: { + if (mouse.x < 0 || mouse.x > parent.width || mouse.y < 0 || mouse.y > parent.height) { + map.opacity = 0.01; + } + } + onPressed: positionChanged(mouse) + onExited: { + if (!pressed) { + map.opacity = 0.01; + } + } + } + + Image { + id: crosshair + source: "images/slider_handle.png" + x: root.lightness * parent.width - width / 2 + y: (1.0 - root.saturation) * parent.height - height / 2 + } + + Behavior on opacity { PropertyAnimation { duration: 100 } } + } + + + Column { + anchors.left: parent.left + anchors.right: parent.right + + ColorSlider { + id: hueSlider + minimum: 0.0 + maximum: 1.0 + value: 0.5 + caption: "H" + trackItem: Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop {position: 0.000; color: Qt.rgba(1, 0, 0, 1)} + GradientStop {position: 0.167; color: Qt.rgba(1, 1, 0, 1)} + GradientStop {position: 0.333; color: Qt.rgba(0, 1, 0, 1)} + GradientStop {position: 0.500; color: Qt.rgba(0, 1, 1, 1)} + GradientStop {position: 0.667; color: Qt.rgba(0, 0, 1, 1)} + GradientStop {position: 0.833; color: Qt.rgba(1, 0, 1, 1)} + GradientStop {position: 1.000; color: Qt.rgba(1, 0, 0, 1)} + } + } + } + + ColorSlider { + id: saturationSlider + minimum: 0.0 + maximum: 1.0 + value: 1.0 + caption: "S" + handleOpacity: 1.5 - map.opacity + trackItem: Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop { position: 0; color: Qt.hsla(root.hue, 0.0, root.lightness, 1.0) } + GradientStop { position: 1; color: Qt.hsla(root.hue, 1.0, root.lightness, 1.0) } + } + } + } + + ColorSlider { + id: lightnessSlider + minimum: 0.0 + maximum: 1.0 + value: 0.5 + caption: "L" + handleOpacity: 1.5 - map.opacity + trackItem: Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop { position: 0; color: 'black' } + GradientStop { position: 0.5; color: Qt.hsla(root.hue, root.saturation, 0.5, 1.0) } + GradientStop { position: 1; color: 'white' } + } + } + } + + ColorSlider { + id: alphaSlider + minimum: 0.0 + maximum: 1.0 + value: 1.0 + caption: "A" + trackItem:Item { + anchors.fill: parent + Image { + anchors {fill: parent; leftMargin: 5; rightMargin: 5} + source: "images/background.png" + fillMode: Image.TileHorizontally + } + Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop { position: 0; color: "transparent" } + GradientStop { position: 1; color: Qt.hsla(root.hue, root.saturation, root.lightness, 1.0) } + } + } + } + } + + Label { + caption: "ARGB" + text: "#" + ((Math.ceil(root.alpha * 255) + 256).toString(16).substr(1, 2) + root.color.toString().substr(1, 6)).toUpperCase(); + } + } +} diff --git a/tests/manual/testbed/ColorSlider.qml b/tests/manual/testbed/ColorSlider.qml new file mode 100755 index 0000000..54a902f --- /dev/null +++ b/tests/manual/testbed/ColorSlider.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: colorSlider + + property real value: 1 + property real maximum: 1 + property real minimum: 0 + property string caption: "" + property bool pressed: mouseArea.pressed + property bool integer: false + property string handleSource: "images/slider_handle.png" + property real handleOpacity: 1.0 + property alias trackItem: track.children + + width: parent.width + height: 20 + + function updatePos() { + if (maximum > minimum) { + var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5; + return Math.min(Math.max(pos, 5), track.width - 5) - 10; + } else { + return 5; + } + } + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: colorSlider.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueCaption + anchors.left: captionText.right + anchors.verticalCenter: parent.verticalCenter + width: 35 + horizontalAlignment: Text.AlignRight + text: colorSlider.value.toFixed(1) + font.family: "Arial" + font.pixelSize: 11 + color: "#999999" + } + + Item { + id: track + height: 4 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: parent.width / 2 + anchors.right: parent.right + anchors.rightMargin: 10 + + Image { + id: handle; + anchors.verticalCenter: parent.verticalCenter + smooth: true + source: mouseArea.pressed ? 'images/slider_handle_pressed.png' : colorSlider.handleSource + opacity: colorSlider.handleOpacity + x: updatePos() + z: 1 + } + + MouseArea { + id: mouseArea + anchors {left: parent.left; right: parent.right; leftMargin: 5; rightMargin: 5; verticalCenter: parent.verticalCenter} + height: 8 + + onPressed: { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = colorSlider.integer ? Math.round(realValue) : realValue; + } + + onPositionChanged: { + if (pressed) { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = colorSlider.integer ? Math.round(realValue) : realValue; + } + } + } + } +} diff --git a/tests/manual/testbed/Control.qml b/tests/manual/testbed/Control.qml new file mode 100644 index 0000000..76a1dfd --- /dev/null +++ b/tests/manual/testbed/Control.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: control + property string caption: "" + default property alias children: controlsColumn.children + property bool last: false + + property bool __hide: caption == "advanced" + + anchors {left: parent.left; right: parent.right} + height: __hide ? 30 : controlsColumn.height + 40 + + Behavior on height { + NumberAnimation { duration: 100 } + } + + Image { + source: "images/group_top.png" + anchors {top: parent.top; left: parent.left; right: parent.right} + } + + Image { + source: "images/group_bottom.png" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + smooth: true + visible: !last || __hide + } + + Text { + id: sectionText + anchors {left: parent.left; top: parent.top; leftMargin: 11; topMargin: 8} + color: "white" + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + text: caption + } + + Image { + anchors {right: parent.right; rightMargin: 5; top: parent.top} + source: __hide ? "images/expand.png" : "images/collapse.png" + } + + MouseArea { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: 30 + onClicked: control.__hide = !control.__hide + } + + Column { + id: controlsColumn + anchors.top: parent.top + anchors.topMargin: 30 + anchors.left: parent.left + anchors.right: parent.right + opacity: !__hide + Behavior on opacity { + NumberAnimation { duration: 100 } + } + } +} diff --git a/tests/manual/testbed/ImageSource.qml b/tests/manual/testbed/ImageSource.qml new file mode 100644 index 0000000..5ad02d3 --- /dev/null +++ b/tests/manual/testbed/ImageSource.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Image { + id: is + source: "images/bug.jpg" + smooth: true + visible: sourceType.value == "shaderEffectSource" + anchors.fill: parent + fillMode: Image.PreserveAspectFit + sourceSize: width > height ? Qt.size(0, parent.height) : Qt.size(parent.width, 0) + + property bool forcedUpdateAnimationRunning: false + Rectangle { + x: is.width - 10 - width + y: 10 + width: 25 + height: 25 + visible: is.forcedUpdateAnimationRunning + color: "#229933" + NumberAnimation on rotation { + id: dd + running: is.forcedUpdateAnimationRunning + loops: Animation.Infinite + duration: 5000 + from: 0.0 + to: 360.0 + } + } +} diff --git a/tests/manual/testbed/Label.qml b/tests/manual/testbed/Label.qml new file mode 100644 index 0000000..2bad339 --- /dev/null +++ b/tests/manual/testbed/Label.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: label + property string caption: "" + property string text: "" + default property alias children: childrenItem.children + anchors {left: parent.left; right: parent.right} + height: Math.max(20, childrenItem.height) + + Text { + id: captionText + width: 110 + height: 20 + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + text: label.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueText + anchors {left: captionText.right; right: parent.right; leftMargin: 11; verticalCenter: parent.verticalCenter} + height: 20 + verticalAlignment: Text.AlignVCenter + text: label.text + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + visible: label.text.length > 0 + } + + Item { + id: childrenItem + anchors {left: captionText.right; leftMargin: 11; right: parent.right} + height: childrenRect.height + } +} diff --git a/tests/manual/testbed/PositionPicker.qml b/tests/manual/testbed/PositionPicker.qml new file mode 100755 index 0000000..522a690 --- /dev/null +++ b/tests/manual/testbed/PositionPicker.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Image { + id: positionPicker + property real xValue: 0 + property real yValue: 0 + + x: xValue - positionPicker.width / 2 + y: yValue - positionPicker.height / 2 + + property alias pressed: mouseArea.pressed + + source: pressed ? "images/slider_handle_pressed.png" : "images/slider_handle.png" + + MouseArea { + id: mouseArea + + property real startX + property real startY + + anchors.fill: parent + onPressed: { + startX = mouseX; + startY = mouseY; + } + + onPositionChanged: { + xValue = positionPicker.x + positionPicker.width / 2 + mouseX - startX; + yValue = positionPicker.y + positionPicker.height / 2 + mouseY - startY; + + positionPicker.x += mouseX - startX; + positionPicker.y += mouseY - startY; + } + } +} diff --git a/tests/manual/testbed/ProgressBar.qml b/tests/manual/testbed/ProgressBar.qml new file mode 100644 index 0000000..cd77a0a --- /dev/null +++ b/tests/manual/testbed/ProgressBar.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: slider + + property real value: 1 + property real maximum: 1 + property real minimum: 0 + property string caption: "" + property bool integer: false + + width: parent.width + height: 20 + + function updatePos() { + if (maximum > minimum) { + var pos = (track.width) * (value - minimum) / (maximum - minimum); + return Math.min(Math.max(pos, 0), track.width); + } else { + return 0; + } + } + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: slider.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueCaption + anchors.left: captionText.right + anchors.verticalCenter: parent.verticalCenter + width: 35 + horizontalAlignment: Text.AlignRight + text: slider.value.toFixed(1) + font.family: "Arial" + font.pixelSize: 11 + color: "#999999" + } + + Item { + id: track + height: parent.height + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: parent.width / 2 + anchors.right: parent.right + anchors.rightMargin: 10 + + BorderImage { + source: "images/slider_track.png" + anchors.left: parent.left + anchors.right: parent.right + border.right: 2 + } + + BorderImage { + id: trackFilled + anchors.left: parent.left + width: updatePos() + source: "images/slider_track_filled.png" + border.left: 3 + border.right: 3 + } + } +} diff --git a/tests/manual/testbed/RadioButton.qml b/tests/manual/testbed/RadioButton.qml new file mode 100644 index 0000000..7732093 --- /dev/null +++ b/tests/manual/testbed/RadioButton.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: radioButton + property string caption: "" + property bool selected: false + property bool pressed: mouse.pressed + anchors {left: parent.left; right: parent.right} + height: 20 + + Text { + id: captionText + anchors {left: parent.horizontalCenter; leftMargin: -5; right: parent.right; verticalCenter: parent.verticalCenter} + horizontalAlignment: Text.AlignLeft + text: radioButton.caption + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Image { + id: button + anchors {right: captionText.left; rightMargin: 10; verticalCenter: parent.verticalCenter} + source: "images/radiobutton_outer.png" + smooth: true + Image { + id: buttonFill + anchors.centerIn: parent + source: "images/radiobutton_inner.png" + smooth: true + visible: radioButton.selected + } + } + + MouseArea { + id: mouse + anchors.fill: parent + anchors.leftMargin: 115 + preventStealing: true + } +} diff --git a/tests/manual/testbed/RadioButtonColumn.qml b/tests/manual/testbed/RadioButtonColumn.qml new file mode 100644 index 0000000..4deff71 --- /dev/null +++ b/tests/manual/testbed/RadioButtonColumn.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: radioButtoncolumn + property string value: "" + property string prefixCaption: "" + default property alias children: buttons.children + property string caption: "" + + width: parent.width + height: buttons.height + + Text { + id: captionText + anchors {top: parent.top; topMargin: 4} + width: 110 + horizontalAlignment: Text.AlignRight + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + text: radioButtoncolumn.caption + ':' + } + + Column { + id: buttons + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + } +} diff --git a/tests/manual/testbed/RgbaColorPicker.qml b/tests/manual/testbed/RgbaColorPicker.qml new file mode 100644 index 0000000..c93a180 --- /dev/null +++ b/tests/manual/testbed/RgbaColorPicker.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rgbaSlider + property alias rValue: rSlider.value + property alias gValue: gSlider.value + property alias bValue: bSlider.value + property alias aValue: aSlider.value + property bool pressed: rSlider.pressed || gSlider.pressed || bSlider.pressed || aSlider.pressed + + width: parent.width + height: childrenRect.height + + function dec2hex(i) + { + if (i <= 15) + return "0" + i.toString(16); + else + return i.toString(16); + } + + Rectangle { + id: colorRect + width: 50; height: 50 + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.verticalCenter: sliders.verticalCenter + color: Qt.rgba(rgbaSlider.rValue, rgbaSlider.gValue, rgbaSlider.bValue, rgbaSlider.aValue) + } + Column { + id: sliders + anchors {left: parent.left; right: parent.right} + Slider { + id: aSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'A' + } + Slider { + id: rSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'R' + } + Slider { + id: gSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'G' + } + Slider { + id: bSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'B' + } + + } +// Text { +// anchors.top: colorRect.bottom +// anchors.topMargin: 5 +// anchors.horizontalCenter: colorRect.horizontalCenter +// horizontalAlignment: Text.AlignHCenter +// text: "#" + dec2hex(Math.round(rgbaSlider.aValue * 255)) + dec2hex(Math.round(rgbaSlider.rValue * 255)) + dec2hex(Math.round(rgbaSlider.gValue * 255)) + dec2hex(Math.round(rgbaSlider.bValue * 255)) +// font.capitalization: Font.AllUppercase +// color: "#999999" +// font.pixelSize: 11 +// } +} diff --git a/tests/manual/testbed/Slider.qml b/tests/manual/testbed/Slider.qml new file mode 100755 index 0000000..9def5be --- /dev/null +++ b/tests/manual/testbed/Slider.qml @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: slider + + property real value: 1 + property real maximum: 1 + property real minimum: 0 + property string caption: "" + property bool pressed: mouseArea.pressed + property bool integer: false + property string handleSource: "images/slider_handle.png" + + width: parent.width + height: 20 + + function updatePos() { + if (maximum > minimum) { + var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5; + return Math.min(Math.max(pos, 5), track.width - 5) - 10; + } else { + return 5; + } + } + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: slider.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueCaption + anchors.left: captionText.right + anchors.verticalCenter: parent.verticalCenter + width: 35 + horizontalAlignment: Text.AlignRight + text: slider.value.toFixed(1) + font.family: "Arial" + font.pixelSize: 11 + color: "#999999" + } + + Item { + id: track + height: parent.height + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: parent.width / 2 + anchors.right: parent.right + anchors.rightMargin: 10 + + BorderImage { + source: "images/slider_track.png" + anchors.left: parent.left + anchors.right: parent.right + border.right: 2 + } + + BorderImage { + id: trackFilled + anchors.left: minimum == -maximum ? (value < 0 ? handle.horizontalCenter : parent.horizontalCenter) : parent.left + anchors.right: minimum == -maximum && value < 0 ? parent.horizontalCenter : handle.horizontalCenter + source: "images/slider_track_filled.png" + border.left: 3 + border.right: 3 + } + + Image { + id: handle; + smooth: true + source: mouseArea.pressed ? 'images/slider_handle_pressed.png' : slider.handleSource + x: updatePos() + } + + MouseArea { + id: mouseArea + anchors {left: parent.left; right: parent.right; leftMargin: 5; rightMargin: 5; verticalCenter: parent.verticalCenter} + height: 4 + + onPressed: { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = slider.integer ? Math.round(realValue) : realValue; + } + + onPositionChanged: { + if (pressed) { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = slider.integer ? Math.round(realValue) : realValue; + } + } + } + } +} diff --git a/tests/manual/testbed/TestBedModel.qml b/tests/manual/testbed/TestBedModel.qml new file mode 100644 index 0000000..a98e94d --- /dev/null +++ b/tests/manual/testbed/TestBedModel.qml @@ -0,0 +1,67 @@ +/***************************************************************************** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Add-On Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** +** You may use this file under the terms of the BSD license as follows: +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE. +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ + +import QtQuick 2.0 + +ListModel { + id: testcaseModel + ListElement { name: "TestBlend.qml"; group: "Blend"; last: true } + ListElement { name: "TestDisplace.qml"; group: "Distortion"; last: true } + ListElement { name: "TestOpacityMask.qml"; group: "Mask" } + ListElement { name: "TestThresholdMask.qml"; group: "Mask"; last: true } + ListElement { name: "TestFastGlow.qml"; group: "Glow" } + ListElement { name: "TestGlow.qml"; group: "Glow" } + ListElement { name: "TestRectangularGlow.qml"; group: "Glow"; last: true } + ListElement { name: "TestFastBlur.qml"; group: "Blur" } + ListElement { name: "TestGaussianBlur.qml"; group: "Blur" } + ListElement { name: "TestRecursiveBlur.qml"; group: "Blur"; last: true } + ListElement { name: "TestDirectionalBlur.qml"; group: "Motion Blur"; } + ListElement { name: "TestRadialBlur.qml"; group: "Motion Blur"; } + ListElement { name: "TestZoomBlur.qml"; group: "Motion Blur"; last: true } + ListElement { name: "TestFastDropShadow.qml"; group: "Drop Shadow" } + ListElement { name: "TestDropShadow.qml"; group: "Drop Shadow"; last: true } + ListElement { name: "TestLinearGradient.qml"; group: "Gradient" } + ListElement { name: "TestConicalGradient.qml"; group: "Gradient" } + ListElement { name: "TestRadialGradient.qml"; group: "Gradient"; last: true } + ListElement { name: "TestColorize.qml"; group: "Color" } + ListElement { name: "TestColorOverlay.qml"; group: "Color" } + ListElement { name: "TestHueSaturation.qml"; group: "Color" } + ListElement { name: "TestBrightnessContrast.qml"; group: "Color" } + ListElement { name: "TestDesaturate.qml"; group: "Color" } + ListElement { name: "TestGammaAdjust.qml"; group: "Color"; last: true } +} diff --git a/tests/manual/testbed/TestBlend.qml b/tests/manual/testbed/TestBlend.qml new file mode 100644 index 0000000..0c9caf1 --- /dev/null +++ b/tests/manual/testbed/TestBlend.qml @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource1 + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ImageSource { + id: imageSource2 + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource1 + sourceItem: imageSource1 + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + ShaderEffectSource { + id: shaderEffectSource2 + sourceItem: imageSource2 + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + Blend { + id: effect + anchors.fill: imageSource1 + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + backgroundSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource1 : imageSource1 + foregroundSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource2 : imageSource2 + mode: blendMode.value + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + + RadioButtonColumn { + id: blendMode + value: "normal" + caption: "mode" + RadioButton { + caption: "normal" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "addition" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "darken" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "difference" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "divide" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "multiply" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "lighten" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "screen" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "subtract" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestBrightnessContrast.qml b/tests/manual/testbed/TestBrightnessContrast.qml new file mode 100644 index 0000000..dd57f5a --- /dev/null +++ b/tests/manual/testbed/TestBrightnessContrast.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + onLiveChanged: scheduleUpdate() + } + + BrightnessContrast { + id: effect + anchors.fill: imageSource + brightness: brigthnessSlider.value + contrast: contrastSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: brigthnessSlider + minimum: -1.0 + maximum: 1.0 + value: 0.0 + caption: "brightness" + } + Slider { + id: contrastSlider + minimum: -1.0 + maximum: 1.0 + value: 0.0 + caption: "contrast" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestCaseTemplate.qml b/tests/manual/testbed/TestCaseTemplate.qml new file mode 100644 index 0000000..109912a --- /dev/null +++ b/tests/manual/testbed/TestCaseTemplate.qml @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: main + + property real imageSize: Math.min(height, width - 220) + default property alias testItem : testItemContainer.children + property alias controls: controlsColumn.children + property string currentTest: "" + property string fps: "nan" + property string bgColor: "black" + + property int dummy: 0 + property int fpsCount: 0 + + anchors.fill: parent + color: bgColor.charAt(0) == '#' ? bgColor : "red" + + onDummyChanged: fpsCount++; + + NumberAnimation on dummy { + duration: 500 + from: 0 + to: 10000 + loops: Animation.Infinite + } + + Timer { + interval: 1000 + repeat: true + running: true + onTriggered: { + fps = "" + fpsCount; + fpsCount = 0; + } + } + + Image { + id: background + anchors.fill: parent + fillMode: Image.Tile + source: bgColor.substring(0,7) == "file://" ? bgColor : "" + } + + Item { + id: testItemContainer + property real margin: 0 + x: (parent.width - testParameterContainer.width - width) / 2 + anchors.verticalCenter: parent.verticalCenter + anchors.top: undefined + width: Math.min(parent.height - 20, parent.width - testParameterContainer.width - 20) + height: width + } + + Image { + id: titlebar + source: "images/title.png" + anchors.top: parent.top + anchors.right: parent.right + width: 300 + + Text { + id: effectsListTitle + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: currentTest + color: "white" + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + } + } + + Rectangle { + id: testParameterContainer + anchors.top: titlebar.bottom + anchors.bottom: parent.bottom + anchors.right: parent.right + width: 300 + color: "#171717" + + Flickable { + id: slidersFlickable + anchors.fill: parent + contentHeight: childrenRect.height + interactive: contentHeight > height + clip: true + + Column { + id: controlsColumn + anchors.left: parent.left + anchors.right: parent.right + } + } + } +} diff --git a/tests/manual/testbed/TestColorOverlay.qml b/tests/manual/testbed/TestColorOverlay.qml new file mode 100755 index 0000000..1fe9273 --- /dev/null +++ b/tests/manual/testbed/TestColorOverlay.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + anchors.fill: imageSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + onLiveChanged: scheduleUpdate() + } + + ColorOverlay { + id: effect + anchors.fill: imageSource + color: colorPicker.color + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + alpha: 0.5 + } + }, + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestColorize.qml b/tests/manual/testbed/TestColorize.qml new file mode 100644 index 0000000..4e5f729 --- /dev/null +++ b/tests/manual/testbed/TestColorize.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + source: "images/butterfly.png" + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + Colorize { + id: effect + anchors.fill: imageSource + hue: colorPicker.hue + saturation: colorPicker.saturation + lightness: colorPicker.lightness + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + ColorPicker { + id: colorPicker + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + } + }, + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestConicalGradient.qml b/tests/manual/testbed/TestConicalGradient.qml new file mode 100755 index 0000000..8e2794d --- /dev/null +++ b/tests/manual/testbed/TestConicalGradient.qml @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: maskImage + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: maskSource + sourceItem: maskImage + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ConicalGradient { + id: effect + anchors.fill: parent + cached: cachedCheckBox.selected + visible: enabledCheckBox.selected + maskSource: maskCheckBox.selected ? (sourceType.value == "shaderEffectSource" ? maskSource : maskImage) : undefined + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + gradient: Gradient { + GradientStop {position: 0.0; color: gradientBeginColorSlider.color} + GradientStop {position: 1.0; color: gradientEndColorSlider.color} + } + angle: startAngleSlider.value + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: startAngleSlider + caption: "angle" + minimum: -360 + maximum: 360 + value: 0 + } + CheckBox { + id: maskCheckBox + caption: "Use Mask" + } + }, + + Control { + caption: "gradient begin color" + ColorPicker { + id: gradientBeginColorSlider + hue: 340/360 + saturation: 0.9 + lightness: 0.27 + } + }, + + Control { + caption: "gradient end color" + ColorPicker { + id: gradientEndColorSlider + hue: 46/360 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDesaturate.qml b/tests/manual/testbed/TestDesaturate.qml new file mode 100644 index 0000000..1191eb6 --- /dev/null +++ b/tests/manual/testbed/TestDesaturate.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + Desaturate { + id: effect + anchors.fill: imageSource + desaturation: grayscaleSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: grayscaleSlider + minimum: 0 + maximum: 1.0 + value: 1.0 + caption: "desaturation" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDirectionalBlur.qml b/tests/manual/testbed/TestDirectionalBlur.qml new file mode 100644 index 0000000..4742deb --- /dev/null +++ b/tests/manual/testbed/TestDirectionalBlur.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + DirectionalBlur { + id: effect + anchors.fill: imageSource + transparentBorder: transparentBorderCheckBox.selected + angle: angleSlider.value + length: lengthSlider.value + samples: samplesSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: angleSlider + minimum: -180.0 + maximum: 180.0 + value: 90.0 + caption: "angle" + } + Slider { + id: lengthSlider + minimum: 0.0 + maximum: 64.0 + value: 32.0 + caption: "length" + } + Slider { + id: samplesSlider + minimum: 0 + maximum: 32 + value: 32 + caption: "samples" + integer: true + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDisplace.qml b/tests/manual/testbed/TestDisplace.qml new file mode 100644 index 0000000..d5749bd --- /dev/null +++ b/tests/manual/testbed/TestDisplace.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + ImageSource { + id: imageSource + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + Rectangle { + id: displacementMapSource + visible: !enabledCheckBox.selected + color: "#8080ff" + smooth: true + anchors.fill: parent + Image { + id: di + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + sourceSize: Qt.size(128, 128) + source: "images/displacementmap.png" + smooth: true + } + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: false + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ShaderEffectSource { id: shaderEffectNormalSource + sourceItem: displacementMapSource + live: true + hideSource: enabledCheckBox.selected + smooth: true + visible: false + } + + Displace { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + displacementSource: sourceType.value == "shaderEffectSource" ? shaderEffectNormalSource : di + displacement: displacementScaleSlider.value + smooth: true + MouseArea { + anchors.fill: parent + onClicked: { di.x = mouseX - di.width/2; di.y = mouseY - di.height/2; } + onPositionChanged: { if (pressed) { di.x = mouseX - di.width/2; di.y = mouseY - di.height/2; } } + } + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: displacementScaleSlider + caption: "displacement" + minimum: -1.0 + maximum: 1.0 + value: 0.1 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDropShadow.qml b/tests/manual/testbed/TestDropShadow.qml new file mode 100755 index 0000000..eba7403 --- /dev/null +++ b/tests/manual/testbed/TestDropShadow.qml @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + DropShadow { + id: effect + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + anchors.fill: imageSource + radius: radiusSlider.value + spread: spreadSlider.value + maximumRadius: maximumRadiusSlider.value + color: colorPicker.color + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + anchors.fill: imageSource + sourceItem: imageSource + hideSource: false + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + 10 + yValue: effect.height / 2 + 10 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: radiusSlider + minimum: 0 + maximum: 16 + value: 8 + caption: "radius" + } + Slider { + id: maximumRadiusSlider + minimum: 0 + maximum: 16 + value: 8 + integer: true + caption: "maximumRadius" + } + Slider { + id: spreadSlider + minimum: 0 + maximum: 1.0 + value: 0.0 + caption: "spread" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 0 + lightness: 0 + alpha: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + color: "#ababab" + } + } + ] +} diff --git a/tests/manual/testbed/TestFastBlur.qml b/tests/manual/testbed/TestFastBlur.qml new file mode 100644 index 0000000..16515af --- /dev/null +++ b/tests/manual/testbed/TestFastBlur.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource; + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: enabledCheckBox.selected + onLiveChanged: scheduleUpdate() + } + + FastBlur { + id: effect + anchors.fill: imageSource + blur: blurSlider.value + transparentBorder: transparentBorderCheckBox.selected + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: blurSlider + minimum: 0.0 + maximum: 1.0 + value: 0.5 + caption: "blur" + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestFastDropShadow.qml b/tests/manual/testbed/TestFastDropShadow.qml new file mode 100755 index 0000000..d7aeffd --- /dev/null +++ b/tests/manual/testbed/TestFastDropShadow.qml @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + FastDropShadow { + id: effect + anchors.fill: imageSource + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + spread: spreadSlider.value + blur: blurLevelSlider.value + color: colorPicker.color + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + anchors.fill: imageSource + sourceItem: imageSource + hideSource: false + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + 10 + yValue: effect.height / 2 + 10 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: blurLevelSlider + minimum: 0 + maximum: 1.0 + value: 0.5 + caption: "blur" + } + Slider { + id: spreadSlider + minimum: 0 + maximum: 1.0 + value: 0.0 + caption: "spread" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 0 + lightness: 0 + alpha: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + color: "#ababab" + } + } + ] +} diff --git a/tests/manual/testbed/TestFastGlow.qml b/tests/manual/testbed/TestFastGlow.qml new file mode 100644 index 0000000..02525c0 --- /dev/null +++ b/tests/manual/testbed/TestFastGlow.qml @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + FastGlow { + id: effect + anchors.fill: imageSource + color: colorPicker.color + spread: spreadSlider.value + blur: blurLevelSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: false + smooth: true + visible: true + onLiveChanged: scheduleUpdate() + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: blurLevelSlider + minimum: 0 + maximum: 1.0 + value: 0.5 + caption: "blur" + } + Slider { + id: spreadSlider + caption: "spread" + minimum: 0.0 + maximum: 1.0 + value: 0.3 + } + CheckBox { + id: transparentBorderSwitch + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestGammaAdjust.qml b/tests/manual/testbed/TestGammaAdjust.qml new file mode 100644 index 0000000..f2f6f38 --- /dev/null +++ b/tests/manual/testbed/TestGammaAdjust.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + source: "images/butterfly.png" + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + GammaAdjust { + id: effect + anchors.fill: imageSource + gamma: gammaSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: gammaSlider + minimum: 0 + maximum: 2.0 + value: 1.0 + caption: "gamma" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestGaussianBlur.qml b/tests/manual/testbed/TestGaussianBlur.qml new file mode 100755 index 0000000..287af92 --- /dev/null +++ b/tests/manual/testbed/TestGaussianBlur.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + GaussianBlur { + id: effect + anchors.fill: imageSource + radius: radiusSlider.value + maximumRadius: maximumRadiusSlider.value + deviation: deviationSlider.value + transparentBorder: transparentBorderCheckBox.selected + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: maximumRadiusSlider + minimum: 0 + maximum: 16 + value: 16 + integer: true + caption: "maximumRadius" + } + Slider { + id: radiusSlider + minimum: 0.0 + maximum: 16.0 + value: 8.0 + caption: "radius" + } + Slider { + id: deviationSlider + minimum: 0 + maximum: 16 + value: (effect.radius + 1) / 3.3333 + caption: "deviation" + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestGlow.qml b/tests/manual/testbed/TestGlow.qml new file mode 100644 index 0000000..ca6006c --- /dev/null +++ b/tests/manual/testbed/TestGlow.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + Glow { + id: effect + anchors.fill: imageSource + color: colorPicker.color + spread: spreadSlider.value + radius: radiusSlider.value + maximumRadius: maximumRadiusSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: false + smooth: true + visible: true + onLiveChanged: scheduleUpdate() + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: radiusSlider + minimum: 0.0 + maximum: 16.0 + value: 8.0 + caption: "radius" + } + Slider { + id: spreadSlider + caption: "spread" + minimum: 0.0 + maximum: 1.0 + value: 0.3 + } + Slider { + id: maximumRadiusSlider + minimum: 0 + maximum: 16 + value: 8 + integer: true + caption: "maximumRadius" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestHueSaturation.qml b/tests/manual/testbed/TestHueSaturation.qml new file mode 100644 index 0000000..e1aa569 --- /dev/null +++ b/tests/manual/testbed/TestHueSaturation.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + source: "images/butterfly.png" + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false; onLiveChanged: scheduleUpdate() + } + + HueSaturation { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + hue: colorPicker.hue + saturation: colorPicker.saturation + lightness: colorPicker.lightness + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + ColorPicker { + id: colorPicker + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestLinearGradient.qml b/tests/manual/testbed/TestLinearGradient.qml new file mode 100755 index 0000000..5b059c2 --- /dev/null +++ b/tests/manual/testbed/TestLinearGradient.qml @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: maskImage + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: maskSource + sourceItem: maskImage + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true; visible: false; onLiveChanged: scheduleUpdate() } + + LinearGradient { + id: effect + anchors.fill: parent + cached: cachedCheckBox.selected + visible: enabledCheckBox.selected + maskSource: maskCheckBox.selected ? (sourceType.value == "shaderEffectSource" ? maskSource : maskImage) : undefined + start: Qt.point(startPicker.xValue, startPicker.yValue) + end: Qt.point(endPicker.xValue, endPicker.yValue) + gradient: Gradient { + GradientStop { + position: 0.0 + color: gradientBeginColorSlider.color + } + GradientStop { + position: 1.0 + color: gradientEndColorSlider.color + } + } + } + + PositionPicker { + id: startPicker + xValue: 150 + yValue: 150 + } + PositionPicker { + id: endPicker + xValue: 300 + yValue: 450 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "startX" + text: startPicker.xValue + } + Label { + caption: "startY" + text: startPicker.yValue + } + Label { + caption: "endX" + text: endPicker.xValue + } + Label { + caption: "endY" + text: endPicker.yValue + } + CheckBox { + id: maskCheckBox + caption: "Use Mask" + } + }, + + Control { + caption: "gradient begin color" + ColorPicker { + id: gradientBeginColorSlider + hue: 340/360 + saturation: 0.9 + lightness: 0.27 + } + }, + + Control { + caption: "gradient end color" + ColorPicker { + id: gradientEndColorSlider + hue: 46/360 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestOpacityMask.qml b/tests/manual/testbed/TestOpacityMask.qml new file mode 100644 index 0000000..4708eef --- /dev/null +++ b/tests/manual/testbed/TestOpacityMask.qml @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + ImageSource { + id: maskSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: shaderEffectSource1 + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + ShaderEffectSource { + id: shaderEffectSource2 + sourceItem: maskSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + OpacityMask { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource1 : imageSource + maskSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource2 : maskSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRadialBlur.qml b/tests/manual/testbed/TestRadialBlur.qml new file mode 100644 index 0000000..6dd5eb9 --- /dev/null +++ b/tests/manual/testbed/TestRadialBlur.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + RadialBlur { + id: effect + anchors.fill: imageSource + transparentBorder: transparentBorderCheckBox.selected + angle: lengthSlider.value + samples: samplesSlider.value + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: lengthSlider + minimum: -180.0 + maximum: 180.0 + value: 15.0 + caption: "angle" + } + Slider { + id: samplesSlider + minimum: 0 + maximum: 64 + value: 32 + caption: "samples" + integer: true + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRadialGradient.qml b/tests/manual/testbed/TestRadialGradient.qml new file mode 100755 index 0000000..33c2a6d --- /dev/null +++ b/tests/manual/testbed/TestRadialGradient.qml @@ -0,0 +1,195 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: maskImage + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: maskSource + sourceItem: maskImage + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected; smooth: true; visible: false; onLiveChanged: scheduleUpdate() } + + RadialGradient { + id: effect + anchors.fill: parent + cached: cachedCheckBox.selected + visible: enabledCheckBox.selected + maskSource: maskCheckBox.selected ? (sourceType.value == "shaderEffectSource" ? maskSource : maskImage) : undefined + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + horizontalRadius: horizontalRadiusSlider.value + verticalRadius: verticalRadiusSlider.value + angle: angleSlider.value + gradient: Gradient { + GradientStop {position: 0.0; color: gradientBeginColorSlider.color} + GradientStop {position: 1.0; color: gradientEndColorSlider.color} + } + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: horizontalRadiusSlider + minimum: 0 + maximum: effect.width + value: effect.width / 2 + caption: "horizontalRadius" + } + Slider { + id: verticalRadiusSlider + minimum: 0 + maximum: effect.height + value: effect.height / 2 + caption: "verticalRadius" + } + Slider { + id: angleSlider + minimum: 0 + maximum: 360 + value: 0 + caption: "angle" + } + CheckBox { + id: maskCheckBox + caption: "Use Mask" + } + }, + + Control { + caption: "gradient begin color" + ColorPicker { + id: gradientBeginColorSlider + hue: 340/360 + saturation: 0.9 + lightness: 0.27 + } + }, + + Control { + caption: "gradient end color" + ColorPicker { + id: gradientEndColorSlider + hue: 46/360 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRectangularGlow.qml b/tests/manual/testbed/TestRectangularGlow.qml new file mode 100644 index 0000000..27e2bc1 --- /dev/null +++ b/tests/manual/testbed/TestRectangularGlow.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + RectangularGlow { + id: effect + anchors.fill: rectSource + color: colorPicker.color + spread: spreadSlider.value + glowRadius: sizeSlider.value + visible: enabledCheckBox.selected + opacity: opacitySlider.value + cornerRadius: radiusSlider.value + } + + Rectangle { + id: rectSource + visible: true + anchors.centerIn: parent + width: Math.round(parent.width / 1.5) + height: Math.round(parent.height / 2) + radius: 25 + color: "#cc4b00" + smooth: true + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: spreadSlider + caption: "spread" + minimum: 0.0 + maximum: 1.0 + value: 0.5 + } + Slider { + id: sizeSlider + minimum: 0 + maximum: rectSource.width / 2.0 + value: 10.0 + caption: "glowRadius" + onValueChanged: radiusSlider.value = Math.max(0, Math.min(radiusSlider.value, radiusSlider.maximum)) + } + Slider { + id: radiusSlider + minimum: 0 + maximum: Math.min(effect.width, effect.height) / 2 + effect.glowRadius; + caption: "cornerRadius" + value: rectSource.radius + effect.glowRadius + } + Slider { + id: opacitySlider + minimum: 0 + maximum: 1.0 + value: 1.0 + caption: "opacity" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 1 + lightness: 1 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRecursiveBlur.qml b/tests/manual/testbed/TestRecursiveBlur.qml new file mode 100644 index 0000000..56acb31 --- /dev/null +++ b/tests/manual/testbed/TestRecursiveBlur.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + ImageSource { + id: imageSource + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: true + hideSource: enabledCheckBox.selected + smooth: true + visible: false + } + + RecursiveBlur { + id: effect + loops: iterationSlider.value + anchors.fill: imageSource + radius: radiusSlider.value + transparentBorder: transparentBorderCheckBox.selected + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: iterationSlider + minimum: 0 + maximum: 500 + value: 0 + integer: true + caption: "loops" + } + Slider { + id: radiusSlider + minimum: 0.0 + maximum: 16.0 + value: 7.5 + caption: "radius" + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + ProgressBar { + id: progressSlider + minimum: 0 + maximum: 1.0 + value: effect.progress + caption: "progress" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestThresholdMask.qml b/tests/manual/testbed/TestThresholdMask.qml new file mode 100644 index 0000000..1f5c15b --- /dev/null +++ b/tests/manual/testbed/TestThresholdMask.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + ImageSource { + id: maskSource + source: "images/fog.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource1 + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ShaderEffectSource { + id: shaderEffectSource2 + sourceItem: maskSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ThresholdMask { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource1 : imageSource + maskSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource2 : maskSource + threshold: thresholdSlider.value + spread: fringeSlider.value + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: thresholdSlider + minimum: 0.0 + maximum: 1.0 + value: 0.4 + caption: "threshold" + } + Slider { + id: fringeSlider + minimum: 0.0 + maximum: 1.0 + value: 0.2 + caption: "spread" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestZoomBlur.qml b/tests/manual/testbed/TestZoomBlur.qml new file mode 100644 index 0000000..6885032 --- /dev/null +++ b/tests/manual/testbed/TestZoomBlur.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + ZoomBlur { + id: effect + anchors.fill: imageSource + transparentBorder: transparentBorderCheckBox.selected + length: lengthSlider.value + samples: samplesSlider.value + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: lengthSlider + minimum: 0.0 + maximum: 64.0 + value: 32.0 + caption: "length" + } + Slider { + id: samplesSlider + minimum: 0 + maximum: 32 + value: 32 + caption: "samples" + integer: true + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/images/background.png b/tests/manual/testbed/images/background.png Binary files differnew file mode 100644 index 0000000..458d33d --- /dev/null +++ b/tests/manual/testbed/images/background.png diff --git a/tests/manual/testbed/images/bug.jpg b/tests/manual/testbed/images/bug.jpg Binary files differnew file mode 100755 index 0000000..43e3676 --- /dev/null +++ b/tests/manual/testbed/images/bug.jpg diff --git a/tests/manual/testbed/images/butterfly.png b/tests/manual/testbed/images/butterfly.png Binary files differnew file mode 100644 index 0000000..ce544f2 --- /dev/null +++ b/tests/manual/testbed/images/butterfly.png diff --git a/tests/manual/testbed/images/checkbox_inner.png b/tests/manual/testbed/images/checkbox_inner.png Binary files differnew file mode 100644 index 0000000..52dce9c --- /dev/null +++ b/tests/manual/testbed/images/checkbox_inner.png diff --git a/tests/manual/testbed/images/checkbox_outer.png b/tests/manual/testbed/images/checkbox_outer.png Binary files differnew file mode 100644 index 0000000..6efa85f --- /dev/null +++ b/tests/manual/testbed/images/checkbox_outer.png diff --git a/tests/manual/testbed/images/checker.png b/tests/manual/testbed/images/checker.png Binary files differnew file mode 100644 index 0000000..b7f067b --- /dev/null +++ b/tests/manual/testbed/images/checker.png diff --git a/tests/manual/testbed/images/collapse.png b/tests/manual/testbed/images/collapse.png Binary files differnew file mode 100644 index 0000000..1b1259e --- /dev/null +++ b/tests/manual/testbed/images/collapse.png diff --git a/tests/manual/testbed/images/color_selection_hl.png b/tests/manual/testbed/images/color_selection_hl.png Binary files differnew file mode 100644 index 0000000..87de70b --- /dev/null +++ b/tests/manual/testbed/images/color_selection_hl.png diff --git a/tests/manual/testbed/images/displacementmap.png b/tests/manual/testbed/images/displacementmap.png Binary files differnew file mode 100755 index 0000000..7614db8 --- /dev/null +++ b/tests/manual/testbed/images/displacementmap.png diff --git a/tests/manual/testbed/images/expand.png b/tests/manual/testbed/images/expand.png Binary files differnew file mode 100644 index 0000000..49f9c15 --- /dev/null +++ b/tests/manual/testbed/images/expand.png diff --git a/tests/manual/testbed/images/fog.png b/tests/manual/testbed/images/fog.png Binary files differnew file mode 100644 index 0000000..f462222 --- /dev/null +++ b/tests/manual/testbed/images/fog.png diff --git a/tests/manual/testbed/images/group_bottom.png b/tests/manual/testbed/images/group_bottom.png Binary files differnew file mode 100644 index 0000000..08961d0 --- /dev/null +++ b/tests/manual/testbed/images/group_bottom.png diff --git a/tests/manual/testbed/images/group_top.png b/tests/manual/testbed/images/group_top.png Binary files differnew file mode 100644 index 0000000..210a57f --- /dev/null +++ b/tests/manual/testbed/images/group_top.png diff --git a/tests/manual/testbed/images/icon_blend.png b/tests/manual/testbed/images/icon_blend.png Binary files differnew file mode 100644 index 0000000..4112515 --- /dev/null +++ b/tests/manual/testbed/images/icon_blend.png diff --git a/tests/manual/testbed/images/icon_blur.png b/tests/manual/testbed/images/icon_blur.png Binary files differnew file mode 100644 index 0000000..f0c6f5e --- /dev/null +++ b/tests/manual/testbed/images/icon_blur.png diff --git a/tests/manual/testbed/images/icon_color.png b/tests/manual/testbed/images/icon_color.png Binary files differnew file mode 100644 index 0000000..649cf75 --- /dev/null +++ b/tests/manual/testbed/images/icon_color.png diff --git a/tests/manual/testbed/images/icon_distortion.png b/tests/manual/testbed/images/icon_distortion.png Binary files differnew file mode 100644 index 0000000..11bbece --- /dev/null +++ b/tests/manual/testbed/images/icon_distortion.png diff --git a/tests/manual/testbed/images/icon_drop_shadow.png b/tests/manual/testbed/images/icon_drop_shadow.png Binary files differnew file mode 100644 index 0000000..77b2f88 --- /dev/null +++ b/tests/manual/testbed/images/icon_drop_shadow.png diff --git a/tests/manual/testbed/images/icon_glow.png b/tests/manual/testbed/images/icon_glow.png Binary files differnew file mode 100644 index 0000000..019b4b5 --- /dev/null +++ b/tests/manual/testbed/images/icon_glow.png diff --git a/tests/manual/testbed/images/icon_gradient.png b/tests/manual/testbed/images/icon_gradient.png Binary files differnew file mode 100644 index 0000000..0d836b3 --- /dev/null +++ b/tests/manual/testbed/images/icon_gradient.png diff --git a/tests/manual/testbed/images/icon_mask.png b/tests/manual/testbed/images/icon_mask.png Binary files differnew file mode 100644 index 0000000..ceca052 --- /dev/null +++ b/tests/manual/testbed/images/icon_mask.png diff --git a/tests/manual/testbed/images/icon_motion_blur.png b/tests/manual/testbed/images/icon_motion_blur.png Binary files differnew file mode 100644 index 0000000..89ceb66 --- /dev/null +++ b/tests/manual/testbed/images/icon_motion_blur.png diff --git a/tests/manual/testbed/images/radiobutton_inner.png b/tests/manual/testbed/images/radiobutton_inner.png Binary files differnew file mode 100644 index 0000000..e77ccc4 --- /dev/null +++ b/tests/manual/testbed/images/radiobutton_inner.png diff --git a/tests/manual/testbed/images/radiobutton_outer.png b/tests/manual/testbed/images/radiobutton_outer.png Binary files differnew file mode 100644 index 0000000..6568c65 --- /dev/null +++ b/tests/manual/testbed/images/radiobutton_outer.png diff --git a/tests/manual/testbed/images/slider_handle.png b/tests/manual/testbed/images/slider_handle.png Binary files differnew file mode 100644 index 0000000..633bbe9 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle.png diff --git a/tests/manual/testbed/images/slider_handle_b.png b/tests/manual/testbed/images/slider_handle_b.png Binary files differnew file mode 100755 index 0000000..c7d2540 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_b.png diff --git a/tests/manual/testbed/images/slider_handle_g.png b/tests/manual/testbed/images/slider_handle_g.png Binary files differnew file mode 100755 index 0000000..86decaf --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_g.png diff --git a/tests/manual/testbed/images/slider_handle_pressed.png b/tests/manual/testbed/images/slider_handle_pressed.png Binary files differnew file mode 100644 index 0000000..10e5ed9 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_pressed.png diff --git a/tests/manual/testbed/images/slider_handle_r.png b/tests/manual/testbed/images/slider_handle_r.png Binary files differnew file mode 100755 index 0000000..1bc1614 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_r.png diff --git a/tests/manual/testbed/images/slider_track.png b/tests/manual/testbed/images/slider_track.png Binary files differnew file mode 100644 index 0000000..3ab0d21 --- /dev/null +++ b/tests/manual/testbed/images/slider_track.png diff --git a/tests/manual/testbed/images/slider_track_filled.png b/tests/manual/testbed/images/slider_track_filled.png Binary files differnew file mode 100644 index 0000000..045e6c8 --- /dev/null +++ b/tests/manual/testbed/images/slider_track_filled.png diff --git a/tests/manual/testbed/images/slider_track_left.png b/tests/manual/testbed/images/slider_track_left.png Binary files differnew file mode 100755 index 0000000..b1cc989 --- /dev/null +++ b/tests/manual/testbed/images/slider_track_left.png diff --git a/tests/manual/testbed/images/slider_track_right.png b/tests/manual/testbed/images/slider_track_right.png Binary files differnew file mode 100755 index 0000000..2936c7c --- /dev/null +++ b/tests/manual/testbed/images/slider_track_right.png diff --git a/tests/manual/testbed/images/title.png b/tests/manual/testbed/images/title.png Binary files differnew file mode 100644 index 0000000..e3110a2 --- /dev/null +++ b/tests/manual/testbed/images/title.png diff --git a/tests/manual/testbed/images/workarea_left.png b/tests/manual/testbed/images/workarea_left.png Binary files differnew file mode 100644 index 0000000..3b8bb71 --- /dev/null +++ b/tests/manual/testbed/images/workarea_left.png diff --git a/tests/manual/testbed/testBed.qml b/tests/manual/testbed/testBed.qml new file mode 100755 index 0000000..e37ffb5 --- /dev/null +++ b/tests/manual/testbed/testBed.qml @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: main + + width: 950 + height: 620 + color: '#171717' + + ListView { + id: testCaseList + width: 160 + anchors.top: titlebar.bottom + anchors.left: parent.left + anchors.bottom: parent.bottom + + model: TestBedModel {} + delegate: delegateItem + + section.property: "group" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + + } + + Image { + id: titlebar + source: "images/title.png" + anchors.top: parent.top + anchors.left: parent.left + width: 160 + + Text { + id: effectsListTitle + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "Effects" + color: "white" + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + } + } + + Loader { + id: testLoader + anchors {left: testCaseList.right; right: parent.right; top: parent.top; bottom: parent.bottom} + } + + Image { + anchors {left: testLoader.left; top: parent.top; bottom: parent.bottom} + source: "images/workarea_left.png" + } + + + Component { + id: sectionHeading + Item { + width: parent.width + height: 23 + Image { + source: "images/group_top.png" + width: parent.width + } + Image { + id: icon + source: "images/icon_" + section.replace(/ /g, "_").toLowerCase() + ".png" + anchors {top: parent.top; topMargin: 6; left: parent.left; leftMargin: 6} + } + Text { + id: sectionText + text: section + anchors {fill: parent; leftMargin: 25; topMargin: 3} + color: "white" + verticalAlignment: Text.AlignVCenter + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + } + } + } + + Component { + id: delegateItem + Item { + width: ListView.view.width + height: last ? 27 : 20 + + Image { + source: "images/group_bottom.png" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + smooth: true + visible: last && index != 20 ? 1 : 0 + } + Rectangle { + width: parent.width + color: "#3D3D3D" + height: 20 + visible: delegateMouseArea.pressed + } + Text { + id: delegateText; + anchors {fill: parent; leftMargin: 25; topMargin: 3} + text: name.slice(4, name.indexOf(".")) + font.family: "Arial" + font.pixelSize: 12 + color: "#CCCCCC" + } + MouseArea { + id: delegateMouseArea + anchors.fill: parent; + onClicked: { +// main.state = "testRunning"; + testLoader.source = name; + testLoader.item.currentTest = delegateText.text; + } + } + } + } + +// states: [ +// State { +// name: "testRunning" +// PropertyChanges { target: testCaseList } +// } +// ] +} diff --git a/tests/manual/testbed/testbed.qmlproject b/tests/manual/testbed/testbed.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/tests/manual/testbed/testbed.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} |