diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-16 16:25:06 +0100 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-16 16:25:06 +0100 |
commit | 1d333d3375874efb8d37df37dc5ef561573794ad (patch) | |
tree | 2d8c995f64c05c84c1fcceb2c5cb40fcae69855f /tests/manual | |
parent | b106d86c433706928b0b0c206a0d9f831681e1bf (diff) | |
parent | e79a2658cde899d6ee11ec3c0d0a3768eb2c864b (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I0c5b939c70bdb91ccdf7068784308416dcaa5736
Diffstat (limited to 'tests/manual')
104 files changed, 742 insertions, 2091 deletions
diff --git a/tests/manual/listview/listview.pro b/tests/manual/listview/listview.pro new file mode 100644 index 0000000000..a517b75079 --- /dev/null +++ b/tests/manual/listview/listview.pro @@ -0,0 +1,29 @@ +QT += quick +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Refer to the documentation for the +# deprecated API to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp + +RESOURCES += qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/tests/manual/listview/main.cpp b/tests/manual/listview/main.cpp new file mode 100644 index 0000000000..8b28b91ee8 --- /dev/null +++ b/tests/manual/listview/main.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QAbstractTableModel> + +typedef QPair<QString, bool> CellData; + +class TestModel : public QAbstractListModel +{ + Q_OBJECT + Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged) + +public: + TestModel(QObject *parent = nullptr) : QAbstractListModel(parent) { } + + int rowCount(const QModelIndex & = QModelIndex()) const override { return m_rows; } + void setRowCount(int count) { + m_rows = count; + emit rowCountChanged(); + } + + QVariant data(const QModelIndex &index, int role) const override + { + if (!index.isValid()) + return QVariant(); + + switch (role) { + case Qt::DisplayRole: + return index.row() % 2 ? QStringLiteral("type2") : QStringLiteral("type1"); + default: + break; + } + + return QVariant(); + } + + QHash<int, QByteArray> roleNames() const override + { + return { + {Qt::DisplayRole, "delegateType"}, + }; + } + +signals: + void rowCountChanged(); + +private: + int m_rows = 0; +}; + +#include "main.moc" + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + + qmlRegisterType<TestModel>("TestModel", 0, 1, "TestModel"); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + return app.exec(); +} diff --git a/tests/manual/listview/main.qml b/tests/manual/listview/main.qml new file mode 100644 index 0000000000..723e10ac05 --- /dev/null +++ b/tests/manual/listview/main.qml @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.15 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.5 +import Qt.labs.qmlmodels 1.0 +import TestModel 0.1 + +Window { + id: root + visible: true + width: 640 + height: 480 + + property int rows: 500 + property int columns: 20 + property real delegateHeight: 10 + property real delegateWidth: 50 + + CheckBox { + id: reuseItemsBox + text: "Reuse items" + checked: true + } + + Rectangle { + anchors.fill: parent + anchors.margins: 10 + anchors.topMargin: reuseItemsBox.height + 10 + color: "lightgray" + + ListView { + id: listView + anchors.fill: parent + + reuseItems: reuseItemsBox.checked + + cacheBuffer: 0 + contentWidth: columns * delegateWidth + contentHeight: rows * delegateHeight + flickableDirection: Flickable.HorizontalAndVerticalFlick + clip: true + + model: TestModel { + rowCount: root.rows + } + + ScrollBar.vertical: ScrollBar { policy: ScrollBar.AlwaysOn } + ScrollBar.horizontal: ScrollBar { policy: ScrollBar.AlwaysOn } + + delegate: DelegateChooser { + role: "delegateType" + + DelegateChoice { + roleValue: "type1" + + Item { + width: listView.contentWidth + height: delegateHeight + property int reusedCount: 0 + + ListView.onReused: reusedCount++ + + Text { + id: text1 + text: "Reused count:" + reusedCount + font.pixelSize: 9 + } + + Row { + id: choice1 + width: listView.contentWidth + height: delegateHeight + anchors.left: text1.right + anchors.leftMargin: 5 + property color color: Qt.rgba(0.6, 0.6, 0.8, 1) + + Component.onCompleted: { + for (var i = 0; i < columns; ++i) + cellComponent.createObject(choice1, {column: i, color: color}) + } + } + } + } + + DelegateChoice { + roleValue: "type2" + + Item { + width: listView.contentWidth + height: delegateHeight + property int reusedCount: 0 + + ListView.onReused: reusedCount++ + + Text { + id: text2 + text: "Reused count:" + reusedCount + font.pixelSize: 9 + } + + Row { + id: choice2 + width: listView.contentWidth + height: delegateHeight + anchors.left: text2.right + anchors.leftMargin: 5 + property color color: Qt.rgba(0.3, 0.3, 0.8, 1) + + Component.onCompleted: { + for (var i = 0; i < columns; ++i) + cellComponent.createObject(choice2, {column: i, color: color}) + } + } + } + } + } + + } + } + + Component { + id: cellComponent + Rectangle { + height: delegateHeight + width: delegateWidth + property int column + Text { + text: "Lorem ipsum dolor sit amet" + font.pixelSize: 9 + } + } + } +} diff --git a/tests/manual/listview/qml.qrc b/tests/manual/listview/qml.qrc new file mode 100644 index 0000000000..5f6483ac33 --- /dev/null +++ b/tests/manual/listview/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + </qresource> +</RCC> diff --git a/tests/manual/nodetypes/Animators.qml b/tests/manual/nodetypes/Animators.qml deleted file mode 100644 index c582106c5d..0000000000 --- a/tests/manual/nodetypes/Animators.qml +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.5 - -Item { - id: window - - Rectangle { - anchors.fill: parent - gradient: Gradient { - GradientStop { position: 0.0; color: "#14148c" } - GradientStop { position: 0.499; color: "#14aaff" } - GradientStop { position: 0.5; color: "#80c342" } - GradientStop { position: 1.0; color: "#006325" } - } - } - - SequentialAnimation { - id: plainAnim - SequentialAnimation { - ParallelAnimation { - PropertyAnimation { - property: "y" - target: smiley - from: smiley.minHeight - to: smiley.maxHeight - easing.type: Easing.OutExpo - duration: 300 - } - PropertyAnimation { - property: "scale" - target: shadow - from: 1 - to: 0.5 - easing.type: Easing.OutExpo - duration: 300 - } - } - ParallelAnimation { - PropertyAnimation { - property: "y" - target: smiley - from: smiley.maxHeight - to: smiley.minHeight - easing.type: Easing.OutBounce - duration: 1000 - } - PropertyAnimation { - property: "scale" - target: shadow - from: 0.5 - to: 1 - easing.type: Easing.OutBounce - duration: 1000 - } - } - } - running: false - } - - SequentialAnimation { - id: renderThreadAnim - SequentialAnimation { - ParallelAnimation { - YAnimator { - target: smiley - from: smiley.minHeight - to: smiley.maxHeight - easing.type: Easing.OutExpo - duration: 300 - } - ScaleAnimator { - target: shadow - from: 1 - to: 0.5 - easing.type: Easing.OutExpo - duration: 300 - } - } - ParallelAnimation { - YAnimator { - target: smiley - from: smiley.maxHeight - to: smiley.minHeight - easing.type: Easing.OutBounce - duration: 1000 - } - ScaleAnimator { - target: shadow - from: 0.5 - to: 1 - easing.type: Easing.OutBounce - duration: 1000 - } - } - } - running: false - } - - Image { - id: shadow - anchors.horizontalCenter: parent.horizontalCenter - y: smiley.minHeight + smiley.height - source: "qrc:/shadow.png" - } - - Image { - id: smiley - property int maxHeight: window.height / 3 - property int minHeight: 2 * window.height / 3 - - anchors.horizontalCenter: parent.horizontalCenter - y: minHeight - source: "qrc:/face-smile.png" - } - - Text { - text: "click left for plain animation, right for render thread Animators, middle to sleep for 2 sec on the main (gui) thread" - color: "white" - } - - Text { - text: plainAnim.running ? "NORMAL ANIMATION" : (renderThreadAnim.running ? "RENDER THREAD ANIMATION" : "NO ANIMATION") - color: "red" - font.pointSize: 20 - anchors.bottom: parent.bottom - } - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onClicked: if (mouse.button === Qt.LeftButton) { - renderThreadAnim.running = false; - plainAnim.running = true; - } else if (mouse.button === Qt.RightButton) { - plainAnim.running = false; - renderThreadAnim.running = true; - } else if (mouse.button === Qt.MiddleButton) { - helper.sleep(2000); - } - } -} diff --git a/tests/manual/nodetypes/Effects.qml b/tests/manual/nodetypes/Effects.qml deleted file mode 100644 index 90a30c40d3..0000000000 --- a/tests/manual/nodetypes/Effects.qml +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -// Use QtQuick 2.8 to get GraphicsInfo and the other new properties -import QtQuick 2.8 - -Item { - Rectangle { - color: "gray" - anchors.margins: 10 - anchors.fill: parent - Image { - id: image1 - source: "qrc:/qt.png" - } - ShaderEffectSource { - id: effectSource1 - sourceItem: image1 - hideSource: true - } - ShaderEffect { // wobble - id: eff - width: image1.width - height: image1.height - anchors.centerIn: parent - - property variant source: effectSource1 - property real amplitude: 0.04 * 0.2 - property real frequency: 20 - property real time: 0 - - NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } - - property bool customVertexShader: false // the effect is fine with the default vs, but toggle this to test - property bool useHLSLSourceString: false // toggle to provide HLSL shaders as strings instead of bytecode in files - - property string glslVertexShader: - "uniform highp mat4 qt_Matrix;" + - "attribute highp vec4 qt_Vertex;" + - "attribute highp vec2 qt_MultiTexCoord0;" + - "varying highp vec2 qt_TexCoord0;" + - "void main() {" + - " qt_TexCoord0 = qt_MultiTexCoord0;" + - " gl_Position = qt_Matrix * qt_Vertex;" + - "}" - - property string glslFragmentShader: - "uniform sampler2D source;" + - "uniform highp float amplitude;" + - "uniform highp float frequency;" + - "uniform highp float time;" + - "uniform lowp float qt_Opacity;" + - "varying highp vec2 qt_TexCoord0;" + - "void main() {" + - " highp vec2 p = sin(time + frequency * qt_TexCoord0);" + - " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" + - "}" - - property string hlslVertexShader: "cbuffer ConstantBuffer : register(b0) {" + - " float4x4 qt_Matrix;" + - " float qt_Opacity; }" + - "struct PSInput {" + - " float4 position : SV_POSITION;" + - " float2 coord : TEXCOORD0; };" + - "PSInput main(float4 position : POSITION, float2 coord : TEXCOORD0) {" + - " PSInput result;" + - " result.position = mul(qt_Matrix, position);" + - " result.coord = coord;" + - " return result;" + - "}"; - - property string hlslPixelShader:"cbuffer ConstantBuffer : register(b0) {" + - " float4x4 qt_Matrix;" + - " float qt_Opacity;" + - " float amplitude;" + - " float frequency;" + - " float time; }" + - "Texture2D source : register(t0);" + - "SamplerState sourceSampler : register(s0);" + - "float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET" + - "{" + - " float2 p = sin(time + frequency * coord);" + - " return source.Sample(sourceSampler, coord + amplitude * float2(p.y, -p.x)) * qt_Opacity;" + - "}"; - - property string hlslVertexShaderByteCode: "qrc:/vs_wobble.cso" - property string hlslPixelShaderByteCode: "qrc:/ps_wobble.cso" - - vertexShader: customVertexShader ? (GraphicsInfo.shaderType === GraphicsInfo.HLSL - ? (useHLSLSourceString ? hlslVertexShader : hlslVertexShaderByteCode) - : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslVertexShader : "")) : "" - - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL - ? (useHLSLSourceString ? hlslPixelShader : hlslPixelShaderByteCode) - : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslFragmentShader : "") - } - - Image { - id: image2 - source: "qrc:/face-smile.png" - } - ShaderEffectSource { - id: effectSource2 - sourceItem: image2 - hideSource: true - } - ShaderEffect { // dropshadow - id: eff2 - width: image2.width - height: image2.height - scale: 2 - x: 40 - y: 40 - - property variant source: effectSource2 - - property string glslShaderPass1: " - uniform lowp float qt_Opacity; - uniform sampler2D source; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - gl_FragColor = (0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) - + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) - + 0.2466 * texture2D(source, qt_TexCoord0) - + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) - + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity; - }" - property string glslShaderPass2: " - uniform lowp float qt_Opacity; - uniform highp vec2 offset; - uniform sampler2D source; - uniform sampler2D shadow; - uniform highp float darkness; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 fg = texture2D(source, qt_TexCoord0); - lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); - gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity; - }" - - property variant shadow: ShaderEffectSource { - sourceItem: ShaderEffect { - width: eff2.width - height: eff2.height - property variant delta: Qt.size(0.0, 1.0 / height) - property variant source: ShaderEffectSource { - sourceItem: ShaderEffect { - id: innerEff - width: eff2.width - height: eff2.height - property variant delta: Qt.size(1.0 / width, 0.0) - property variant source: effectSource2 - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow1.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? eff2.glslShaderPass1 : "") - } - } - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow1.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? eff2.glslShaderPass1: "") - } - } - property real angle: 0 - property variant offset: Qt.point(5.0 * Math.cos(angle), 5.0 * Math.sin(angle)) - NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } - property variant delta: Qt.size(offset.x / width, offset.y / height) - property real darkness: 0.5 - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow2.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslShaderPass2 : "") - } - - Column { - anchors.bottom: parent.bottom - Text { - color: "yellow" - font.pointSize: 24 - text: "Shader effect is " + (GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "HLSL" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "GLSL" : "UNKNOWN")) + " based"; - } - Text { - text: GraphicsInfo.shaderType + " " + GraphicsInfo.shaderCompilationType + " " + GraphicsInfo.shaderSourceType - } - Text { - text: eff.status + " " + eff.log - } - } - } -} diff --git a/tests/manual/nodetypes/Images.qml b/tests/manual/nodetypes/Images.qml deleted file mode 100644 index 95e8442690..0000000000 --- a/tests/manual/nodetypes/Images.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.3 - -Item { - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - - Image { - id: im - source: "qrc:/qt.png" - mipmap: true - - // changing the mipmap property results in the creation of a brand new - // texture resource. enable the following to test. -// Timer { -// interval: 2000 -// onTriggered: im.mipmap = false -// running: true -// } - - SequentialAnimation on scale { - loops: Animation.Infinite - NumberAnimation { - from: 1.0 - to: 4.0 - duration: 2000 - } - NumberAnimation { - from: 4.0 - to: 0.1 - duration: 3000 - } - NumberAnimation { - from: 0.1 - to: 1.0 - duration: 1000 - } - } - - Image { - anchors.centerIn: parent - source: "qrc:/face-smile.png" - } - } - - Image { - source: "qrc:/face-smile.png" - anchors.bottom: parent.bottom - anchors.right: parent.right - antialiasing: true - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } -} diff --git a/tests/manual/nodetypes/Layers.qml b/tests/manual/nodetypes/Layers.qml deleted file mode 100644 index 755d00d41a..0000000000 --- a/tests/manual/nodetypes/Layers.qml +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 { - Rectangle { - color: "lightGray" - anchors.fill: parent - anchors.margins: 10 - - Row { - anchors.fill: parent - anchors.margins: 10 - Rectangle { - color: "red" -// ColorAnimation on color { -// from: "black" -// to: "white" -// duration: 2000 -// loops: Animation.Infinite -// } - width: 300 - height: 100 - layer.enabled: true - Text { text: "this is in a layer, going through an offscreen render target" } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 275 - y: 75 - } - } - Rectangle { - color: "white" - width: 300 - height: 100 - Text { text: "this is not a layer" } - } - Rectangle { - color: "green" - width: 300 - height: 100 - layer.enabled: true - Text { text: "this is another layer" } - Rectangle { - border.width: 4 - border.color: "black" - anchors.centerIn: parent - width: 150 - height: 50 - layer.enabled: true - Text { - anchors.centerIn: parent - text: "layer in a layer" - } - } - Image { - source: "qrc:/face-smile.png" - anchors.bottom: parent.bottom - anchors.right: parent.right - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - } - } - } -} diff --git a/tests/manual/nodetypes/LotsOfImages.qml b/tests/manual/nodetypes/LotsOfImages.qml deleted file mode 100644 index 72c36aba01..0000000000 --- a/tests/manual/nodetypes/LotsOfImages.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.3 - -Item { - Grid { - columns: 20 - spacing: 4 - anchors.centerIn: parent - - Repeater { - model: 500 - - Image { - source: "qrc:/qt.png" - - // async true, cache false -> there is a separate, new texture for each and every image - // and the pixel data reading is done over and over again on a separate thread. - asynchronous: true - cache: false - - width: 20 - height: 20 - } - } - } - - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } -} diff --git a/tests/manual/nodetypes/LotsOfRects.qml b/tests/manual/nodetypes/LotsOfRects.qml deleted file mode 100644 index e54174f10c..0000000000 --- a/tests/manual/nodetypes/LotsOfRects.qml +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 { - Rectangle { - anchors.margins: 4 - anchors.fill: parent - - // Background - gradient: Gradient { - GradientStop { position: 0; color: "steelblue" } - GradientStop { position: 1; color: "black" } - } - - // Animated gradient stops. - // NB! Causes a full buffer rebuild on every animated change due to the geometry change! - Row { - spacing: 10 - Repeater { - model: 20 - Rectangle { - width: 20 - height: 20 - gradient: Gradient { - GradientStop { position: 0.0; color: "red" } - GradientStop { NumberAnimation on position { from: 0.01; to: 0.99; duration: 5000; loops: Animation.Infinite } color: "yellow" } - GradientStop { position: 1.0; color: "green" } - } - } - } - } - - // Rounded rects with border (smooth material) - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "blue" - width: 100 - height: 50 - y: 50 - radius: 16 - border.color: "red" - border.width: 4 - - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { - from: 50 - to: 150 - duration: 7000 - } - NumberAnimation { - from: 150 - to: 50 - duration: 3000 - } - } - } - } - } - - // Clip using scissor - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "green" - width: 100 - height: 100 - y: 150 - NumberAnimation on y { - from: 150 - to: 200 - duration: 2000 - loops: Animation.Infinite - } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 75 - } - } - } - } - - // Clip using scissor - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "green" - width: 100 - height: 100 - y: 300 - NumberAnimation on y { - from: 300 - to: 400 - duration: 2000 - loops: Animation.Infinite - } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 75 - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - } - } - } - - // Clip using stencil - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "green" - width: 100 - height: 100 - y: 450 - NumberAnimation on y { - from: 450 - to: 550 - duration: 2000 - loops: Animation.Infinite - } - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 75 - } - } - } - } - - // The signature red square with another item with animated opacity blended on top - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - - Rectangle { - color: "gray" - width: 50 - height: 50 - anchors.centerIn: parent - - SequentialAnimation on opacity { - loops: Animation.Infinite - NumberAnimation { - from: 1.0 - to: 0.0 - duration: 4000 - } - NumberAnimation { - from: 0.0 - to: 1.0 - duration: 4000 - easing.type: Easing.InOutQuad - } - } - } - } - - // Animated size and color. - // NB! Causes a full buffer rebuild on every animated change due to the geometry change! - Rectangle { - anchors.right: parent.right - anchors.bottom: parent.bottom - width: 10 - height: 100 - ColorAnimation on color { - from: "blue" - to: "purple" - duration: 5000 - loops: Animation.Infinite - } - NumberAnimation on width { - from: 10 - to: 300 - duration: 5000 - loops: Animation.Infinite - } - } - - // Semi-transparent rect on top. - Rectangle { - anchors.centerIn: parent - opacity: 0.2 - color: "black" - anchors.fill: parent - anchors.margins: 10 - } - } -} diff --git a/tests/manual/nodetypes/Painter.qml b/tests/manual/nodetypes/Painter.qml deleted file mode 100644 index c5db3496f8..0000000000 --- a/tests/manual/nodetypes/Painter.qml +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 Stuff 1.0 - -Item { - ListModel { - id: balloonModel - ListElement { - balloonWidth: 200 - } - ListElement { - balloonWidth: 120 - } - ListElement { - balloonWidth: 120 - } - ListElement { - balloonWidth: 120 - } - ListElement { - balloonWidth: 120 - } - } - - ListView { - anchors.fill: parent - anchors.margins: 10 - id: balloonView - model: balloonModel - spacing: 5 - delegate: TextBalloon { - anchors.right: index % 2 == 0 ? undefined : parent.right - height: 60 - rightAligned: index % 2 == 0 ? false : true - width: balloonWidth - innerAnim: model.index === 1 - NumberAnimation on width { - from: 200 - to: 300 - duration: 5000 - running: model.index === 0 - } - } - } -} diff --git a/tests/manual/nodetypes/Rects.qml b/tests/manual/nodetypes/Rects.qml deleted file mode 100644 index 7f12d118dd..0000000000 --- a/tests/manual/nodetypes/Rects.qml +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 { - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - - Rectangle { - color: "gray" - width: 50 - height: 50 - anchors.centerIn: parent - - SequentialAnimation on opacity { - loops: Animation.Infinite - NumberAnimation { - from: 1.0 - to: 0.0 - duration: 4000 - } - NumberAnimation { - from: 0.0 - to: 1.0 - duration: 4000 - easing.type: Easing.InOutQuad - } - } - } - } - - Rectangle { - color: "green" - width: 100 - height: 200 - x: 0 - y: 0 - - NumberAnimation on x { - from: 0 - to: 300 - duration: 5000 - } - NumberAnimation on y { - from: 0 - to: 50 - duration: 2000 - } - - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 175 - } - } - - Rectangle { - color: "blue" - width: 200 - height: 100 - x: 100 - y: 300 - radius: 16 - border.color: "red" - border.width: 4 - - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { - from: 300 - to: 500 - duration: 7000 - } - NumberAnimation { - from: 500 - to: 300 - duration: 3000 - } - } - } - - Rectangle { - anchors.right: parent.right - width: 100 - height: 100 - gradient: Gradient { - GradientStop { position: 0.0; color: "red" } - GradientStop { position: 0.33; color: "yellow" } - GradientStop { position: 1.0; color: "green" } - } - } -} diff --git a/tests/manual/nodetypes/Text.qml b/tests/manual/nodetypes/Text.qml deleted file mode 100644 index 58befe8c49..0000000000 --- a/tests/manual/nodetypes/Text.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 { - Text { - id: text1 - anchors.top: parent.top - text: "árvíztűrő tükörfúrógép\nÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP" - } - Text { - anchors.bottom: parent.bottom - text: "the quick brown fox jumps over the lazy dog\nTHE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" - color: "red" - } - Text { - anchors.centerIn: parent - text: "rotate rotate rotate" - font.bold: true - font.pointSize: 20 - color: "green" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - - Row { - anchors.top: text1.bottom - anchors.margins: 10 - Text { font.pointSize: 24; text: "Normal" } - Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" } - Text { font.pointSize: 24; text: "Outline"; style: Text.Outline; styleColor: "red" } - Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" } - } -} diff --git a/tests/manual/nodetypes/face-smile.png b/tests/manual/nodetypes/face-smile.png Binary files differdeleted file mode 100644 index 3d66d72578..0000000000 --- a/tests/manual/nodetypes/face-smile.png +++ /dev/null diff --git a/tests/manual/nodetypes/hlslcompile.bat b/tests/manual/nodetypes/hlslcompile.bat deleted file mode 100644 index b24824e324..0000000000 --- a/tests/manual/nodetypes/hlslcompile.bat +++ /dev/null @@ -1,4 +0,0 @@ -fxc /E VS_Wobble /T vs_5_0 /Fo vs_wobble.cso wobble.hlsl -fxc /E PS_Wobble /T ps_5_0 /Fo ps_wobble.cso wobble.hlsl -fxc /E PS_Shadow1 /T ps_5_0 /Fo ps_shadow1.cso shadow1.hlsl -fxc /E PS_Shadow2 /T ps_5_0 /Fo ps_shadow2.cso shadow2.hlsl diff --git a/tests/manual/nodetypes/main.qml b/tests/manual/nodetypes/main.qml deleted file mode 100644 index 9f1a5c5e9c..0000000000 --- a/tests/manual/nodetypes/main.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 { - focus: true - - Loader { - anchors.fill: parent - id: loader - } - - Keys.onPressed: { - if (event.key === Qt.Key_S) - loader.source = ""; - - if (event.key === Qt.Key_R) - loader.source = "qrc:/Rects.qml"; - if (event.key === Qt.Key_4) - loader.source = "qrc:/LotsOfRects.qml"; - - if (event.key === Qt.Key_I) - loader.source = "qrc:/Images.qml"; - if (event.key === Qt.Key_5) - loader.source = "qrc:/LotsOfImages.qml"; - - if (event.key === Qt.Key_T) - loader.source = "qrc:/Text.qml"; - - if (event.key === Qt.Key_A) - loader.source = "qrc:/Animators.qml"; - - if (event.key === Qt.Key_L) - loader.source = "qrc:/Layers.qml"; - - if (event.key === Qt.Key_E) - loader.source = "qrc:/Effects.qml"; - - if (event.key === Qt.Key_P) - loader.source = "qrc:/Painter.qml"; - - if (event.key === Qt.Key_G) - helper.testGrab() - } -} diff --git a/tests/manual/nodetypes/nodetypes.cpp b/tests/manual/nodetypes/nodetypes.cpp deleted file mode 100644 index 287574f25c..0000000000 --- a/tests/manual/nodetypes/nodetypes.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -#include <QGuiApplication> -#include <QThread> -#include <QQuickView> -#include <QQmlEngine> -#include <QQmlContext> -#include <QQuickPaintedItem> -#include <QPainter> -#include <QTimer> - -class TextBalloon : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(bool rightAligned READ isRightAligned WRITE setRightAligned NOTIFY rightAlignedChanged) - Q_PROPERTY(bool innerAnim READ innerAnimEnabled WRITE setInnerAnimEnabled NOTIFY innerAnimChanged) - -public: - TextBalloon(QQuickItem *parent = nullptr) : QQuickPaintedItem(parent) { - connect(&m_timer, &QTimer::timeout, this, &TextBalloon::onAnim); - m_timer.setInterval(500); - } - void paint(QPainter *painter); - - bool isRightAligned() { return m_rightAligned; } - void setRightAligned(bool rightAligned); - - bool innerAnimEnabled() const { return m_innerAnim; } - void setInnerAnimEnabled(bool b); - -signals: - void rightAlignedChanged(); - void innerAnimChanged(); - -private slots: - void onAnim(); - -private: - bool m_rightAligned = false; - bool m_innerAnim = false; - QTimer m_timer; - QRect m_animRect = QRect(10, 10, 50, 20); - int m_anim = 0; -}; - -void TextBalloon::paint(QPainter *painter) -{ - QBrush brush(QColor("#007430")); - - painter->setBrush(brush); - painter->setPen(Qt::NoPen); - painter->setRenderHint(QPainter::Antialiasing); - - painter->drawRoundedRect(0, 0, boundingRect().width(), boundingRect().height() - 10, 10, 10); - - if (m_rightAligned) { - const QPointF points[3] = { - QPointF(boundingRect().width() - 10.0, boundingRect().height() - 10.0), - QPointF(boundingRect().width() - 20.0, boundingRect().height()), - QPointF(boundingRect().width() - 30.0, boundingRect().height() - 10.0), - }; - painter->drawConvexPolygon(points, 3); - } else { - const QPointF points[3] = { - QPointF(10.0, boundingRect().height() - 10.0), - QPointF(20.0, boundingRect().height()), - QPointF(30.0, boundingRect().height() - 10.0), - }; - painter->drawConvexPolygon(points, 3); - } - - if (m_innerAnim) { - painter->fillRect(m_animRect, Qt::lightGray); - const int x = m_animRect.x() + m_anim; - const int y = m_animRect.y() + m_animRect.height() / 2; - painter->setPen(QPen(QBrush(Qt::SolidLine), 4)); - painter->drawLine(x + 4, y, x + 10, y); - m_anim += 10; - if (m_anim > m_animRect.width()) - m_anim = 0; - } -} - -void TextBalloon::setRightAligned(bool rightAligned) -{ - if (m_rightAligned == rightAligned) - return; - - m_rightAligned = rightAligned; - emit rightAlignedChanged(); -} - -void TextBalloon::setInnerAnimEnabled(bool b) -{ - if (m_innerAnim == b) - return; - - m_innerAnim = b; - if (!b) - m_timer.stop(); - else - m_timer.start(); - emit innerAnimChanged(); -} - -void TextBalloon::onAnim() -{ - update(m_animRect); -} - -class Helper : public QObject -{ - Q_OBJECT - -public: - Helper(QQuickWindow *w) : m_window(w) { } - - Q_INVOKABLE void sleep(int ms) { - QThread::msleep(ms); - } - - Q_INVOKABLE void testGrab() { - QImage img = m_window->grabWindow(); - qDebug() << "Saving image to grab_result.png" << img; - img.save("grab_result.png"); - } - - QQuickWindow *m_window; -}; - -int main(int argc, char **argv) -{ - qputenv("QT_QUICK_BACKEND", "d3d12"); - - QGuiApplication app(argc, argv); - - qDebug("Available tests:"); - qDebug(" [R] - Rectangles"); - qDebug(" [4] - A lot of rectangles"); - qDebug(" [I] - Images"); - qDebug(" [5] - A lot of async images"); - qDebug(" [T] - Text"); - qDebug(" [A] - Render thread Animator"); - qDebug(" [L] - Layers"); - qDebug(" [E] - Effects"); - qDebug(" [P] - QQuickPaintedItem"); - qDebug(" [G] - Grab current window"); - qDebug("\nPress S to stop the currently running test\n"); - - QQuickView view; - Helper helper(&view); - if (app.arguments().contains(QLatin1String("--multisample"))) { - qDebug("Requesting sample count 4"); - QSurfaceFormat fmt; - fmt.setSamples(4); - view.setFormat(fmt); - } - view.engine()->rootContext()->setContextProperty(QLatin1String("helper"), &helper); - qmlRegisterType<TextBalloon>("Stuff", 1, 0, "TextBalloon"); - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.resize(1024, 768); - view.setSource(QUrl("qrc:/main.qml")); - view.show(); - - return app.exec(); -} - -#include "nodetypes.moc" diff --git a/tests/manual/nodetypes/nodetypes.pro b/tests/manual/nodetypes/nodetypes.pro deleted file mode 100644 index 959b43cf18..0000000000 --- a/tests/manual/nodetypes/nodetypes.pro +++ /dev/null @@ -1,9 +0,0 @@ -QT += qml quick - -SOURCES += nodetypes.cpp - -RESOURCES += nodetypes.qrc - -OTHER_FILES += main.qml Rects.qml LotsOfRects.qml \ - Images.qml LotsOfImages.qml Text.qml Animators.qml Layers.qml Effects.qml Painter.qml \ - wobble.hlsl shadow1.hlsl shadow2.hlsl diff --git a/tests/manual/nodetypes/nodetypes.qrc b/tests/manual/nodetypes/nodetypes.qrc deleted file mode 100644 index 78c0d085a1..0000000000 --- a/tests/manual/nodetypes/nodetypes.qrc +++ /dev/null @@ -1,21 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>Rects.qml</file> - <file>LotsOfRects.qml</file> - <file>Images.qml</file> - <file>LotsOfImages.qml</file> - <file>Text.qml</file> - <file>Animators.qml</file> - <file>Layers.qml</file> - <file>Effects.qml</file> - <file>Painter.qml</file> - <file>qt.png</file> - <file>face-smile.png</file> - <file>shadow.png</file> - <file>vs_wobble.cso</file> - <file>ps_wobble.cso</file> - <file>ps_shadow1.cso</file> - <file>ps_shadow2.cso</file> - </qresource> -</RCC> diff --git a/tests/manual/nodetypes/ps_shadow1.cso b/tests/manual/nodetypes/ps_shadow1.cso Binary files differdeleted file mode 100644 index b6fbe3f3c2..0000000000 --- a/tests/manual/nodetypes/ps_shadow1.cso +++ /dev/null diff --git a/tests/manual/nodetypes/ps_shadow2.cso b/tests/manual/nodetypes/ps_shadow2.cso Binary files differdeleted file mode 100644 index ab8cb63f34..0000000000 --- a/tests/manual/nodetypes/ps_shadow2.cso +++ /dev/null diff --git a/tests/manual/nodetypes/ps_wobble.cso b/tests/manual/nodetypes/ps_wobble.cso Binary files differdeleted file mode 100644 index 4e5b6a27f4..0000000000 --- a/tests/manual/nodetypes/ps_wobble.cso +++ /dev/null diff --git a/tests/manual/nodetypes/qt.png b/tests/manual/nodetypes/qt.png Binary files differdeleted file mode 100644 index f30eec0d4d..0000000000 --- a/tests/manual/nodetypes/qt.png +++ /dev/null diff --git a/tests/manual/nodetypes/shadow.png b/tests/manual/nodetypes/shadow.png Binary files differdeleted file mode 100644 index 8270565e87..0000000000 --- a/tests/manual/nodetypes/shadow.png +++ /dev/null diff --git a/tests/manual/nodetypes/shadow1.hlsl b/tests/manual/nodetypes/shadow1.hlsl deleted file mode 100644 index ff3f4b6fd5..0000000000 --- a/tests/manual/nodetypes/shadow1.hlsl +++ /dev/null @@ -1,18 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float2 delta; -}; - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 PS_Shadow1(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - return (0.0538 * source.Sample(sourceSampler, coord - 3.182 * delta) - + 0.3229 * source.Sample(sourceSampler, coord - 1.364 * delta) - + 0.2466 * source.Sample(sourceSampler, coord) - + 0.3229 * source.Sample(sourceSampler, coord + 1.364 * delta) - + 0.0538 * source.Sample(sourceSampler, coord + 3.182 * delta)) * qt_Opacity; -} diff --git a/tests/manual/nodetypes/shadow2.hlsl b/tests/manual/nodetypes/shadow2.hlsl deleted file mode 100644 index eaa30cd988..0000000000 --- a/tests/manual/nodetypes/shadow2.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float2 offset; - float darkness; - float2 delta; -}; - -Texture2D source : register(t0); -Texture2D shadow : register(t1); -SamplerState samp : register(s0); -// Use the same sampler for both textures. In fact the engine will create an extra static sampler -// in any case (to match the number of textures) due to some internals, but that won't hurt, the -// shader works either way. - -float4 PS_Shadow2(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - float4 fg = source.Sample(samp, coord); - float4 bg = shadow.Sample(samp, coord + delta); - return (fg + float4(0.0, 0.0, 0.0, darkness * bg.a) * (1.0 - fg.a)) * qt_Opacity; -} diff --git a/tests/manual/nodetypes/vs_wobble.cso b/tests/manual/nodetypes/vs_wobble.cso Binary files differdeleted file mode 100644 index f3a2596457..0000000000 --- a/tests/manual/nodetypes/vs_wobble.cso +++ /dev/null diff --git a/tests/manual/nodetypes/wobble.hlsl b/tests/manual/nodetypes/wobble.hlsl deleted file mode 100644 index 203dbda7f2..0000000000 --- a/tests/manual/nodetypes/wobble.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - - float amplitude; - float frequency; - float time; -}; - -struct PSInput -{ - float4 position : SV_POSITION; - float2 coord : TEXCOORD0; -}; - -PSInput VS_Wobble(float4 position : POSITION, float2 coord : TEXCOORD0) -{ - PSInput result; - result.position = mul(qt_Matrix, position); - result.coord = coord; - return result; -} - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 PS_Wobble(PSInput input) : SV_TARGET -{ - float2 p = sin(time + frequency * input.coord); - return source.Sample(sourceSampler, input.coord + amplitude * float2(p.y, -p.x)) * qt_Opacity; -} diff --git a/tests/manual/nodetypes_ng/shadow_pass1.frag.qsb b/tests/manual/nodetypes_ng/shadow_pass1.frag.qsb Binary files differindex f3370caee2..f90265a997 100644 --- a/tests/manual/nodetypes_ng/shadow_pass1.frag.qsb +++ b/tests/manual/nodetypes_ng/shadow_pass1.frag.qsb diff --git a/tests/manual/nodetypes_ng/shadow_pass2.frag.qsb b/tests/manual/nodetypes_ng/shadow_pass2.frag.qsb Binary files differindex cbf9569373..9608763b61 100644 --- a/tests/manual/nodetypes_ng/shadow_pass2.frag.qsb +++ b/tests/manual/nodetypes_ng/shadow_pass2.frag.qsb diff --git a/tests/manual/nodetypes_ng/wobble.frag.qsb b/tests/manual/nodetypes_ng/wobble.frag.qsb Binary files differindex 9d3b80fad8..7d3105fd3c 100644 --- a/tests/manual/nodetypes_ng/wobble.frag.qsb +++ b/tests/manual/nodetypes_ng/wobble.frag.qsb diff --git a/tests/manual/nodetypes_ng/wobble.vert.qsb b/tests/manual/nodetypes_ng/wobble.vert.qsb Binary files differindex 0f44e87feb..92b8ba9703 100644 --- a/tests/manual/nodetypes_ng/wobble.vert.qsb +++ b/tests/manual/nodetypes_ng/wobble.vert.qsb diff --git a/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml b/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml index d4ae526b5d..956b3d7d91 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml @@ -23,13 +23,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml b/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml index f1bb03a4a9..24aa5db5e8 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml @@ -6,12 +6,6 @@ Item { ShaderEffect { anchors.fill: parent; - fragmentShader: " - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1); - } - " + fragmentShader: "qrc:shaders/basic.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml index 76ce60fd7d..118de56098 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml @@ -72,16 +72,7 @@ Rectangle { cullMode: model.bar property variant frontSource: front property variant backSource: back - fragmentShader: " - varying highp vec2 qt_TexCoord0; - uniform sampler2D frontSource; - uniform sampler2D backSource; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = gl_FrontFacing - ? texture2D(frontSource, qt_TexCoord0) - : texture2D(backSource, qt_TexCoord0); - }" + fragmentShader: "qrc:shaders/culling.frag" transform: Rotation { origin.x: 200 origin.y: 180 - 120 * index diff --git a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml index 45f20dd5a4..7614451e05 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml @@ -72,16 +72,7 @@ Rectangle { cullMode: model.bar property variant frontSource: front property variant backSource: back - fragmentShader: " - varying highp vec2 qt_TexCoord0; - uniform sampler2D frontSource; - uniform sampler2D backSource; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = gl_FrontFacing - ? texture2D(frontSource, qt_TexCoord0) - : texture2D(backSource, qt_TexCoord0); - }" + fragmentShader: "qrc:shaders/culling.frag" transform: Rotation { origin.x: 100 origin.y: 180 - 120 * index diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml index ddea979124..7a743453ab 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 1 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml index 971cda4f55..9e221d0887 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 16 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml index d301ef089c..4dad42d182 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml @@ -4,10 +4,10 @@ Rectangle { width: 320 height: 480 color: "skyblue" - ShaderEffect{ + ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 2 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml index 0043282efd..9d91da0bb2 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 4 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml index f9427a1f16..c436c0f8e4 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 8 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml index 83469531b1..7c5b5efac5 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml @@ -43,22 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml index 160b89168e..64b950ace4 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml @@ -43,23 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml index 566edddedb..b071715cf2 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml @@ -43,22 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml index 0b8038e9ee..02ac70e69c 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml @@ -43,24 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - - - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml b/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml index 132f160a26..c4cf4cc1e4 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml @@ -6,7 +6,7 @@ Item { Image { id: image; - source: "./face-smile.png" + source: "face-smile.png" visible: false asynchronous: true } @@ -14,15 +14,7 @@ Item { ShaderEffect { anchors.fill: image property variant source: image - - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0); - } - " + fragmentShader: "qrc:shaders/gradient2.frag" visible: image.status == Image.Ready } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml b/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml index 878eddeda5..04406829b3 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml @@ -13,14 +13,6 @@ Item { ShaderEffect { anchors.fill: image property variant source: image - - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0); - } - " + fragmentShader: "qrc:shaders/gradient2.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml index 0383feaf91..97b5760854 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml @@ -32,13 +32,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml index 2e7074c65d..ea3456838c 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml @@ -32,13 +32,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml index 3793e655c7..9f0162ccd3 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml @@ -16,7 +16,7 @@ Item { height: 50 color: "red" anchors.centerIn: parent - transform: Rotation{ angle: 45} + transform: Rotation{ angle: 45 } } } @@ -38,14 +38,7 @@ Item { property variant source: source1 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient4.frag" } ShaderEffect { @@ -55,14 +48,7 @@ Item { property variant source: source2 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml index 2d8a4b6c09..e0c218ca69 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml @@ -16,7 +16,7 @@ Item { height: 50 color: "red" anchors.centerIn: parent - transform: Rotation{ angle: 90} + transform: Rotation{ angle: 90 } } } @@ -38,14 +38,7 @@ Item { property variant source: source1 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient4.frag" } ShaderEffect { @@ -55,14 +48,7 @@ Item { property variant source: source2 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml index 67e0cc36ad..5b1f15c01c 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml @@ -24,14 +24,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } ShaderEffect { @@ -41,13 +34,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient5.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml index d57f7c5dfb..309db50ba2 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml @@ -23,13 +23,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml index e2a3ca7a0c..f473207235 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml @@ -22,14 +22,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } Rectangle { diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml index 9df6b13c1e..2b04b76482 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml @@ -47,14 +47,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml index f997630d30..0ce09cda18 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml @@ -47,14 +47,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml index 1fadabe5b6..dbb82a278e 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml @@ -44,14 +44,6 @@ Item { property variant colorSource: colorSource property variant maskSource: maskSource; - fragmentShader: " - uniform lowp sampler2D maskSource; - uniform lowp sampler2D colorSource; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = texture2D(maskSource, qt_TexCoord0).a * texture2D(colorSource, qt_TexCoord0.yx); - } - " + fragmentShader: "qrc:shaders/stencil.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml index 7a3bf9fd36..309028807f 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml @@ -27,14 +27,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " - + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml index d60dbaee3d..df05c8f087 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml @@ -27,14 +27,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " - + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml b/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml index ab8db47009..5738da5e8d 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml @@ -18,22 +18,7 @@ Item { property variant textureSize: source.textureSize property color color: "black" - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform highp vec2 textureSize; - uniform lowp vec4 color; - uniform lowp float qt_Opacity; - void main() { - highp vec2 dx = vec2(0.5 / textureSize.x, 0.); - highp vec2 dy = vec2(0., 0.5 / textureSize.y); - gl_FragColor = color * 0.25 - * (texture2D(source, qt_TexCoord0 + dx + dy).a - + texture2D(source, qt_TexCoord0 + dx - dy).a - + texture2D(source, qt_TexCoord0 - dx + dy).a - + texture2D(source, qt_TexCoord0 - dx - dy).a); - } - " + fragmentShader: "qrc:shaders/edge.frag" } Text { diff --git a/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml b/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml index c008114810..baa002dc50 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml @@ -48,21 +48,6 @@ Item { property variant yellow: repeat property variant black: clamp - fragmentShader: " - uniform lowp sampler2D cyan; - uniform lowp sampler2D magenta; - uniform lowp sampler2D yellow; - uniform lowp sampler2D black; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 t = qt_TexCoord0 * 3. - 1.; - lowp float c = texture2D(cyan, t + vec2(.05, .09)).a; - lowp float m = texture2D(magenta, t + vec2(.04, -.10)).a; - lowp float y = texture2D(yellow, t + vec2(-.10, .01)).a; - lowp float k = texture2D(black, t).a; - gl_FragColor = 1. - vec4(c + k, m + k, y + k, 0.); - } - " + fragmentShader: "qrc:shaders/cmyk.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/basic.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/basic.frag Binary files differnew file mode 100644 index 0000000000..c6da52fd32 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/basic.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/cmyk.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/cmyk.frag Binary files differnew file mode 100644 index 0000000000..e9c48edbb9 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/cmyk.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/culling.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/culling.frag Binary files differnew file mode 100644 index 0000000000..6f44fff112 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/culling.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/edge.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/edge.frag Binary files differnew file mode 100644 index 0000000000..01a1d1cb3d --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/edge.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient.frag Binary files differnew file mode 100644 index 0000000000..78ac8a9c95 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient2.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient2.frag Binary files differnew file mode 100644 index 0000000000..364fffab52 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient2.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient3.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient3.frag Binary files differnew file mode 100644 index 0000000000..42bebf490a --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient3.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient4.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient4.frag Binary files differnew file mode 100644 index 0000000000..ed31582cf9 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient4.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient5.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient5.frag Binary files differnew file mode 100644 index 0000000000..7fe041f0ae --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient5.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/shadow.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/shadow.frag Binary files differnew file mode 100644 index 0000000000..cb3428b75f --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/shadow.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/stencil.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/stencil.frag Binary files differnew file mode 100644 index 0000000000..ccf3633d64 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/stencil.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/wave.vert b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/wave.vert Binary files differnew file mode 100644 index 0000000000..04850feb27 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/wave.vert diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/basic.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic.frag new file mode 100644 index 0000000000..6b3a881174 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic.frag @@ -0,0 +1,5 @@ +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/basic_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic_rhi.frag new file mode 100644 index 0000000000..aa850af449 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic_rhi.frag @@ -0,0 +1,8 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +void main() { + fragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk.frag new file mode 100644 index 0000000000..d63a0fa6ee --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk.frag @@ -0,0 +1,14 @@ +uniform lowp sampler2D cyan; +uniform lowp sampler2D magenta; +uniform lowp sampler2D yellow; +uniform lowp sampler2D black; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + highp vec2 t = qt_TexCoord0 * 3. - 1.; + lowp float c = texture2D(cyan, t + vec2(.05, .09)).a; + lowp float m = texture2D(magenta, t + vec2(.04, -.10)).a; + lowp float y = texture2D(yellow, t + vec2(-.10, .01)).a; + lowp float k = texture2D(black, t).a; + gl_FragColor = 1. - vec4(c + k, m + k, y + k, 0.); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk_rhi.frag new file mode 100644 index 0000000000..5d528e1d7a --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk_rhi.frag @@ -0,0 +1,18 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D cyan; +layout(binding = 2) uniform sampler2D magenta; +layout(binding = 3) uniform sampler2D yellow; +layout(binding = 4) uniform sampler2D black; + +void main() { + vec2 t = qt_TexCoord0 * 3. - 1.; + lowp float c = texture(cyan, t + vec2(.05, .09)).a; + lowp float m = texture(magenta, t + vec2(.04, -.10)).a; + lowp float y = texture(yellow, t + vec2(-.10, .01)).a; + lowp float k = texture(black, t).a; + fragColor = 1. - vec4(c + k, m + k, y + k, 0.); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/compile.bat b/tests/manual/scenegraph_lancelot/data/shared/shaders/compile.bat new file mode 100644 index 0000000000..13435f76b6 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/compile.bat @@ -0,0 +1,13 @@ +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/wave.vert wave_rhi.vert + +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/basic.frag basic_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/cmyk.frag cmyk_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/culling.frag culling_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/edge.frag edge_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient.frag gradient_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient2.frag gradient2_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient3.frag gradient3_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient4.frag gradient4_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient5.frag gradient5_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/shadow.frag shadow_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/stencil.frag stencil_rhi.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/culling.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling.frag new file mode 100644 index 0000000000..1b12df7c6d --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling.frag @@ -0,0 +1,9 @@ +varying highp vec2 qt_TexCoord0; +uniform sampler2D frontSource; +uniform sampler2D backSource; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = gl_FrontFacing + ? texture2D(frontSource, qt_TexCoord0) + : texture2D(backSource, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/culling_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling_rhi.frag new file mode 100644 index 0000000000..8399bc0282 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling_rhi.frag @@ -0,0 +1,13 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D frontSource; +layout(binding = 1) uniform sampler2D backSource; + +void main() { + fragColor = gl_FrontFacing + ? texture(frontSource, qt_TexCoord0) + : texture(backSource, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/edge.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge.frag new file mode 100644 index 0000000000..8cb616f3e0 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge.frag @@ -0,0 +1,14 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform highp vec2 textureSize; +uniform lowp vec4 color; +uniform lowp float qt_Opacity; +void main() { + highp vec2 dx = vec2(0.5 / textureSize.x, 0.); + highp vec2 dy = vec2(0., 0.5 / textureSize.y); + gl_FragColor = color * 0.25 + * (texture2D(source, qt_TexCoord0 + dx + dy).a + + texture2D(source, qt_TexCoord0 + dx - dy).a + + texture2D(source, qt_TexCoord0 - dx + dy).a + + texture2D(source, qt_TexCoord0 - dx - dy).a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/edge_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge_rhi.frag new file mode 100644 index 0000000000..77d7b47499 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge_rhi.frag @@ -0,0 +1,23 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; + vec2 textureSize; + vec4 color; +} ubuf; + +void main() { + vec2 dx = vec2(0.5 / ubuf.textureSize.x, 0.); + vec2 dy = vec2(0., 0.5 / ubuf.textureSize.y); + fragColor = ubuf.color * 0.25 + * (texture(source, qt_TexCoord0 + dx + dy).a + + texture(source, qt_TexCoord0 + dx - dy).a + + texture(source, qt_TexCoord0 - dx + dy).a + + texture(source, qt_TexCoord0 - dx - dy).a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient.frag new file mode 100644 index 0000000000..c581cc0c73 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2.frag new file mode 100644 index 0000000000..5f07e56d4a --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2_rhi.frag new file mode 100644 index 0000000000..b08e6339b3 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture(source, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3.frag new file mode 100644 index 0000000000..61c9d46f94 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3_rhi.frag new file mode 100644 index 0000000000..2e523c2879 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4.frag new file mode 100644 index 0000000000..81d96ce126 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4_rhi.frag new file mode 100644 index 0000000000..a100ba2cd7 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5.frag new file mode 100644 index 0000000000..33485542af --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5_rhi.frag new file mode 100644 index 0000000000..4ec104bd14 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient_rhi.frag new file mode 100644 index 0000000000..84eee1dbfe --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow.frag new file mode 100644 index 0000000000..0a6cdf3044 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow.frag @@ -0,0 +1,14 @@ +uniform lowp sampler2D source; +uniform highp vec2 offset; +uniform highp vec2 delta; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + highp vec2 delta2 = vec2(delta.x, -delta.y); + lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a + + texture2D(source, qt_TexCoord0 - offset - delta).a + + texture2D(source, qt_TexCoord0 - offset + delta2).a + + texture2D(source, qt_TexCoord0 - offset - delta2).a); + lowp vec4 color = texture2D(source, qt_TexCoord0); + gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow_rhi.frag new file mode 100644 index 0000000000..6a2d8dc122 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow_rhi.frag @@ -0,0 +1,23 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; + vec2 offset; + vec2 delta; +} ubuf; + +void main() { + vec2 delta2 = vec2(ubuf.delta.x, -ubuf.delta.y); + float shadow = 0.25 * (texture(source, qt_TexCoord0 - ubuf.offset + ubuf.delta).a + + texture(source, qt_TexCoord0 - ubuf.offset - ubuf.delta).a + + texture(source, qt_TexCoord0 - ubuf.offset + delta2).a + + texture(source, qt_TexCoord0 - ubuf.offset - delta2).a); + vec4 color = texture(source, qt_TexCoord0); + fragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil.frag new file mode 100644 index 0000000000..33c6cee064 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil.frag @@ -0,0 +1,7 @@ +uniform lowp sampler2D maskSource; +uniform lowp sampler2D colorSource; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = texture2D(maskSource, qt_TexCoord0).a * texture2D(colorSource, qt_TexCoord0.yx); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil_rhi.frag new file mode 100644 index 0000000000..734be73fdb --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil_rhi.frag @@ -0,0 +1,11 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D maskSource; +layout(binding = 2) uniform sampler2D colorSource; + +void main() { + fragColor = texture(maskSource, qt_TexCoord0).a * texture(colorSource, qt_TexCoord0.yx); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/wave.vert b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave.vert new file mode 100644 index 0000000000..38e523c06b --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave.vert @@ -0,0 +1,12 @@ +uniform highp mat4 qt_Matrix; +attribute highp vec4 qt_Vertex; +attribute highp vec2 qt_MultiTexCoord0; +varying highp vec2 qt_TexCoord0; + +void main() { + highp vec4 pos = qt_Vertex; + pos.x += sin(qt_Vertex.y * 0.02) * 20.; + pos.y += sin(qt_Vertex.x * 0.02) * 20.; + gl_Position = qt_Matrix * pos; + qt_TexCoord0 = qt_MultiTexCoord0; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/wave_rhi.vert b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave_rhi.vert new file mode 100644 index 0000000000..38f6173773 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave_rhi.vert @@ -0,0 +1,18 @@ +#version 440 + +layout(location = 0) in vec4 qt_Vertex; +layout(location = 1) in vec2 qt_MultiTexCoord0; + +layout(location = 0) out vec2 qt_TexCoord0; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; +} ubuf; + +void main() { + vec4 pos = qt_Vertex; + pos.x += sin(qt_Vertex.y * 0.02) * 20.; + pos.y += sin(qt_Vertex.x * 0.02) * 20.; + gl_Position = ubuf.qt_Matrix * pos; + qt_TexCoord0 = qt_MultiTexCoord0; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shared.qrc b/tests/manual/scenegraph_lancelot/data/shared/shared.qrc new file mode 100644 index 0000000000..3618fc8b94 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shared.qrc @@ -0,0 +1,28 @@ +<RCC> + <qresource prefix="/"> + <file>shaders/basic.frag</file> + <file>shaders/cmyk.frag</file> + <file>shaders/culling.frag</file> + <file>shaders/edge.frag</file> + <file>shaders/gradient.frag</file> + <file>shaders/gradient2.frag</file> + <file>shaders/gradient3.frag</file> + <file>shaders/gradient4.frag</file> + <file>shaders/gradient5.frag</file> + <file>shaders/shadow.frag</file> + <file>shaders/stencil.frag</file> + <file>shaders/wave.vert</file> + <file>shaders/+qsb/basic.frag</file> + <file>shaders/+qsb/cmyk.frag</file> + <file>shaders/+qsb/culling.frag</file> + <file>shaders/+qsb/edge.frag</file> + <file>shaders/+qsb/gradient.frag</file> + <file>shaders/+qsb/gradient2.frag</file> + <file>shaders/+qsb/gradient3.frag</file> + <file>shaders/+qsb/gradient4.frag</file> + <file>shaders/+qsb/gradient5.frag</file> + <file>shaders/+qsb/shadow.frag</file> + <file>shaders/+qsb/stencil.frag</file> + <file>shaders/+qsb/wave.vert</file> + </qresource> +</RCC> diff --git a/tests/manual/scenegraph_lancelot/data/text/text_style2.qml b/tests/manual/scenegraph_lancelot/data/text/text_style2.qml new file mode 100644 index 0000000000..984ca6a1ed --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/text_style2.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +//vary font style + +Item { + width: 320 + height: 480 + + Column { + anchors.fill: parent + Repeater { + model: [Text.Normal, Text.Outline, Text.Raised, Text.Sunken] + Text { + renderType: Text.QtRendering + width: parent.width + wrapMode: Text.Wrap + font.pointSize: 10 + style: modelData + styleColor: "green" + text: "The quick fox jumps in style " + modelData + } + } + + Repeater { + model: [Text.Normal, Text.Outline, Text.Raised, Text.Sunken] + Text { + renderType: Text.NativeRendering + width: parent.width + wrapMode: Text.Wrap + font.pointSize: 10 + style: modelData + styleColor: "green" + text: "The quick fox jumps in style " + modelData + } + } + } +} diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro b/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro index 24f0f8a315..3ecb1f8ac1 100644 --- a/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro +++ b/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro @@ -1,8 +1,10 @@ TARGET = qmlscenegrabber DESTDIR=.. -macx:CONFIG -= app_bundle CONFIG += console QT += quick SOURCES += main.cpp + +RESOURCES += \ + ../data/shared/shared.qrc diff --git a/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro index dd0ef268b1..9deb46427e 100644 --- a/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro +++ b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro @@ -10,6 +10,8 @@ SOURCES += tst_scenegraph.cpp # Assuming that we are in a normal Qt5 source code tree include(../../../../../qtbase/tests/baselineserver/shared/qbaselinetest.pri) -TEST_HELPER_INSTALLS += .././qmlscenegrabber +win32: TEST_HELPER_INSTALLS += .././qmlscenegrabber.exe +else: macos: TEST_HELPER_INSTALLS += .././qmlscenegrabber.app +else: TEST_HELPER_INSTALLS += .././qmlscenegrabber TESTDATA += ../data diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp index 40b17ec2a2..a65bde1002 100644 --- a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp +++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp @@ -69,8 +69,10 @@ private: quint16 checksumFileOrDir(const QString &path); QString testSuitePath; + QString grabberPath; int consecutiveErrors; // Not test failures (image mismatches), but system failures (so no image at all) bool aborted; // This run given up because of too many system failures + bool usingRhi; }; @@ -90,10 +92,37 @@ void tst_Scenegraph::initTestCase() QSKIP("Test suite data directory missing or unreadable: " + fi.canonicalFilePath().toLatin1()); testSuitePath = fi.canonicalFilePath(); +#if defined(Q_OS_WIN) + grabberPath = QFINDTESTDATA("qmlscenegrabber.exe"); +#elif defined(Q_OS_DARWIN) + grabberPath = QFINDTESTDATA("qmlscenegrabber.app/Contents/MacOS/qmlscenegrabber"); +#else + grabberPath = QFINDTESTDATA("qmlscenegrabber"); +#endif + if (grabberPath.isEmpty()) + grabberPath = QCoreApplication::applicationDirPath() + "/qmlscenegrabber"; + const char *backendVarName = "QT_QUICK_BACKEND"; const QString backend = qEnvironmentVariable(backendVarName, QString::fromLatin1("default")); QBaselineTest::addClientProperty(QString::fromLatin1(backendVarName), backend); +#if defined(Q_OS_WIN) + const char *defaultRhiBackend = "d3d11"; +#elif defined(Q_OS_DARWIN) + const char *defaultRhiBackend = "metal"; +#else + const char *defaultRhiBackend = "opengl"; +#endif + usingRhi = qEnvironmentVariableIntValue("QSG_RHI") != 0; + QString stack; + if (usingRhi) { + const QString rhiBackend = qEnvironmentVariable("QSG_RHI_BACKEND", QString::fromLatin1(defaultRhiBackend)); + stack = QString::fromLatin1("RHI_%1").arg(rhiBackend); + } else { + stack = qEnvironmentVariable("QT_QUICK_BACKEND", QString::fromLatin1("DirectGL")); + } + QBaselineTest::addClientProperty(QString::fromLatin1("GraphicsStack"), stack); + QByteArray msg; if (!QBaselineTest::connectToBaselineServer(&msg)) QSKIP(msg); @@ -201,11 +230,11 @@ bool tst_Scenegraph::renderAndGrab(const QString& qmlFile, const QStringList& ex { bool usePipe = true; // Whether to transport the grabbed image using temp. file or pipe. TBD: cmdline option QProcess grabber; - QString cmd = QCoreApplication::applicationDirPath() + "/qmlscenegrabber"; + grabber.setProcessChannelMode(QProcess::ForwardedErrorChannel); QStringList args = extraArgs; QString tmpfile = usePipe ? QString("-") : QString("/tmp/qmlscenegrabber-%1-out.ppm").arg(QCoreApplication::applicationPid()); args << qmlFile << "-o" << tmpfile; - grabber.start(cmd, args, QIODevice::ReadOnly); + grabber.start(grabberPath, args, QIODevice::ReadOnly); grabber.waitForFinished(17000); //### hardcoded, must be larger than the scene timeout in qmlscenegrabber if (grabber.state() != QProcess::NotRunning) { grabber.terminate(); diff --git a/tests/manual/tableview/abstracttablemodel/main.qml b/tests/manual/tableview/abstracttablemodel/main.qml index 4b9158f03c..9d849f2c8f 100644 --- a/tests/manual/tableview/abstracttablemodel/main.qml +++ b/tests/manual/tableview/abstracttablemodel/main.qml @@ -52,12 +52,6 @@ Window { property int selectedX: -1 property int selectedY: -1 - TestTableModel { - id: tableModel - rowCount: 200 - columnCount: 200 - } - Rectangle { anchors.fill: parent anchors.margins: 10 @@ -72,19 +66,19 @@ Window { spacing: 1 Button { text: "Add row" - onClicked: tableModel.insertRows(selectedY, 1) + onClicked: tableView.model.insertRows(selectedY, 1) } Button { text: "Remove row" - onClicked: tableModel.removeRows(selectedY, 1) + onClicked: tableView.model.removeRows(selectedY, 1) } Button { text: "Add column" - onClicked: tableModel.insertColumns(selectedX, 1) + onClicked: tableView.model.insertColumns(selectedX, 1) } Button { text: "Remove column" - onClicked: tableModel.removeColumns(selectedX, 1) + onClicked: tableView.model.removeColumns(selectedX, 1) } } |