diff options
Diffstat (limited to 'tests')
205 files changed, 3286 insertions, 3780 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..898ece00 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(QT_BUILD_STANDALONE_TESTS) +endif() +qt_build_tests() diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 00000000..6f440eaa --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT ANDROID) + add_subdirectory(cpptest) +endif() +if(TARGET Qt::Quick AND NOT boot2qt) + add_subdirectory(qmltest) +endif() diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro deleted file mode 100644 index 38f40591..00000000 --- a/tests/auto/auto.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs - -!android: SUBDIRS += cpptest - -qtHaveModule(quick): SUBDIRS += qmltest - -installed_cmake.depends = cmake - -# OpenGL support is needed for all qmltests but it's not available on boot2qt -boot2qt: SUBDIRS -= qmltest diff --git a/tests/auto/cpptest/CMakeLists.txt b/tests/auto/cpptest/CMakeLists.txt new file mode 100644 index 00000000..939b32c9 --- /dev/null +++ b/tests/auto/cpptest/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +add_subdirectory(q3dbars) +add_subdirectory(q3dbars-proxy) +add_subdirectory(q3dbars-modelproxy) +add_subdirectory(q3dbars-series) +add_subdirectory(q3dscatter) +add_subdirectory(q3dscatter-proxy) +add_subdirectory(q3dscatter-modelproxy) +add_subdirectory(q3dscatter-series) +add_subdirectory(q3dsurface) +add_subdirectory(q3dsurface-proxy) +add_subdirectory(q3dsurface-modelproxy) +add_subdirectory(q3dsurface-modelproxy-nan) +add_subdirectory(q3dsurface-heightproxy) +add_subdirectory(q3dsurface-series) +add_subdirectory(q3daxis-category) +add_subdirectory(q3daxis-logvalue) +add_subdirectory(q3daxis-value) +add_subdirectory(q3dscene) +add_subdirectory(q3dscene-camera) +add_subdirectory(q3dscene-light) +add_subdirectory(q3dtheme) +add_subdirectory(q3dinput) +add_subdirectory(q3dinput-touch) +add_subdirectory(q3dcustom) +add_subdirectory(q3dcustom-label) +add_subdirectory(q3dcustom-volume) diff --git a/tests/auto/cpptest/common/cpptestutil.h b/tests/auto/cpptest/common/cpptestutil.h index 986ba8b9..546c60f9 100644 --- a/tests/auto/cpptest/common/cpptestutil.h +++ b/tests/auto/cpptest/common/cpptestutil.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** 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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef CPPTESTUTIL_H #define CPPTESTUTIL_H diff --git a/tests/auto/cpptest/common/cpptestutil.pri b/tests/auto/cpptest/common/cpptestutil.pri deleted file mode 100644 index 0bac2856..00000000 --- a/tests/auto/cpptest/common/cpptestutil.pri +++ /dev/null @@ -1,2 +0,0 @@ -QT += gui-private -INCLUDEPATH += $$PWD/ diff --git a/tests/auto/cpptest/cpptest.pro b/tests/auto/cpptest/cpptest.pro deleted file mode 100644 index abd8f38e..00000000 --- a/tests/auto/cpptest/cpptest.pro +++ /dev/null @@ -1,26 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = q3dbars \ - q3dbars-proxy \ - q3dbars-modelproxy \ - q3dbars-series \ - q3dscatter \ - q3dscatter-proxy \ - q3dscatter-modelproxy \ - q3dscatter-series \ - q3dsurface \ - q3dsurface-proxy \ - q3dsurface-modelproxy \ - q3dsurface-heightproxy \ - q3dsurface-series \ - q3daxis-category \ - q3daxis-logvalue \ - q3daxis-value \ - q3dscene \ - q3dscene-camera \ - q3dscene-light \ - q3dtheme \ - q3dinput \ - q3dinput-touch \ - q3dcustom \ - q3dcustom-label \ - q3dcustom-volume diff --git a/tests/auto/cpptest/q3daxis-category/CMakeLists.txt b/tests/auto/cpptest/q3daxis-category/CMakeLists.txt new file mode 100644 index 00000000..f148b184 --- /dev/null +++ b/tests/auto/cpptest/q3daxis-category/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3daxis-category_datavis + SOURCES + tst_axis.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3daxis-category/q3daxis-category.pro b/tests/auto/cpptest/q3daxis-category/q3daxis-category.pro deleted file mode 100644 index 74415397..00000000 --- a/tests/auto/cpptest/q3daxis-category/q3daxis-category.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_axis.cpp diff --git a/tests/auto/cpptest/q3daxis-category/tst_axis.cpp b/tests/auto/cpptest/q3daxis-category/tst_axis.cpp index 789ace17..d1440d6a 100644 --- a/tests/auto/cpptest/q3daxis-category/tst_axis.cpp +++ b/tests/auto/cpptest/q3daxis-category/tst_axis.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QCategory3DAxis> -using namespace QtDataVisualization; - class tst_axis: public QObject { Q_OBJECT @@ -82,7 +54,7 @@ void tst_axis::initialProperties() { QVERIFY(m_axis); - QCOMPARE(m_axis->labels().length(), 0); + QCOMPARE(m_axis->labels().size(), 0); // Common (from QAbstract3DAxis) QCOMPARE(m_axis->isAutoAdjustRange(), true); @@ -102,7 +74,7 @@ void tst_axis::initializeProperties() m_axis->setLabels(QStringList() << "first" << "second"); - QCOMPARE(m_axis->labels().length(), 2); + QCOMPARE(m_axis->labels().size(), 2); QCOMPARE(m_axis->labels().at(1), QString("second")); // Common (from QAbstract3DAxis) diff --git a/tests/auto/cpptest/q3daxis-logvalue/CMakeLists.txt b/tests/auto/cpptest/q3daxis-logvalue/CMakeLists.txt new file mode 100644 index 00000000..0bba27a9 --- /dev/null +++ b/tests/auto/cpptest/q3daxis-logvalue/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3daxis-logvalue_datavis + SOURCES + tst_axis.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3daxis-logvalue/q3daxis-logvalue.pro b/tests/auto/cpptest/q3daxis-logvalue/q3daxis-logvalue.pro deleted file mode 100644 index 74415397..00000000 --- a/tests/auto/cpptest/q3daxis-logvalue/q3daxis-logvalue.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_axis.cpp diff --git a/tests/auto/cpptest/q3daxis-logvalue/tst_axis.cpp b/tests/auto/cpptest/q3daxis-logvalue/tst_axis.cpp index 450059ea..cf2b055c 100644 --- a/tests/auto/cpptest/q3daxis-logvalue/tst_axis.cpp +++ b/tests/auto/cpptest/q3daxis-logvalue/tst_axis.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QLogValue3DAxisFormatter> -using namespace QtDataVisualization; - class tst_axis: public QObject { Q_OBJECT diff --git a/tests/auto/cpptest/q3daxis-value/CMakeLists.txt b/tests/auto/cpptest/q3daxis-value/CMakeLists.txt new file mode 100644 index 00000000..5c412106 --- /dev/null +++ b/tests/auto/cpptest/q3daxis-value/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3daxis-value_datavis + SOURCES + tst_axis.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3daxis-value/q3daxis-value.pro b/tests/auto/cpptest/q3daxis-value/q3daxis-value.pro deleted file mode 100644 index 74415397..00000000 --- a/tests/auto/cpptest/q3daxis-value/q3daxis-value.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_axis.cpp diff --git a/tests/auto/cpptest/q3daxis-value/tst_axis.cpp b/tests/auto/cpptest/q3daxis-value/tst_axis.cpp index ae178edd..54d36d3d 100644 --- a/tests/auto/cpptest/q3daxis-value/tst_axis.cpp +++ b/tests/auto/cpptest/q3daxis-value/tst_axis.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QValue3DAxis> -using namespace QtDataVisualization; - class tst_axis: public QObject { Q_OBJECT @@ -90,7 +62,7 @@ void tst_axis::initialProperties() // Common (from QAbstract3DAxis) QCOMPARE(m_axis->isAutoAdjustRange(), true); QCOMPARE(m_axis->labelAutoRotation(), 0.0f); - QCOMPARE(m_axis->labels().length(), 6); + QCOMPARE(m_axis->labels().size(), 6); QCOMPARE(m_axis->labels().at(0), QString("0.00")); QCOMPARE(m_axis->labels().at(1), QString("2.00")); QCOMPARE(m_axis->labels().at(2), QString("4.00")); @@ -131,7 +103,7 @@ void tst_axis::initializeProperties() QCOMPARE(m_axis->isAutoAdjustRange(), false); QCOMPARE(m_axis->labelAutoRotation(), 15.0f); - QCOMPARE(m_axis->labels().length(), 3); + QCOMPARE(m_axis->labels().size(), 3); QCOMPARE(m_axis->labels().at(0), QString("5m")); QCOMPARE(m_axis->labels().at(1), QString("15m")); QCOMPARE(m_axis->labels().at(2), QString("25m")); diff --git a/tests/auto/cpptest/q3dbars-modelproxy/CMakeLists.txt b/tests/auto/cpptest/q3dbars-modelproxy/CMakeLists.txt new file mode 100644 index 00000000..f9b05902 --- /dev/null +++ b/tests/auto/cpptest/q3dbars-modelproxy/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dbars-modelproxy_datavis + SOURCES + tst_proxy.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::Widgets + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dbars-modelproxy/q3dbars-modelproxy.pro b/tests/auto/cpptest/q3dbars-modelproxy/q3dbars-modelproxy.pro deleted file mode 100644 index ad1fe0cc..00000000 --- a/tests/auto/cpptest/q3dbars-modelproxy/q3dbars-modelproxy.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../common/cpptestutil.pri) -QT += testlib datavisualization widgets - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_proxy.cpp diff --git a/tests/auto/cpptest/q3dbars-modelproxy/tst_proxy.cpp b/tests/auto/cpptest/q3dbars-modelproxy/tst_proxy.cpp index dfeee506..424aad3f 100644 --- a/tests/auto/cpptest/q3dbars-modelproxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dbars-modelproxy/tst_proxy.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -35,8 +9,6 @@ #include "cpptestutil.h" -using namespace QtDataVisualization; - class tst_proxy: public QObject { Q_OBJECT @@ -94,8 +66,8 @@ void tst_proxy::construct() QCOMPARE(proxy->columnRole(), QString("")); QCOMPARE(proxy->valueRole(), QString("val")); QCOMPARE(proxy->rotationRole(), QString("")); - QCOMPARE(proxy->rowCategories().length(), 0); - QCOMPARE(proxy->columnCategories().length(), 0); + QCOMPARE(proxy->rowCategories().size(), 0); + QCOMPARE(proxy->columnCategories().size(), 0); delete proxy; proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val"); @@ -104,8 +76,8 @@ void tst_proxy::construct() QCOMPARE(proxy->columnRole(), QString("col")); QCOMPARE(proxy->valueRole(), QString("val")); QCOMPARE(proxy->rotationRole(), QString("")); - QCOMPARE(proxy->rowCategories().length(), 0); - QCOMPARE(proxy->columnCategories().length(), 0); + QCOMPARE(proxy->rowCategories().size(), 0); + QCOMPARE(proxy->columnCategories().size(), 0); delete proxy; proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val", "rot"); @@ -114,8 +86,8 @@ void tst_proxy::construct() QCOMPARE(proxy->columnRole(), QString("col")); QCOMPARE(proxy->valueRole(), QString("val")); QCOMPARE(proxy->rotationRole(), QString("rot")); - QCOMPARE(proxy->rowCategories().length(), 0); - QCOMPARE(proxy->columnCategories().length(), 0); + QCOMPARE(proxy->rowCategories().size(), 0); + QCOMPARE(proxy->columnCategories().size(), 0); delete proxy; proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val", @@ -125,8 +97,8 @@ void tst_proxy::construct() QCOMPARE(proxy->columnRole(), QString("col")); QCOMPARE(proxy->valueRole(), QString("val")); QCOMPARE(proxy->rotationRole(), QString("")); - QCOMPARE(proxy->rowCategories().length(), 1); - QCOMPARE(proxy->columnCategories().length(), 1); + QCOMPARE(proxy->rowCategories().size(), 1); + QCOMPARE(proxy->columnCategories().size(), 1); delete proxy; proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val", "rot", @@ -136,8 +108,8 @@ void tst_proxy::construct() QCOMPARE(proxy->columnRole(), QString("col")); QCOMPARE(proxy->valueRole(), QString("val")); QCOMPARE(proxy->rotationRole(), QString("rot")); - QCOMPARE(proxy->rowCategories().length(), 1); - QCOMPARE(proxy->columnCategories().length(), 1); + QCOMPARE(proxy->rowCategories().size(), 1); + QCOMPARE(proxy->columnCategories().size(), 1); delete proxy; } @@ -149,25 +121,25 @@ void tst_proxy::initialProperties() QCOMPARE(m_proxy->autoRowCategories(), true); QCOMPARE(m_proxy->columnCategories(), QStringList()); QCOMPARE(m_proxy->columnRole(), QString()); - QCOMPARE(m_proxy->columnRolePattern(), QRegExp()); + QCOMPARE(m_proxy->columnRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->columnRoleReplace(), QString()); QVERIFY(!m_proxy->itemModel()); QCOMPARE(m_proxy->multiMatchBehavior(), QItemModelBarDataProxy::MMBLast); QCOMPARE(m_proxy->rotationRole(), QString()); - QCOMPARE(m_proxy->rotationRolePattern(), QRegExp()); + QCOMPARE(m_proxy->rotationRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->rotationRoleReplace(), QString()); QCOMPARE(m_proxy->rowCategories(), QStringList()); QCOMPARE(m_proxy->rowRole(), QString()); - QCOMPARE(m_proxy->rowRolePattern(), QRegExp()); + QCOMPARE(m_proxy->rowRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->rowRoleReplace(), QString()); QCOMPARE(m_proxy->useModelCategories(), false); QCOMPARE(m_proxy->valueRole(), QString()); - QCOMPARE(m_proxy->valueRolePattern(), QRegExp()); + QCOMPARE(m_proxy->valueRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->valueRoleReplace(), QString()); - QCOMPARE(m_proxy->columnLabels().count(), 0); + QCOMPARE(m_proxy->columnLabels().size(), 0); QCOMPARE(m_proxy->rowCount(), 0); - QCOMPARE(m_proxy->rowLabels().count(), 0); + QCOMPARE(m_proxy->rowLabels().size(), 0); QVERIFY(!m_proxy->series()); QCOMPARE(m_proxy->type(), QAbstractDataProxy::DataTypeBar); @@ -183,40 +155,40 @@ void tst_proxy::initializeProperties() m_proxy->setAutoRowCategories(false); m_proxy->setColumnCategories(QStringList() << "col1" << "col2"); m_proxy->setColumnRole("column"); - m_proxy->setColumnRolePattern(QRegExp("/^.*-(\\d\\d)$/")); + m_proxy->setColumnRolePattern(QRegularExpression("/^.*-(\\d\\d)$/")); m_proxy->setColumnRoleReplace("\\\\1"); m_proxy->setItemModel(table.model()); m_proxy->setMultiMatchBehavior(QItemModelBarDataProxy::MMBAverage); m_proxy->setRotationRole("rotation"); - m_proxy->setRotationRolePattern(QRegExp("/-/")); + m_proxy->setRotationRolePattern(QRegularExpression("/-/")); m_proxy->setRotationRoleReplace("\\\\1"); m_proxy->setRowCategories(QStringList() << "row1" << "row2"); m_proxy->setRowRole("row"); - m_proxy->setRowRolePattern(QRegExp("/^(\\d\\d\\d\\d).*$/")); + m_proxy->setRowRolePattern(QRegularExpression("/^(\\d\\d\\d\\d).*$/")); m_proxy->setRowRoleReplace("\\\\1"); m_proxy->setUseModelCategories(true); m_proxy->setValueRole("value"); - m_proxy->setValueRolePattern(QRegExp("/-/")); + m_proxy->setValueRolePattern(QRegularExpression("/-/")); m_proxy->setValueRoleReplace("\\\\1"); QCOMPARE(m_proxy->autoColumnCategories(), false); QCOMPARE(m_proxy->autoRowCategories(), false); - QCOMPARE(m_proxy->columnCategories().count(), 2); + QCOMPARE(m_proxy->columnCategories().size(), 2); QCOMPARE(m_proxy->columnRole(), QString("column")); - QCOMPARE(m_proxy->columnRolePattern(), QRegExp("/^.*-(\\d\\d)$/")); + QCOMPARE(m_proxy->columnRolePattern(), QRegularExpression("/^.*-(\\d\\d)$/")); QCOMPARE(m_proxy->columnRoleReplace(), QString("\\\\1")); QVERIFY(m_proxy->itemModel()); QCOMPARE(m_proxy->multiMatchBehavior(), QItemModelBarDataProxy::MMBAverage); QCOMPARE(m_proxy->rotationRole(), QString("rotation")); - QCOMPARE(m_proxy->rotationRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->rotationRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->rotationRoleReplace(), QString("\\\\1")); - QCOMPARE(m_proxy->rowCategories().count(), 2); + QCOMPARE(m_proxy->rowCategories().size(), 2); QCOMPARE(m_proxy->rowRole(), QString("row")); - QCOMPARE(m_proxy->rowRolePattern(), QRegExp("/^(\\d\\d\\d\\d).*$/")); + QCOMPARE(m_proxy->rowRolePattern(), QRegularExpression("/^(\\d\\d\\d\\d).*$/")); QCOMPARE(m_proxy->rowRoleReplace(), QString("\\\\1")); QCOMPARE(m_proxy->useModelCategories(), true); QCOMPARE(m_proxy->valueRole(), QString("value")); - QCOMPARE(m_proxy->valueRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->valueRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->valueRoleReplace(), QString("\\\\1")); } @@ -247,12 +219,13 @@ void tst_proxy::multiMatch() m_proxy->setItemModel(table.model()); m_proxy->setRowRole(table.model()->roleNames().value(Qt::DisplayRole)); m_proxy->setColumnRole(table.model()->roleNames().value(Qt::DisplayRole)); - m_proxy->setRowRolePattern(QRegExp(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setRowRolePattern(QRegularExpression(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setRowRoleReplace(QStringLiteral("\\2")); - m_proxy->setValueRolePattern(QRegExp(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setValueRolePattern(QRegularExpression(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setValueRoleReplace(QStringLiteral("\\3")); - m_proxy->setColumnRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setColumnRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setColumnRoleReplace(QStringLiteral("\\1")); + QCoreApplication::processEvents(); QBar3DSeries *series = new QBar3DSeries(m_proxy); @@ -273,9 +246,9 @@ void tst_proxy::multiMatch() QCoreApplication::processEvents(); QCOMPARE(graph.valueAxis()->max(), 15.0f); - QCOMPARE(m_proxy->columnLabels().count(), 1); + QCOMPARE(m_proxy->columnLabels().size(), 1); QCOMPARE(m_proxy->rowCount(), 1); - QCOMPARE(m_proxy->rowLabels().count(), 1); + QCOMPARE(m_proxy->rowLabels().size(), 1); QVERIFY(m_proxy->series()); m_proxy = 0; // Proxy gets deleted as graph gets deleted diff --git a/tests/auto/cpptest/q3dbars-proxy/CMakeLists.txt b/tests/auto/cpptest/q3dbars-proxy/CMakeLists.txt new file mode 100644 index 00000000..23c6997d --- /dev/null +++ b/tests/auto/cpptest/q3dbars-proxy/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dbars-proxy_datavis + SOURCES + tst_proxy.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dbars-proxy/q3dbars-proxy.pro b/tests/auto/cpptest/q3dbars-proxy/q3dbars-proxy.pro deleted file mode 100644 index b0b5d361..00000000 --- a/tests/auto/cpptest/q3dbars-proxy/q3dbars-proxy.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_proxy.cpp diff --git a/tests/auto/cpptest/q3dbars-proxy/tst_proxy.cpp b/tests/auto/cpptest/q3dbars-proxy/tst_proxy.cpp index a04c594f..4c343cb4 100644 --- a/tests/auto/cpptest/q3dbars-proxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dbars-proxy/tst_proxy.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QBarDataProxy> -using namespace QtDataVisualization; - class tst_proxy: public QObject { Q_OBJECT @@ -81,9 +53,9 @@ void tst_proxy::initialProperties() { QVERIFY(m_proxy); - QCOMPARE(m_proxy->columnLabels().count(), 0); + QCOMPARE(m_proxy->columnLabels().size(), 0); QCOMPARE(m_proxy->rowCount(), 0); - QCOMPARE(m_proxy->rowLabels().count(), 0); + QCOMPARE(m_proxy->rowLabels().size(), 0); QVERIFY(!m_proxy->series()); QCOMPARE(m_proxy->type(), QAbstractDataProxy::DataTypeBar); @@ -99,9 +71,9 @@ void tst_proxy::initializeProperties() m_proxy->addRow(data); m_proxy->setRowLabels(QStringList() << "1"); - QCOMPARE(m_proxy->columnLabels().count(), 3); + QCOMPARE(m_proxy->columnLabels().size(), 3); QCOMPARE(m_proxy->rowCount(), 1); - QCOMPARE(m_proxy->rowLabels().count(), 1); + QCOMPARE(m_proxy->rowLabels().size(), 1); } QTEST_MAIN(tst_proxy) diff --git a/tests/auto/cpptest/q3dbars-series/CMakeLists.txt b/tests/auto/cpptest/q3dbars-series/CMakeLists.txt new file mode 100644 index 00000000..f160c81c --- /dev/null +++ b/tests/auto/cpptest/q3dbars-series/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dbars-series_datavis + SOURCES + tst_series.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dbars-series/q3dbars-series.pro b/tests/auto/cpptest/q3dbars-series/q3dbars-series.pro deleted file mode 100644 index 481653ef..00000000 --- a/tests/auto/cpptest/q3dbars-series/q3dbars-series.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_series.cpp diff --git a/tests/auto/cpptest/q3dbars-series/tst_series.cpp b/tests/auto/cpptest/q3dbars-series/tst_series.cpp index a52ce9ef..6e0272ac 100644 --- a/tests/auto/cpptest/q3dbars-series/tst_series.cpp +++ b/tests/auto/cpptest/q3dbars-series/tst_series.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QBar3DSeries> -using namespace QtDataVisualization; - class tst_series: public QObject { Q_OBJECT @@ -92,6 +64,7 @@ void tst_series::initialProperties() QVERIFY(m_series->dataProxy()); QCOMPARE(m_series->meshAngle(), 0.0f); QCOMPARE(m_series->selectedBar(), m_series->invalidSelectionPosition()); + QCOMPARE(m_series->rowColors().size(), 0); // Common properties QCOMPARE(m_series->baseColor(), QColor(Qt::black)); @@ -134,6 +107,13 @@ void tst_series::initializeProperties() gradient3.setColorAt(0.0, Qt::white); gradient3.setColorAt(1.0, Qt::gray); + QList<QColor> rowColors; + rowColors.append(QColor(Qt::green)); + rowColors.append(QColor(Qt::blue)); + rowColors.append(QColor(Qt::red)); + + m_series->setRowColors(rowColors); + // Common properties m_series->setBaseColor(QColor(Qt::blue)); m_series->setBaseGradient(gradient1); @@ -167,6 +147,11 @@ void tst_series::initializeProperties() QCOMPARE(m_series->singleHighlightGradient().stops().at(0).second, QColor(Qt::white)); QCOMPARE(m_series->userDefinedMesh(), QString(":/customitem.obj")); QCOMPARE(m_series->isVisible(), false); + + QCOMPARE(m_series->rowColors().size(), 3); + QCOMPARE(m_series->rowColors().at(0), QColor(Qt::green)); + QCOMPARE(m_series->rowColors().at(1), QColor(Qt::blue)); + QCOMPARE(m_series->rowColors().at(2), QColor(Qt::red)); } void tst_series::invalidProperties() diff --git a/tests/auto/cpptest/q3dbars/CMakeLists.txt b/tests/auto/cpptest/q3dbars/CMakeLists.txt new file mode 100644 index 00000000..c2f05908 --- /dev/null +++ b/tests/auto/cpptest/q3dbars/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dbars_datavis + SOURCES + tst_bars.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dbars/q3dbars.pro b/tests/auto/cpptest/q3dbars/q3dbars.pro deleted file mode 100644 index bba500fa..00000000 --- a/tests/auto/cpptest/q3dbars/q3dbars.pro +++ /dev/null @@ -1,10 +0,0 @@ -include(../common/cpptestutil.pri) - -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_bars.cpp diff --git a/tests/auto/cpptest/q3dbars/tst_bars.cpp b/tests/auto/cpptest/q3dbars/tst_bars.cpp index 0d128c36..96219cb0 100644 --- a/tests/auto/cpptest/q3dbars/tst_bars.cpp +++ b/tests/auto/cpptest/q3dbars/tst_bars.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -36,8 +10,6 @@ #include "cpptestutil.h" -using namespace QtDataVisualization; - class tst_bars: public QObject { Q_OBJECT @@ -59,6 +31,7 @@ private slots: void selectSeries(); void removeSeries(); void removeMultipleSeries(); + void hasSeries(); // The following tests are not required for scatter or surface, as they are handled identically void addInputHandler(); @@ -123,8 +96,9 @@ void tst_bars::initialProperties() QCOMPARE(m_graph->isMultiSeriesUniform(), false); QCOMPARE(m_graph->barThickness(), 1.0); QCOMPARE(m_graph->barSpacing(), QSizeF(1.0f, 1.0f)); + QCOMPARE(m_graph->barSeriesMargin(), QSizeF(0.0f, 0.0f)); QCOMPARE(m_graph->isBarSpacingRelative(), true); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); QVERIFY(!m_graph->selectedSeries()); QVERIFY(!m_graph->primarySeries()); QCOMPARE(m_graph->floorLevel(), 0.0); @@ -159,12 +133,14 @@ void tst_bars::initializeProperties() m_graph->setMultiSeriesUniform(true); m_graph->setBarThickness(0.2f); m_graph->setBarSpacing(QSizeF(0.1f, 0.1f)); + m_graph->setBarSeriesMargin(QSizeF(0.3f, 0.3f)); m_graph->setBarSpacingRelative(false); m_graph->setFloorLevel(1.0f); QCOMPARE(m_graph->isMultiSeriesUniform(), true); QCOMPARE(m_graph->barThickness(), 0.2f); QCOMPARE(m_graph->barSpacing(), QSizeF(0.1f, 0.1f)); + QCOMPARE(m_graph->barSeriesMargin(), QSizeF(0.3f, 0.3f)); QCOMPARE(m_graph->isBarSpacingRelative(), false); QCOMPARE(m_graph->floorLevel(), 1.0f); @@ -210,9 +186,9 @@ void tst_bars::invalidProperties() m_graph->setLocale(QLocale("XX")); QCOMPARE(m_graph->selectionMode(), QAbstract3DGraph::SelectionItem); - QCOMPARE(m_graph->aspectRatio(), -1.0/*2.0*/); // TODO: Fix once QTRD-3367 is done - QCOMPARE(m_graph->horizontalAspectRatio(), -1.0/*0.0*/); // TODO: Fix once QTRD-3367 is done - QCOMPARE(m_graph->reflectivity(), -1.0/*0.5*/); // TODO: Fix once QTRD-3367 is done + QCOMPARE(m_graph->aspectRatio(), 2.0); + QCOMPARE(m_graph->horizontalAspectRatio(), 0.0); + QCOMPARE(m_graph->reflectivity(), 0.5); QCOMPARE(m_graph->locale(), QLocale("C")); } @@ -222,7 +198,7 @@ void tst_bars::addSeries() m_graph->addSeries(series); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); QVERIFY(!m_graph->selectedSeries()); QCOMPARE(m_graph->primarySeries(), series); } @@ -237,7 +213,7 @@ void tst_bars::addMultipleSeries() m_graph->addSeries(series2); m_graph->addSeries(series3); - QCOMPARE(m_graph->seriesList().length(), 3); + QCOMPARE(m_graph->seriesList().size(), 3); QCOMPARE(m_graph->primarySeries(), series); m_graph->setPrimarySeries(series2); @@ -252,7 +228,7 @@ void tst_bars::selectSeries() m_graph->addSeries(series); m_graph->primarySeries()->setSelectedBar(QPoint(0, 0)); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); QCOMPARE(m_graph->selectedSeries(), series); m_graph->clearSelection(); @@ -265,7 +241,7 @@ void tst_bars::removeSeries() m_graph->addSeries(series); m_graph->removeSeries(series); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); delete series; } @@ -283,22 +259,31 @@ void tst_bars::removeMultipleSeries() QCOMPARE(m_graph->selectedSeries(), series); m_graph->removeSeries(series); - QCOMPARE(m_graph->seriesList().length(), 2); + QCOMPARE(m_graph->seriesList().size(), 2); QCOMPARE(m_graph->primarySeries(), series2); QVERIFY(!m_graph->selectedSeries()); m_graph->removeSeries(series2); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); QCOMPARE(m_graph->primarySeries(), series3); m_graph->removeSeries(series3); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); delete series; delete series2; delete series3; } +void tst_bars::hasSeries() +{ + QBar3DSeries *series1 = newSeries(); + m_graph->addSeries(series1); + QCOMPARE(m_graph->hasSeries(series1), true); + QBar3DSeries *series2 = newSeries(); + QCOMPARE(m_graph->hasSeries(series2), false); +} + // The following tests are not required for scatter or surface, as they are handled identically void tst_bars::addInputHandler() { @@ -309,14 +294,14 @@ void tst_bars::addInputHandler() m_graph->addInputHandler(handler); m_graph->addInputHandler(handler2); - QCOMPARE(m_graph->inputHandlers().length(), 3); // Default, as it is still active, plus added ones + QCOMPARE(m_graph->inputHandlers().size(), 3); // Default, as it is still active, plus added ones QCOMPARE(m_graph->activeInputHandler(), initialHandler); m_graph->setActiveInputHandler(handler2); QCOMPARE(m_graph->activeInputHandler(), handler2); m_graph->setActiveInputHandler(NULL); QVERIFY(!m_graph->activeInputHandler()); - QCOMPARE(m_graph->inputHandlers().length(), 2); + QCOMPARE(m_graph->inputHandlers().size(), 2); } void tst_bars::removeInputHandler() @@ -328,12 +313,12 @@ void tst_bars::removeInputHandler() m_graph->addInputHandler(handler2); m_graph->setActiveInputHandler(handler2); - QCOMPARE(m_graph->inputHandlers().length(), 2); // Default handler removed by previous call + QCOMPARE(m_graph->inputHandlers().size(), 2); // Default handler removed by previous call QCOMPARE(m_graph->activeInputHandler(), handler2); m_graph->releaseInputHandler(handler2); - QCOMPARE(m_graph->inputHandlers().length(), 1); + QCOMPARE(m_graph->inputHandlers().size(), 1); m_graph->releaseInputHandler(handler); - QCOMPARE(m_graph->inputHandlers().length(), 0); + QCOMPARE(m_graph->inputHandlers().size(), 0); delete handler2; delete handler; @@ -347,7 +332,7 @@ void tst_bars::addTheme() m_graph->addTheme(theme); m_graph->addTheme(theme2); - QCOMPARE(m_graph->themes().length(), 3); // Default, plus added ones + QCOMPARE(m_graph->themes().size(), 3); // Default, plus added ones QCOMPARE(m_graph->activeTheme(), initialTheme); m_graph->setActiveTheme(theme2); QCOMPARE(m_graph->activeTheme(), theme2); @@ -363,9 +348,9 @@ void tst_bars::removeTheme() m_graph->setActiveTheme(theme2); QCOMPARE(m_graph->activeTheme(), theme2); m_graph->releaseTheme(theme2); - QCOMPARE(m_graph->themes().length(), 2); + QCOMPARE(m_graph->themes().size(), 2); m_graph->releaseTheme(theme); - QCOMPARE(m_graph->themes().length(), 1); // Default theme remains + QCOMPARE(m_graph->themes().size(), 1); // Default theme remains delete theme2; delete theme; @@ -377,9 +362,9 @@ void tst_bars::addCustomItem() QCustom3DItem *item2 = new QCustom3DItem(); m_graph->addCustomItem(item); - QCOMPARE(m_graph->customItems().length(), 1); + QCOMPARE(m_graph->customItems().size(), 1); m_graph->addCustomItem(item2); - QCOMPARE(m_graph->customItems().length(), 2); + QCOMPARE(m_graph->customItems().size(), 2); } void tst_bars::removeCustomItem() @@ -394,14 +379,14 @@ void tst_bars::removeCustomItem() m_graph->addCustomItem(item3); m_graph->releaseCustomItem(item); - QCOMPARE(m_graph->customItems().length(), 2); + QCOMPARE(m_graph->customItems().size(), 2); m_graph->removeCustomItem(item2); - QCOMPARE(m_graph->customItems().length(), 1); + QCOMPARE(m_graph->customItems().size(), 1); m_graph->addCustomItem(item); m_graph->removeCustomItemAt(QVector3D(1, 1, 1)); - QCOMPARE(m_graph->customItems().length(), 1); + QCOMPARE(m_graph->customItems().size(), 1); m_graph->removeCustomItems(); - QCOMPARE(m_graph->customItems().length(), 0); + QCOMPARE(m_graph->customItems().size(), 0); } void tst_bars::renderToImage() diff --git a/tests/auto/cpptest/q3dcustom-label/CMakeLists.txt b/tests/auto/cpptest/q3dcustom-label/CMakeLists.txt new file mode 100644 index 00000000..3baea7fa --- /dev/null +++ b/tests/auto/cpptest/q3dcustom-label/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dcustom-label_datavis + SOURCES + tst_custom.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dcustom-label/q3dcustom-label.pro b/tests/auto/cpptest/q3dcustom-label/q3dcustom-label.pro deleted file mode 100644 index c47e018a..00000000 --- a/tests/auto/cpptest/q3dcustom-label/q3dcustom-label.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../common/cpptestutil.pri) -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_custom.cpp diff --git a/tests/auto/cpptest/q3dcustom-label/tst_custom.cpp b/tests/auto/cpptest/q3dcustom-label/tst_custom.cpp index 44c9d2b2..6914031f 100644 --- a/tests/auto/cpptest/q3dcustom-label/tst_custom.cpp +++ b/tests/auto/cpptest/q3dcustom-label/tst_custom.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -33,8 +7,6 @@ #include "cpptestutil.h" -using namespace QtDataVisualization; - class tst_custom: public QObject { Q_OBJECT @@ -81,8 +53,8 @@ void tst_custom::construct() QVERIFY(custom); delete custom; - custom = new QCustom3DLabel("label", QFont("Times New Roman", 10.0), QVector3D(1.0, 1.0, 1.0), - QVector3D(1.0, 1.0, 1.0), QQuaternion(1.0, 1.0, 10.0, 100.0)); + custom = new QCustom3DLabel("label", QFont("Times New Roman", 10.0), QVector3D(1.0f, 1.0f, 1.0f), + QVector3D(1.0f, 1.0f, 1.0f), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); QVERIFY(custom); QCOMPARE(custom->backgroundColor(), QColor(Qt::gray)); QCOMPARE(custom->isBackgroundEnabled(), true); @@ -92,10 +64,10 @@ void tst_custom::construct() QCOMPARE(custom->text(), QString("label")); QCOMPARE(custom->textColor(), QColor(Qt::white)); QCOMPARE(custom->meshFile(), QString(":/defaultMeshes/plane")); - QCOMPARE(custom->position(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(custom->position(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(custom->isPositionAbsolute(), false); - QCOMPARE(custom->rotation(), QQuaternion(1.0, 1.0, 10.0, 100.0)); - QCOMPARE(custom->scaling(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + QCOMPARE(custom->scaling(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(custom->isScalingAbsolute(), true); QCOMPARE(custom->isShadowCasting(), false); QCOMPARE(custom->textureFile(), QString()); @@ -148,17 +120,17 @@ void tst_custom::initializeProperties() QCOMPARE(m_custom->textColor(), QColor(Qt::blue)); // Common (from QCustom3DItem) - m_custom->setPosition(QVector3D(1.0, 1.0, 1.0)); + m_custom->setPosition(QVector3D(1.0f, 1.0f, 1.0f)); m_custom->setPositionAbsolute(true); - m_custom->setRotation(QQuaternion(1.0, 1.0, 10.0, 100.0)); - m_custom->setScaling(QVector3D(1.0, 1.0, 1.0)); + m_custom->setRotation(QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + m_custom->setScaling(QVector3D(1.0f, 1.0f, 1.0f)); m_custom->setShadowCasting(true); m_custom->setVisible(false); - QCOMPARE(m_custom->position(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(m_custom->position(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(m_custom->isPositionAbsolute(), true); - QCOMPARE(m_custom->rotation(), QQuaternion(1.0, 1.0, 10.0, 100.0)); - QCOMPARE(m_custom->scaling(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(m_custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + QCOMPARE(m_custom->scaling(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(m_custom->isShadowCasting(), true); QCOMPARE(m_custom->isVisible(), false); } diff --git a/tests/auto/cpptest/q3dcustom-volume/CMakeLists.txt b/tests/auto/cpptest/q3dcustom-volume/CMakeLists.txt new file mode 100644 index 00000000..858f2dfc --- /dev/null +++ b/tests/auto/cpptest/q3dcustom-volume/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dcustom-volume_datavis + SOURCES + tst_custom.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dcustom-volume/q3dcustom-volume.pro b/tests/auto/cpptest/q3dcustom-volume/q3dcustom-volume.pro deleted file mode 100644 index af584baa..00000000 --- a/tests/auto/cpptest/q3dcustom-volume/q3dcustom-volume.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_custom.cpp diff --git a/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp b/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp index 982353ac..21040df3 100644 --- a/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp +++ b/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QCustom3DVolume> -using namespace QtDataVisualization; - class tst_custom: public QObject { Q_OBJECT @@ -82,8 +54,8 @@ void tst_custom::construct() QList<QRgb> table; table << QRgb(0xff00ff) << QRgb(0x00ff00); - custom = new QCustom3DVolume(QVector3D(1.0, 1.0, 1.0), QVector3D(1.0, 1.0, 1.0), - QQuaternion(1.0, 1.0, 10.0, 100.0), 10, 10, 10, + custom = new QCustom3DVolume(QVector3D(1.0f, 1.0f, 1.0f), QVector3D(1.0f, 1.0f, 1.0f), + QQuaternion(1.0f, 1.0f, 10.0f, 100.0f), 10, 10, 10, tdata, QImage::Format_ARGB32, table); QVERIFY(custom); QCOMPARE(custom->alphaMultiplier(), 1.0f); @@ -98,17 +70,17 @@ void tst_custom::construct() QCOMPARE(custom->sliceIndexY(), -1); QCOMPARE(custom->sliceIndexZ(), -1); QCOMPARE(custom->useHighDefShader(), true); - QCOMPARE(custom->textureData()->length(), 1000); + QCOMPARE(custom->textureData()->size(), 1000); QCOMPARE(custom->textureDataWidth(), 40); QCOMPARE(custom->textureFormat(), QImage::Format_ARGB32); QCOMPARE(custom->textureHeight(), 10); QCOMPARE(custom->textureWidth(), 10); QCOMPARE(custom->textureDepth(), 10); QCOMPARE(custom->meshFile(), QString(":/defaultMeshes/barFull")); - QCOMPARE(custom->position(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(custom->position(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(custom->isPositionAbsolute(), false); - QCOMPARE(custom->rotation(), QQuaternion(1.0, 1.0, 10.0, 100.0)); - QCOMPARE(custom->scaling(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + QCOMPARE(custom->scaling(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(custom->isScalingAbsolute(), true); QCOMPARE(custom->isShadowCasting(), false); QCOMPARE(custom->textureFile(), QString()); @@ -176,18 +148,18 @@ void tst_custom::initializeProperties() QCOMPARE(m_custom->useHighDefShader(), false); // Common (from QCustom3DVolume) - m_custom->setPosition(QVector3D(1.0, 1.0, 1.0)); + m_custom->setPosition(QVector3D(1.0f, 1.0f, 1.0f)); m_custom->setPositionAbsolute(true); - m_custom->setRotation(QQuaternion(1.0, 1.0, 10.0, 100.0)); - m_custom->setScaling(QVector3D(1.0, 1.0, 1.0)); + m_custom->setRotation(QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + m_custom->setScaling(QVector3D(1.0f, 1.0f, 1.0f)); m_custom->setScalingAbsolute(false); m_custom->setShadowCasting(false); m_custom->setVisible(false); - QCOMPARE(m_custom->position(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(m_custom->position(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(m_custom->isPositionAbsolute(), true); - QCOMPARE(m_custom->rotation(), QQuaternion(1.0, 1.0, 10.0, 100.0)); - QCOMPARE(m_custom->scaling(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(m_custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + QCOMPARE(m_custom->scaling(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(m_custom->isScalingAbsolute(), false); QCOMPARE(m_custom->isShadowCasting(), false); QCOMPARE(m_custom->isVisible(), false); diff --git a/tests/auto/cpptest/q3dcustom/CMakeLists.txt b/tests/auto/cpptest/q3dcustom/CMakeLists.txt new file mode 100644 index 00000000..4126a884 --- /dev/null +++ b/tests/auto/cpptest/q3dcustom/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dcustom_datavis + SOURCES + tst_custom.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dcustom/q3dcustom.pro b/tests/auto/cpptest/q3dcustom/q3dcustom.pro deleted file mode 100644 index af584baa..00000000 --- a/tests/auto/cpptest/q3dcustom/q3dcustom.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_custom.cpp diff --git a/tests/auto/cpptest/q3dcustom/tst_custom.cpp b/tests/auto/cpptest/q3dcustom/tst_custom.cpp index 94e32c62..05e09f98 100644 --- a/tests/auto/cpptest/q3dcustom/tst_custom.cpp +++ b/tests/auto/cpptest/q3dcustom/tst_custom.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QCustom3DItem> -using namespace QtDataVisualization; - class tst_custom: public QObject { Q_OBJECT @@ -76,15 +48,15 @@ void tst_custom::construct() QVERIFY(custom); delete custom; - custom = new QCustom3DItem(":/customitem.obj", QVector3D(1.0, 1.0, 1.0), - QVector3D(1.0, 1.0, 1.0), QQuaternion(1.0, 1.0, 10.0, 100.0), + custom = new QCustom3DItem(":/customitem.obj", QVector3D(1.0f, 1.0f, 1.0f), + QVector3D(1.0f, 1.0f, 1.0f), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f), QImage(":/customtexture.jpg")); QVERIFY(custom); QCOMPARE(custom->meshFile(), QString(":/customitem.obj")); - QCOMPARE(custom->position(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(custom->position(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(custom->isPositionAbsolute(), false); - QCOMPARE(custom->rotation(), QQuaternion(1.0, 1.0, 10.0, 100.0)); - QCOMPARE(custom->scaling(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + QCOMPARE(custom->scaling(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(custom->isScalingAbsolute(), true); QCOMPARE(custom->isShadowCasting(), true); QCOMPARE(custom->textureFile(), QString()); @@ -112,20 +84,20 @@ void tst_custom::initializeProperties() QVERIFY(m_custom); m_custom->setMeshFile(":/customitem.obj"); - m_custom->setPosition(QVector3D(1.0, 1.0, 1.0)); + m_custom->setPosition(QVector3D(1.0f, 1.0f, 1.0f)); m_custom->setPositionAbsolute(true); - m_custom->setRotation(QQuaternion(1.0, 1.0, 10.0, 100.0)); - m_custom->setScaling(QVector3D(1.0, 1.0, 1.0)); + m_custom->setRotation(QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + m_custom->setScaling(QVector3D(1.0f, 1.0f, 1.0f)); m_custom->setScalingAbsolute(false); m_custom->setShadowCasting(false); m_custom->setTextureFile(":/customtexture.jpg"); m_custom->setVisible(false); QCOMPARE(m_custom->meshFile(), QString(":/customitem.obj")); - QCOMPARE(m_custom->position(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(m_custom->position(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(m_custom->isPositionAbsolute(), true); - QCOMPARE(m_custom->rotation(), QQuaternion(1.0, 1.0, 10.0, 100.0)); - QCOMPARE(m_custom->scaling(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(m_custom->rotation(), QQuaternion(1.0f, 1.0f, 10.0f, 100.0f)); + QCOMPARE(m_custom->scaling(), QVector3D(1.0f, 1.0f, 1.0f)); QCOMPARE(m_custom->isScalingAbsolute(), false); QCOMPARE(m_custom->isShadowCasting(), false); QCOMPARE(m_custom->textureFile(), QString(":/customtexture.jpg")); diff --git a/tests/auto/cpptest/q3dinput-touch/CMakeLists.txt b/tests/auto/cpptest/q3dinput-touch/CMakeLists.txt new file mode 100644 index 00000000..7550bf2b --- /dev/null +++ b/tests/auto/cpptest/q3dinput-touch/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dinput-touch_datavis + SOURCES + tst_input.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dinput-touch/q3dinput-touch.pro b/tests/auto/cpptest/q3dinput-touch/q3dinput-touch.pro deleted file mode 100644 index 2de48158..00000000 --- a/tests/auto/cpptest/q3dinput-touch/q3dinput-touch.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_input.cpp diff --git a/tests/auto/cpptest/q3dinput-touch/tst_input.cpp b/tests/auto/cpptest/q3dinput-touch/tst_input.cpp index f33b20da..6a11741c 100644 --- a/tests/auto/cpptest/q3dinput-touch/tst_input.cpp +++ b/tests/auto/cpptest/q3dinput-touch/tst_input.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QTouch3DInputHandler> -using namespace QtDataVisualization; - class tst_input: public QObject { Q_OBJECT diff --git a/tests/auto/cpptest/q3dinput/CMakeLists.txt b/tests/auto/cpptest/q3dinput/CMakeLists.txt new file mode 100644 index 00000000..ac0fe9a9 --- /dev/null +++ b/tests/auto/cpptest/q3dinput/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dinput_datavis + SOURCES + tst_input.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dinput/q3dinput.pro b/tests/auto/cpptest/q3dinput/q3dinput.pro deleted file mode 100644 index 2de48158..00000000 --- a/tests/auto/cpptest/q3dinput/q3dinput.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_input.cpp diff --git a/tests/auto/cpptest/q3dinput/tst_input.cpp b/tests/auto/cpptest/q3dinput/tst_input.cpp index 16861a91..95912b8a 100644 --- a/tests/auto/cpptest/q3dinput/tst_input.cpp +++ b/tests/auto/cpptest/q3dinput/tst_input.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/Q3DInputHandler> -using namespace QtDataVisualization; - class tst_input: public QObject { Q_OBJECT diff --git a/tests/auto/cpptest/q3dscatter-modelproxy/CMakeLists.txt b/tests/auto/cpptest/q3dscatter-modelproxy/CMakeLists.txt new file mode 100644 index 00000000..438c05f8 --- /dev/null +++ b/tests/auto/cpptest/q3dscatter-modelproxy/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dscatter-modelproxy_datavis + SOURCES + tst_proxy.cpp + LIBRARIES + Qt::Gui + Qt::Widgets + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dscatter-modelproxy/q3dscatter-modelproxy.pro b/tests/auto/cpptest/q3dscatter-modelproxy/q3dscatter-modelproxy.pro deleted file mode 100644 index c383ec25..00000000 --- a/tests/auto/cpptest/q3dscatter-modelproxy/q3dscatter-modelproxy.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization widgets - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_proxy.cpp diff --git a/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp b/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp index 55fb2333..d6950f1f 100644 --- a/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -33,8 +7,6 @@ #include <QtDataVisualization/Q3DScatter> #include <QtWidgets/QTableWidget> -using namespace QtDataVisualization; - class tst_proxy: public QObject { Q_OBJECT @@ -109,16 +81,16 @@ void tst_proxy::initialProperties() QVERIFY(!m_proxy->itemModel()); QCOMPARE(m_proxy->rotationRole(), QString()); - QCOMPARE(m_proxy->rotationRolePattern(), QRegExp()); + QCOMPARE(m_proxy->rotationRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->rotationRoleReplace(), QString()); QCOMPARE(m_proxy->xPosRole(), QString()); - QCOMPARE(m_proxy->xPosRolePattern(), QRegExp()); + QCOMPARE(m_proxy->xPosRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->xPosRoleReplace(), QString()); QCOMPARE(m_proxy->yPosRole(), QString()); - QCOMPARE(m_proxy->yPosRolePattern(), QRegExp()); + QCOMPARE(m_proxy->yPosRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->yPosRoleReplace(), QString()); QCOMPARE(m_proxy->zPosRole(), QString()); - QCOMPARE(m_proxy->zPosRolePattern(), QRegExp()); + QCOMPARE(m_proxy->zPosRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->zPosRoleReplace(), QString()); QCOMPARE(m_proxy->itemCount(), 0); @@ -135,30 +107,30 @@ void tst_proxy::initializeProperties() m_proxy->setItemModel(table.model()); m_proxy->setRotationRole("rotation"); - m_proxy->setRotationRolePattern(QRegExp("/-/")); + m_proxy->setRotationRolePattern(QRegularExpression("/-/")); m_proxy->setRotationRoleReplace("\\\\1"); m_proxy->setXPosRole("X"); - m_proxy->setXPosRolePattern(QRegExp("/-/")); + m_proxy->setXPosRolePattern(QRegularExpression("/-/")); m_proxy->setXPosRoleReplace("\\\\1"); m_proxy->setYPosRole("Y"); - m_proxy->setYPosRolePattern(QRegExp("/-/")); + m_proxy->setYPosRolePattern(QRegularExpression("/-/")); m_proxy->setYPosRoleReplace("\\\\1"); m_proxy->setZPosRole("Z"); - m_proxy->setZPosRolePattern(QRegExp("/-/")); + m_proxy->setZPosRolePattern(QRegularExpression("/-/")); m_proxy->setZPosRoleReplace("\\\\1"); QVERIFY(m_proxy->itemModel()); QCOMPARE(m_proxy->rotationRole(), QString("rotation")); - QCOMPARE(m_proxy->rotationRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->rotationRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->rotationRoleReplace(), QString("\\\\1")); QCOMPARE(m_proxy->xPosRole(), QString("X")); - QCOMPARE(m_proxy->xPosRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->xPosRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->xPosRoleReplace(), QString("\\\\1")); QCOMPARE(m_proxy->yPosRole(), QString("Y")); - QCOMPARE(m_proxy->yPosRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->yPosRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->yPosRoleReplace(), QString("\\\\1")); QCOMPARE(m_proxy->zPosRole(), QString("Z")); - QCOMPARE(m_proxy->zPosRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->zPosRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->zPosRoleReplace(), QString("\\\\1")); } @@ -184,12 +156,13 @@ void tst_proxy::addModel() m_proxy->setItemModel(table.model()); m_proxy->setXPosRole(table.model()->roleNames().value(Qt::DisplayRole)); m_proxy->setZPosRole(table.model()->roleNames().value(Qt::DisplayRole)); - m_proxy->setXPosRolePattern(QRegExp(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setXPosRolePattern(QRegularExpression(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setXPosRoleReplace(QStringLiteral("\\2")); - m_proxy->setYPosRolePattern(QRegExp(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setYPosRolePattern(QRegularExpression(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setYPosRoleReplace(QStringLiteral("\\3")); - m_proxy->setZPosRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setZPosRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setZPosRoleReplace(QStringLiteral("\\1")); + QCoreApplication::processEvents(); QScatter3DSeries *series = new QScatter3DSeries(m_proxy); Q_UNUSED(series); diff --git a/tests/auto/cpptest/q3dscatter-proxy/CMakeLists.txt b/tests/auto/cpptest/q3dscatter-proxy/CMakeLists.txt new file mode 100644 index 00000000..c813e9fb --- /dev/null +++ b/tests/auto/cpptest/q3dscatter-proxy/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dscatter-proxy_datavis + SOURCES + tst_proxy.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dscatter-proxy/q3dscatter-proxy.pro b/tests/auto/cpptest/q3dscatter-proxy/q3dscatter-proxy.pro deleted file mode 100644 index b0b5d361..00000000 --- a/tests/auto/cpptest/q3dscatter-proxy/q3dscatter-proxy.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_proxy.cpp diff --git a/tests/auto/cpptest/q3dscatter-proxy/tst_proxy.cpp b/tests/auto/cpptest/q3dscatter-proxy/tst_proxy.cpp index 3ca07aa2..e2633225 100644 --- a/tests/auto/cpptest/q3dscatter-proxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dscatter-proxy/tst_proxy.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QScatterDataProxy> -using namespace QtDataVisualization; - class tst_proxy: public QObject { Q_OBJECT diff --git a/tests/auto/cpptest/q3dscatter-series/CMakeLists.txt b/tests/auto/cpptest/q3dscatter-series/CMakeLists.txt new file mode 100644 index 00000000..c2eb2c4a --- /dev/null +++ b/tests/auto/cpptest/q3dscatter-series/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dscatter-series_datavis + SOURCES + tst_series.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dscatter-series/q3dscatter-series.pro b/tests/auto/cpptest/q3dscatter-series/q3dscatter-series.pro deleted file mode 100644 index 481653ef..00000000 --- a/tests/auto/cpptest/q3dscatter-series/q3dscatter-series.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_series.cpp diff --git a/tests/auto/cpptest/q3dscatter-series/tst_series.cpp b/tests/auto/cpptest/q3dscatter-series/tst_series.cpp index eef9f908..c0c23b07 100644 --- a/tests/auto/cpptest/q3dscatter-series/tst_series.cpp +++ b/tests/auto/cpptest/q3dscatter-series/tst_series.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QScatter3DSeries> -using namespace QtDataVisualization; - class tst_series: public QObject { Q_OBJECT diff --git a/tests/auto/cpptest/q3dscatter/CMakeLists.txt b/tests/auto/cpptest/q3dscatter/CMakeLists.txt new file mode 100644 index 00000000..176fb66e --- /dev/null +++ b/tests/auto/cpptest/q3dscatter/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dscatter_datavis + SOURCES + tst_scatter.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dscatter/q3dscatter.pro b/tests/auto/cpptest/q3dscatter/q3dscatter.pro deleted file mode 100644 index 6c94fe64..00000000 --- a/tests/auto/cpptest/q3dscatter/q3dscatter.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../common/cpptestutil.pri) -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_scatter.cpp diff --git a/tests/auto/cpptest/q3dscatter/tst_scatter.cpp b/tests/auto/cpptest/q3dscatter/tst_scatter.cpp index 64561340..f6ac402e 100644 --- a/tests/auto/cpptest/q3dscatter/tst_scatter.cpp +++ b/tests/auto/cpptest/q3dscatter/tst_scatter.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -33,8 +7,6 @@ #include "cpptestutil.h" -using namespace QtDataVisualization; - class tst_scatter: public QObject { Q_OBJECT @@ -56,6 +28,7 @@ private slots: void selectSeries(); void removeSeries(); void removeMultipleSeries(); + void hasSeries(); private: Q3DScatter *m_graph; @@ -105,7 +78,7 @@ void tst_scatter::construct() void tst_scatter::initialProperties() { QVERIFY(m_graph); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); QVERIFY(!m_graph->selectedSeries()); QCOMPARE(m_graph->axisX()->orientation(), QAbstract3DAxis::AxisOrientationX); QCOMPARE(m_graph->axisY()->orientation(), QAbstract3DAxis::AxisOrientationY); @@ -175,9 +148,9 @@ void tst_scatter::invalidProperties() m_graph->setLocale(QLocale("XX")); QCOMPARE(m_graph->selectionMode(), QAbstract3DGraph::SelectionItem); - QCOMPARE(m_graph->aspectRatio(), -1.0/*2.0*/); // TODO: Fix once QTRD-3367 is done - QCOMPARE(m_graph->horizontalAspectRatio(), -1.0/*0.0*/); // TODO: Fix once QTRD-3367 is done - QCOMPARE(m_graph->reflectivity(), -1.0/*0.5*/); // TODO: Fix once QTRD-3367 is done + QCOMPARE(m_graph->aspectRatio(), 2.0); + QCOMPARE(m_graph->horizontalAspectRatio(), 0.0); + QCOMPARE(m_graph->reflectivity(), 0.5); QCOMPARE(m_graph->locale(), QLocale("C")); } @@ -185,7 +158,7 @@ void tst_scatter::addSeries() { m_graph->addSeries(newSeries()); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); QVERIFY(!m_graph->selectedSeries()); } @@ -199,7 +172,7 @@ void tst_scatter::addMultipleSeries() m_graph->addSeries(series2); m_graph->addSeries(series3); - QCOMPARE(m_graph->seriesList().length(), 3); + QCOMPARE(m_graph->seriesList().size(), 3); } void tst_scatter::selectSeries() @@ -209,7 +182,7 @@ void tst_scatter::selectSeries() m_graph->addSeries(series); m_graph->seriesList()[0]->setSelectedItem(1); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); QCOMPARE(m_graph->selectedSeries(), series); m_graph->clearSelection(); @@ -222,7 +195,7 @@ void tst_scatter::removeSeries() m_graph->addSeries(series); m_graph->removeSeries(series); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); delete series; } @@ -241,19 +214,28 @@ void tst_scatter::removeMultipleSeries() QCOMPARE(m_graph->selectedSeries(), series); m_graph->removeSeries(series); - QCOMPARE(m_graph->seriesList().length(), 2); + QCOMPARE(m_graph->seriesList().size(), 2); QVERIFY(!m_graph->selectedSeries()); m_graph->removeSeries(series2); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); m_graph->removeSeries(series3); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); delete series; delete series2; delete series3; } +void tst_scatter::hasSeries() +{ + QScatter3DSeries *series1 = newSeries(); + m_graph->addSeries(series1); + QCOMPARE(m_graph->hasSeries(series1), true); + QScatter3DSeries *series2 = newSeries(); + QCOMPARE(m_graph->hasSeries(series2), false); +} + QTEST_MAIN(tst_scatter) #include "tst_scatter.moc" diff --git a/tests/auto/cpptest/q3dscene-camera/CMakeLists.txt b/tests/auto/cpptest/q3dscene-camera/CMakeLists.txt new file mode 100644 index 00000000..63cd964c --- /dev/null +++ b/tests/auto/cpptest/q3dscene-camera/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dscene-camera_datavis + SOURCES + tst_camera.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dscene-camera/q3dscene-camera.pro b/tests/auto/cpptest/q3dscene-camera/q3dscene-camera.pro deleted file mode 100644 index c575a55e..00000000 --- a/tests/auto/cpptest/q3dscene-camera/q3dscene-camera.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_camera.cpp diff --git a/tests/auto/cpptest/q3dscene-camera/tst_camera.cpp b/tests/auto/cpptest/q3dscene-camera/tst_camera.cpp index 0c92581d..8c8f4b45 100644 --- a/tests/auto/cpptest/q3dscene-camera/tst_camera.cpp +++ b/tests/auto/cpptest/q3dscene-camera/tst_camera.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/Q3DCamera> -using namespace QtDataVisualization; - class tst_camera: public QObject { Q_OBJECT @@ -87,7 +59,7 @@ void tst_camera::initialProperties() QCOMPARE(m_camera->cameraPreset(), Q3DCamera::CameraPresetNone); QCOMPARE(m_camera->maxZoomLevel(), 500.0f); QCOMPARE(m_camera->minZoomLevel(), 10.0f); - QCOMPARE(m_camera->target(), QVector3D(0.0, 0.0, 0.0)); + QCOMPARE(m_camera->target(), QVector3D(0.0f, 0.0f, 0.0f)); QCOMPARE(m_camera->wrapXRotation(), true); QCOMPARE(m_camera->wrapYRotation(), false); QCOMPARE(m_camera->xRotation(), 0.0f); @@ -105,7 +77,7 @@ void tst_camera::initializeProperties() m_camera->setMaxZoomLevel(1000.0f); m_camera->setMinZoomLevel(100.0f); - m_camera->setTarget(QVector3D(1.0, -1.0, 1.0)); + m_camera->setTarget(QVector3D(1.0f, -1.0f, 1.0f)); m_camera->setWrapXRotation(false); m_camera->setWrapYRotation(true); m_camera->setXRotation(30.0f); @@ -114,26 +86,26 @@ void tst_camera::initializeProperties() QCOMPARE(m_camera->maxZoomLevel(), 1000.0f); QCOMPARE(m_camera->minZoomLevel(), 100.0f); - QCOMPARE(m_camera->target(), QVector3D(1.0, -1.0, 1.0)); + QCOMPARE(m_camera->target(), QVector3D(1.0f, -1.0f, 1.0f)); QCOMPARE(m_camera->wrapXRotation(), false); QCOMPARE(m_camera->wrapYRotation(), true); QCOMPARE(m_camera->xRotation(), 30.0f); QCOMPARE(m_camera->yRotation(), 30.0f); QCOMPARE(m_camera->zoomLevel(), 500.0f); - m_camera->setPosition(QVector3D(1.0, 1.0, 1.0)); + m_camera->setPosition(QVector3D(1.0f, 1.0f, 1.0f)); // Common (from Q3DObject) - QCOMPARE(m_camera->position(), QVector3D(1.0, 1.0, 1.0)); + QCOMPARE(m_camera->position(), QVector3D(1.0f, 1.0f, 1.0f)); } void tst_camera::invalidProperties() { - m_camera->setTarget(QVector3D(-1.5, -1.5, -1.5)); - QCOMPARE(m_camera->target(), QVector3D(-1.0, -1.0, -1.0)); + m_camera->setTarget(QVector3D(-1.5f, -1.5f, -1.5f)); + QCOMPARE(m_camera->target(), QVector3D(-1.0f, -1.0f, -1.0f)); - m_camera->setTarget(QVector3D(1.5, 1.5, 1.5)); - QCOMPARE(m_camera->target(), QVector3D(1.0, 1.0, 1.0)); + m_camera->setTarget(QVector3D(1.5f, 1.5f, 1.5f)); + QCOMPARE(m_camera->target(), QVector3D(1.0f, 1.0f, 1.0f)); m_camera->setMinZoomLevel(0.1f); QCOMPARE(m_camera->minZoomLevel(), 1.0f); @@ -144,7 +116,7 @@ void tst_camera::changePresets() m_camera->setCameraPreset(Q3DCamera::CameraPresetBehind); // Will be overridden by the the following sets m_camera->setMaxZoomLevel(1000.0f); m_camera->setMinZoomLevel(100.0f); - m_camera->setTarget(QVector3D(1.0, -1.0, 1.0)); + m_camera->setTarget(QVector3D(1.0f, -1.0f, 1.0f)); m_camera->setWrapXRotation(false); m_camera->setWrapYRotation(true); m_camera->setXRotation(30.0f); @@ -154,7 +126,7 @@ void tst_camera::changePresets() QCOMPARE(m_camera->cameraPreset(), Q3DCamera::CameraPresetNone); QCOMPARE(m_camera->maxZoomLevel(), 1000.0f); QCOMPARE(m_camera->minZoomLevel(), 100.0f); - QCOMPARE(m_camera->target(), QVector3D(1.0, -1.0, 1.0)); + QCOMPARE(m_camera->target(), QVector3D(1.0f, -1.0f, 1.0f)); QCOMPARE(m_camera->wrapXRotation(), false); QCOMPARE(m_camera->wrapYRotation(), true); QCOMPARE(m_camera->xRotation(), 30.0f); @@ -166,7 +138,7 @@ void tst_camera::changePresets() QCOMPARE(m_camera->cameraPreset(), Q3DCamera::CameraPresetBehind); QCOMPARE(m_camera->maxZoomLevel(), 1000.0f); QCOMPARE(m_camera->minZoomLevel(), 100.0f); - QCOMPARE(m_camera->target(), QVector3D(0.0, 0.0, 0.0)); + QCOMPARE(m_camera->target(), QVector3D(0.0f, 0.0f, 0.0f)); QCOMPARE(m_camera->wrapXRotation(), false); QCOMPARE(m_camera->wrapYRotation(), true); QCOMPARE(m_camera->xRotation(), 180.0f); @@ -178,7 +150,7 @@ void tst_camera::changePresets() QCOMPARE(m_camera->cameraPreset(), Q3DCamera::CameraPresetNone); QCOMPARE(m_camera->maxZoomLevel(), 1000.0f); QCOMPARE(m_camera->minZoomLevel(), 100.0f); - QCOMPARE(m_camera->target(), QVector3D(0.0, 0.0, 0.0)); + QCOMPARE(m_camera->target(), QVector3D(0.0f, 0.0f, 0.0f)); QCOMPARE(m_camera->wrapXRotation(), false); QCOMPARE(m_camera->wrapYRotation(), true); QCOMPARE(m_camera->xRotation(), 10.0f); diff --git a/tests/auto/cpptest/q3dscene-light/CMakeLists.txt b/tests/auto/cpptest/q3dscene-light/CMakeLists.txt new file mode 100644 index 00000000..fc70b804 --- /dev/null +++ b/tests/auto/cpptest/q3dscene-light/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dscene-light_datavis + SOURCES + tst_light.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dscene-light/q3dscene-light.pro b/tests/auto/cpptest/q3dscene-light/q3dscene-light.pro deleted file mode 100644 index 21a3c934..00000000 --- a/tests/auto/cpptest/q3dscene-light/q3dscene-light.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_light.cpp diff --git a/tests/auto/cpptest/q3dscene-light/tst_light.cpp b/tests/auto/cpptest/q3dscene-light/tst_light.cpp index d5eb4507..fb5ba325 100644 --- a/tests/auto/cpptest/q3dscene-light/tst_light.cpp +++ b/tests/auto/cpptest/q3dscene-light/tst_light.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/Q3DLight> -using namespace QtDataVisualization; - class tst_light: public QObject { Q_OBJECT @@ -96,8 +68,8 @@ void tst_light::initializeProperties() QCOMPARE(m_light->isAutoPosition(), true); // Common (from Q3DObject) - m_light->setPosition(QVector3D(1.0, 1.0, 1.0)); - QCOMPARE(m_light->position(), QVector3D(1.0, 1.0, 1.0)); + m_light->setPosition(QVector3D(1.0f, 1.0f, 1.0f)); + QCOMPARE(m_light->position(), QVector3D(1.0f, 1.0f, 1.0f)); } QTEST_MAIN(tst_light) diff --git a/tests/auto/cpptest/q3dscene/CMakeLists.txt b/tests/auto/cpptest/q3dscene/CMakeLists.txt new file mode 100644 index 00000000..a7c25ff2 --- /dev/null +++ b/tests/auto/cpptest/q3dscene/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dscene_datavis + SOURCES + tst_scene.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dscene/q3dscene.pro b/tests/auto/cpptest/q3dscene/q3dscene.pro deleted file mode 100644 index b7a0110c..00000000 --- a/tests/auto/cpptest/q3dscene/q3dscene.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../common/cpptestutil.pri) -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_scene.cpp diff --git a/tests/auto/cpptest/q3dscene/tst_scene.cpp b/tests/auto/cpptest/q3dscene/tst_scene.cpp index 2b450f64..23d3392c 100644 --- a/tests/auto/cpptest/q3dscene/tst_scene.cpp +++ b/tests/auto/cpptest/q3dscene/tst_scene.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -34,8 +8,6 @@ #include "cpptestutil.h" -using namespace QtDataVisualization; - class tst_scene: public QObject { Q_OBJECT diff --git a/tests/auto/cpptest/q3dsurface-heightproxy/CMakeLists.txt b/tests/auto/cpptest/q3dsurface-heightproxy/CMakeLists.txt new file mode 100644 index 00000000..b7285b3a --- /dev/null +++ b/tests/auto/cpptest/q3dsurface-heightproxy/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dsurface-heightproxy_datavis + SOURCES + tst_proxy.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) + +set(q3dsurface-heightproxy_resource_files + "customtexture.jpg" +) + +qt_internal_add_resource(q3dsurface-heightproxy_datavis "q3dsurface-heightproxy" + PREFIX + "/" + FILES + ${q3dsurface-heightproxy_resource_files} +) diff --git a/tests/auto/cpptest/q3dsurface-heightproxy/q3dsurface-heightproxy.pro b/tests/auto/cpptest/q3dsurface-heightproxy/q3dsurface-heightproxy.pro deleted file mode 100644 index 56a964d0..00000000 --- a/tests/auto/cpptest/q3dsurface-heightproxy/q3dsurface-heightproxy.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_proxy.cpp - -RESOURCES += \ - q3dsurface-heightproxy.qrc diff --git a/tests/auto/cpptest/q3dsurface-heightproxy/tst_proxy.cpp b/tests/auto/cpptest/q3dsurface-heightproxy/tst_proxy.cpp index e031688c..2d28398a 100644 --- a/tests/auto/cpptest/q3dsurface-heightproxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dsurface-heightproxy/tst_proxy.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QHeightMapSurfaceDataProxy> -using namespace QtDataVisualization; - class tst_proxy: public QObject { Q_OBJECT @@ -80,6 +52,7 @@ void tst_proxy::construct() QImage image(QSize(10, 10), QImage::Format_ARGB32); image.fill(0); proxy = new QHeightMapSurfaceDataProxy(image); + QCoreApplication::processEvents(); QVERIFY(proxy); QCoreApplication::processEvents(); QCOMPARE(proxy->columnCount(), 10); @@ -87,6 +60,7 @@ void tst_proxy::construct() delete proxy; proxy = new QHeightMapSurfaceDataProxy(":/customtexture.jpg"); + QCoreApplication::processEvents(); QVERIFY(proxy); QCoreApplication::processEvents(); QCOMPARE(proxy->columnCount(), 24); diff --git a/tests/auto/cpptest/q3dsurface-modelproxy-nan/CMakeLists.txt b/tests/auto/cpptest/q3dsurface-modelproxy-nan/CMakeLists.txt new file mode 100644 index 00000000..835a3bad --- /dev/null +++ b/tests/auto/cpptest/q3dsurface-modelproxy-nan/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dsurface-modelproxy-nan_datavis + SOURCES + tst_proxy.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::Widgets + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dsurface-modelproxy-nan/tst_proxy.cpp b/tests/auto/cpptest/q3dsurface-modelproxy-nan/tst_proxy.cpp new file mode 100644 index 00000000..c6e0841a --- /dev/null +++ b/tests/auto/cpptest/q3dsurface-modelproxy-nan/tst_proxy.cpp @@ -0,0 +1,266 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtTest/QtTest> + +#include <QtDataVisualization/QItemModelSurfaceDataProxy> +#include <QtDataVisualization/Q3DSurface> + +#include "cpptestutil.h" + +class tst_proxy: public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + + void dataContainingNaNFirstRow(); + void dataContainingNaNLastRow(); + void dataContainingNaNFirstLastRow(); +}; + +void tst_proxy::initTestCase() +{ +} + +void tst_proxy::cleanupTestCase() +{ +} + +void tst_proxy::init() +{ +} + +void tst_proxy::cleanup() +{ +} + +void tst_proxy::dataContainingNaNFirstRow() +{ + if (!CpptestUtil::isOpenGLSupported()) + QSKIP("OpenGL not supported on this platform"); + + const int size = 10; + const int missingRow = 0; + + QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy(); + QSurface3DSeries *series = new QSurface3DSeries(proxy); + Q3DSurface *graph = new Q3DSurface(); + graph->addSeries(series); + + // X + QSurfaceDataArray *array = new QSurfaceDataArray(); + array->reserve(size); + for (int i = 0; i < size; i++) { + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D((i == missingRow) ? std::numeric_limits<float>::quiet_NaN() + : static_cast<float>(i), + qSin(static_cast<float>(i)), static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + + // Y + for (int i = 0; i < size; i++) { + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D(static_cast<float>(i), + (i == missingRow) ? std::numeric_limits<float>::quiet_NaN() + : qSin(static_cast<float>(i)), + static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + + // Z + for (int i = 0; i < size; i++) { + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D(static_cast<float>(i), + qSin(static_cast<float>(i)), + (i == missingRow) ? std::numeric_limits<float>::quiet_NaN() + : static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + + delete graph; + +} + +void tst_proxy::dataContainingNaNLastRow() +{ + if (!CpptestUtil::isOpenGLSupported()) + QSKIP("OpenGL not supported on this platform"); + + const int size = 10; + const int missingRow = size - 1; + QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy(); + QSurface3DSeries *series = new QSurface3DSeries(proxy); + Q3DSurface *graph = new Q3DSurface(); + graph->addSeries(series); + + // X + QSurfaceDataArray *array = new QSurfaceDataArray(); + array->reserve(size); + for (int i = 0; i < size; i++) { + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D((i == missingRow) ? std::numeric_limits<float>::quiet_NaN() + : static_cast<float>(i), + qSin(static_cast<float>(i)), static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + + // Y + for (int i = 0; i < size; i++) { + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D(static_cast<float>(i), + (i == missingRow) ? std::numeric_limits<float>::quiet_NaN() + : qSin(static_cast<float>(i)), + static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + + // Z + for (int i = 0; i < size; i++) { + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D(static_cast<float>(i), + qSin(static_cast<float>(i)), + (i == missingRow) ? std::numeric_limits<float>::quiet_NaN() + : static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + delete graph; +} + +void tst_proxy::dataContainingNaNFirstLastRow() +{ + if (!CpptestUtil::isOpenGLSupported()) + QSKIP("OpenGL not supported on this platform"); + + const int size = 10; + const int rowFirst = 0; + const int rowLast = size - 1; + QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy(); + QSurface3DSeries *series = new QSurface3DSeries(proxy); + Q3DSurface *graph = new Q3DSurface(); + graph->addSeries(series); + + // X + QSurfaceDataArray *array = new QSurfaceDataArray(); + array->reserve(size); + for (int i = 0; i < size; i++) { + bool missingRow = (i == rowFirst || i == rowLast); + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D(missingRow ? std::numeric_limits<float>::quiet_NaN() + : static_cast<float>(i), + qSin(static_cast<float>(i)), static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + + // Y + for (int i = 0; i < size; i++) { + bool missingRow = (i == rowFirst || i == rowLast); + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D(static_cast<float>(i), + missingRow ? std::numeric_limits<float>::quiet_NaN() + : qSin(static_cast<float>(i)), + static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + + // Z + for (int i = 0; i < size; i++) { + bool missingRow = (i == rowFirst || i == rowLast); + QSurfaceDataRow *row = new QSurfaceDataRow(size); + for (int j = 0; j < size; j++) { + (*row)[j].setPosition(QVector3D(static_cast<float>(i), + qSin(static_cast<float>(i)), + missingRow ? std::numeric_limits<float>::quiet_NaN() + : static_cast<float>(j))); + } + *array << row; + } + proxy->resetArray(array); + QVERIFY(!qIsNaN(graph->axisX()->min())); + QVERIFY(!qIsNaN(graph->axisX()->max())); + QVERIFY(!qIsNaN(graph->axisY()->min())); + QVERIFY(!qIsNaN(graph->axisY()->max())); + QVERIFY(!qIsNaN(graph->axisZ()->min())); + QVERIFY(!qIsNaN(graph->axisZ()->max())); + delete graph; +} + +QTEST_MAIN(tst_proxy) +#include "tst_proxy.moc" diff --git a/tests/auto/cpptest/q3dsurface-modelproxy/CMakeLists.txt b/tests/auto/cpptest/q3dsurface-modelproxy/CMakeLists.txt new file mode 100644 index 00000000..4b42431a --- /dev/null +++ b/tests/auto/cpptest/q3dsurface-modelproxy/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dsurface-modelproxy_datavis + SOURCES + tst_proxy.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::Widgets + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dsurface-modelproxy/q3dsurface-modelproxy.pro b/tests/auto/cpptest/q3dsurface-modelproxy/q3dsurface-modelproxy.pro deleted file mode 100644 index ad1fe0cc..00000000 --- a/tests/auto/cpptest/q3dsurface-modelproxy/q3dsurface-modelproxy.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../common/cpptestutil.pri) -QT += testlib datavisualization widgets - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_proxy.cpp diff --git a/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp b/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp index eb984c1a..a442b1f3 100644 --- a/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dsurface-modelproxy/tst_proxy.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -35,8 +9,6 @@ #include "cpptestutil.h" -using namespace QtDataVisualization; - class tst_proxy: public QObject { Q_OBJECT @@ -96,8 +68,8 @@ void tst_proxy::construct() QCOMPARE(proxy->xPosRole(), QString("")); QCOMPARE(proxy->yPosRole(), QString("y")); QCOMPARE(proxy->zPosRole(), QString("")); - QCOMPARE(proxy->rowCategories().length(), 0); - QCOMPARE(proxy->columnCategories().length(), 0); + QCOMPARE(proxy->rowCategories().size(), 0); + QCOMPARE(proxy->columnCategories().size(), 0); delete proxy; proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "y"); @@ -107,8 +79,8 @@ void tst_proxy::construct() QCOMPARE(proxy->xPosRole(), QString("column")); QCOMPARE(proxy->yPosRole(), QString("y")); QCOMPARE(proxy->zPosRole(), QString("row")); - QCOMPARE(proxy->rowCategories().length(), 0); - QCOMPARE(proxy->columnCategories().length(), 0); + QCOMPARE(proxy->rowCategories().size(), 0); + QCOMPARE(proxy->columnCategories().size(), 0); delete proxy; proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "x", "y", "z"); @@ -118,8 +90,8 @@ void tst_proxy::construct() QCOMPARE(proxy->xPosRole(), QString("x")); QCOMPARE(proxy->yPosRole(), QString("y")); QCOMPARE(proxy->zPosRole(), QString("z")); - QCOMPARE(proxy->rowCategories().length(), 0); - QCOMPARE(proxy->columnCategories().length(), 0); + QCOMPARE(proxy->rowCategories().size(), 0); + QCOMPARE(proxy->columnCategories().size(), 0); delete proxy; proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "y", @@ -130,8 +102,8 @@ void tst_proxy::construct() QCOMPARE(proxy->xPosRole(), QString("column")); QCOMPARE(proxy->yPosRole(), QString("y")); QCOMPARE(proxy->zPosRole(), QString("row")); - QCOMPARE(proxy->rowCategories().length(), 1); - QCOMPARE(proxy->columnCategories().length(), 1); + QCOMPARE(proxy->rowCategories().size(), 1); + QCOMPARE(proxy->columnCategories().size(), 1); delete proxy; proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "x", "y", "z", @@ -142,8 +114,8 @@ void tst_proxy::construct() QCOMPARE(proxy->xPosRole(), QString("x")); QCOMPARE(proxy->yPosRole(), QString("y")); QCOMPARE(proxy->zPosRole(), QString("z")); - QCOMPARE(proxy->rowCategories().length(), 1); - QCOMPARE(proxy->columnCategories().length(), 1); + QCOMPARE(proxy->rowCategories().size(), 1); + QCOMPARE(proxy->columnCategories().size(), 1); delete proxy; } @@ -155,23 +127,23 @@ void tst_proxy::initialProperties() QCOMPARE(m_proxy->autoRowCategories(), true); QCOMPARE(m_proxy->columnCategories(), QStringList()); QCOMPARE(m_proxy->columnRole(), QString()); - QCOMPARE(m_proxy->columnRolePattern(), QRegExp()); + QCOMPARE(m_proxy->columnRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->columnRoleReplace(), QString()); QVERIFY(!m_proxy->itemModel()); QCOMPARE(m_proxy->multiMatchBehavior(), QItemModelSurfaceDataProxy::MMBLast); QCOMPARE(m_proxy->rowCategories(), QStringList()); QCOMPARE(m_proxy->rowRole(), QString()); - QCOMPARE(m_proxy->rowRolePattern(), QRegExp()); + QCOMPARE(m_proxy->rowRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->rowRoleReplace(), QString()); QCOMPARE(m_proxy->useModelCategories(), false); QCOMPARE(m_proxy->xPosRole(), QString()); - QCOMPARE(m_proxy->xPosRolePattern(), QRegExp()); + QCOMPARE(m_proxy->xPosRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->xPosRoleReplace(), QString()); QCOMPARE(m_proxy->yPosRole(), QString()); - QCOMPARE(m_proxy->yPosRolePattern(), QRegExp()); + QCOMPARE(m_proxy->yPosRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->yPosRoleReplace(), QString()); QCOMPARE(m_proxy->zPosRole(), QString()); - QCOMPARE(m_proxy->zPosRolePattern(), QRegExp()); + QCOMPARE(m_proxy->zPosRolePattern(), QRegularExpression()); QCOMPARE(m_proxy->zPosRoleReplace(), QString()); QCOMPARE(m_proxy->columnCount(), 0); @@ -191,46 +163,46 @@ void tst_proxy::initializeProperties() m_proxy->setAutoRowCategories(false); m_proxy->setColumnCategories(QStringList() << "col1" << "col2"); m_proxy->setColumnRole("column"); - m_proxy->setColumnRolePattern(QRegExp("/^.*-(\\d\\d)$/")); + m_proxy->setColumnRolePattern(QRegularExpression("/^.*-(\\d\\d)$/")); m_proxy->setColumnRoleReplace("\\\\1"); m_proxy->setItemModel(table.model()); m_proxy->setMultiMatchBehavior(QItemModelSurfaceDataProxy::MMBAverage); m_proxy->setRowCategories(QStringList() << "row1" << "row2"); m_proxy->setRowRole("row"); - m_proxy->setRowRolePattern(QRegExp("/^(\\d\\d\\d\\d).*$/")); + m_proxy->setRowRolePattern(QRegularExpression("/^(\\d\\d\\d\\d).*$/")); m_proxy->setRowRoleReplace("\\\\1"); m_proxy->setUseModelCategories(true); m_proxy->setXPosRole("X"); - m_proxy->setXPosRolePattern(QRegExp("/-/")); + m_proxy->setXPosRolePattern(QRegularExpression("/-/")); m_proxy->setXPosRoleReplace("\\\\1"); m_proxy->setYPosRole("Y"); - m_proxy->setYPosRolePattern(QRegExp("/-/")); + m_proxy->setYPosRolePattern(QRegularExpression("/-/")); m_proxy->setYPosRoleReplace("\\\\1"); m_proxy->setZPosRole("Z"); - m_proxy->setZPosRolePattern(QRegExp("/-/")); + m_proxy->setZPosRolePattern(QRegularExpression("/-/")); m_proxy->setZPosRoleReplace("\\\\1"); QCOMPARE(m_proxy->autoColumnCategories(), false); QCOMPARE(m_proxy->autoRowCategories(), false); - QCOMPARE(m_proxy->columnCategories().count(), 2); + QCOMPARE(m_proxy->columnCategories().size(), 2); QCOMPARE(m_proxy->columnRole(), QString("column")); - QCOMPARE(m_proxy->columnRolePattern(), QRegExp("/^.*-(\\d\\d)$/")); + QCOMPARE(m_proxy->columnRolePattern(), QRegularExpression("/^.*-(\\d\\d)$/")); QCOMPARE(m_proxy->columnRoleReplace(), QString("\\\\1")); QVERIFY(m_proxy->itemModel()); QCOMPARE(m_proxy->multiMatchBehavior(), QItemModelSurfaceDataProxy::MMBAverage); - QCOMPARE(m_proxy->rowCategories().count(), 2); + QCOMPARE(m_proxy->rowCategories().size(), 2); QCOMPARE(m_proxy->rowRole(), QString("row")); - QCOMPARE(m_proxy->rowRolePattern(), QRegExp("/^(\\d\\d\\d\\d).*$/")); + QCOMPARE(m_proxy->rowRolePattern(), QRegularExpression("/^(\\d\\d\\d\\d).*$/")); QCOMPARE(m_proxy->rowRoleReplace(), QString("\\\\1")); QCOMPARE(m_proxy->useModelCategories(), true); QCOMPARE(m_proxy->xPosRole(), QString("X")); - QCOMPARE(m_proxy->xPosRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->xPosRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->xPosRoleReplace(), QString("\\\\1")); QCOMPARE(m_proxy->yPosRole(), QString("Y")); - QCOMPARE(m_proxy->yPosRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->yPosRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->yPosRoleReplace(), QString("\\\\1")); QCOMPARE(m_proxy->zPosRole(), QString("Z")); - QCOMPARE(m_proxy->zPosRolePattern(), QRegExp("/-/")); + QCOMPARE(m_proxy->zPosRolePattern(), QRegularExpression("/-/")); QCOMPARE(m_proxy->zPosRoleReplace(), QString("\\\\1")); } @@ -264,12 +236,13 @@ void tst_proxy::multiMatch() m_proxy->setItemModel(table.model()); m_proxy->setRowRole(table.model()->roleNames().value(Qt::DisplayRole)); m_proxy->setColumnRole(table.model()->roleNames().value(Qt::DisplayRole)); - m_proxy->setRowRolePattern(QRegExp(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setRowRolePattern(QRegularExpression(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setRowRoleReplace(QStringLiteral("\\2")); - m_proxy->setYPosRolePattern(QRegExp(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setYPosRolePattern(QRegularExpression(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setYPosRoleReplace(QStringLiteral("\\3")); - m_proxy->setColumnRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + m_proxy->setColumnRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setColumnRoleReplace(QStringLiteral("\\1")); + QCoreApplication::processEvents(); QSurface3DSeries *series = new QSurface3DSeries(m_proxy); diff --git a/tests/auto/cpptest/q3dsurface-proxy/CMakeLists.txt b/tests/auto/cpptest/q3dsurface-proxy/CMakeLists.txt new file mode 100644 index 00000000..5553d635 --- /dev/null +++ b/tests/auto/cpptest/q3dsurface-proxy/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dsurface-proxy_datavis + SOURCES + tst_proxy.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dsurface-proxy/q3dsurface-proxy.pro b/tests/auto/cpptest/q3dsurface-proxy/q3dsurface-proxy.pro deleted file mode 100644 index b0b5d361..00000000 --- a/tests/auto/cpptest/q3dsurface-proxy/q3dsurface-proxy.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_proxy.cpp diff --git a/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp b/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp index cda6bcce..bc5d9edc 100644 --- a/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QSurfaceDataProxy> -using namespace QtDataVisualization; - class tst_proxy: public QObject { Q_OBJECT @@ -47,6 +19,7 @@ private slots: void initialProperties(); void initializeProperties(); + void initialRow(); private: QSurfaceDataProxy *m_proxy; @@ -105,5 +78,14 @@ void tst_proxy::initializeProperties() QCOMPARE(m_proxy->rowCount(), 2); } +void tst_proxy::initialRow() +{ + QSurfaceDataProxy proxy; + QSurfaceDataRow row{QSurfaceDataItem{QVector3D{0, 0, 0}}, + QSurfaceDataItem{QVector3D{1, 1, 1}}}; + proxy.addRow(new QSurfaceDataRow(row)); + proxy.addRow(new QSurfaceDataRow(row)); +} + QTEST_MAIN(tst_proxy) #include "tst_proxy.moc" diff --git a/tests/auto/cpptest/q3dsurface-series/CMakeLists.txt b/tests/auto/cpptest/q3dsurface-series/CMakeLists.txt new file mode 100644 index 00000000..283829bd --- /dev/null +++ b/tests/auto/cpptest/q3dsurface-series/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dsurface-series_datavis + SOURCES + tst_series.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dsurface-series/q3dsurface-series.pro b/tests/auto/cpptest/q3dsurface-series/q3dsurface-series.pro deleted file mode 100644 index 481653ef..00000000 --- a/tests/auto/cpptest/q3dsurface-series/q3dsurface-series.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_series.cpp diff --git a/tests/auto/cpptest/q3dsurface-series/tst_series.cpp b/tests/auto/cpptest/q3dsurface-series/tst_series.cpp index 97119f63..59befddc 100644 --- a/tests/auto/cpptest/q3dsurface-series/tst_series.cpp +++ b/tests/auto/cpptest/q3dsurface-series/tst_series.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/QSurface3DSeries> -using namespace QtDataVisualization; - class tst_series: public QObject { Q_OBJECT @@ -94,7 +66,7 @@ void tst_series::initialProperties() QCOMPARE(m_series->isFlatShadingEnabled(), true); QCOMPARE(m_series->isFlatShadingSupported(), true); QCOMPARE(m_series->selectedPoint(), m_series->invalidSelectionPosition()); - + QCOMPARE(m_series->wireframeColor(), QColor(Qt::black)); // Common properties. The ones identical between different series are tested in QBar3DSeries tests QCOMPARE(m_series->itemLabelFormat(), QString("@xLabel, @yLabel, @zLabel")); QCOMPARE(m_series->mesh(), QAbstract3DSeries::MeshSphere); @@ -109,10 +81,12 @@ void tst_series::initializeProperties() m_series->setDrawMode(QSurface3DSeries::DrawWireframe); m_series->setFlatShadingEnabled(false); m_series->setSelectedPoint(QPoint(0, 0)); + m_series->setWireframeColor(QColor(Qt::red)); QCOMPARE(m_series->drawMode(), QSurface3DSeries::DrawWireframe); QCOMPARE(m_series->isFlatShadingEnabled(), false); QCOMPARE(m_series->selectedPoint(), QPoint(0, 0)); + QCOMPARE(m_series->wireframeColor(), QColor(Qt::red)); // Common properties. The ones identical between different series are tested in QBar3DSeries tests m_series->setMesh(QAbstract3DSeries::MeshPyramid); diff --git a/tests/auto/cpptest/q3dsurface/CMakeLists.txt b/tests/auto/cpptest/q3dsurface/CMakeLists.txt new file mode 100644 index 00000000..71f78da8 --- /dev/null +++ b/tests/auto/cpptest/q3dsurface/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dsurface_datavis + SOURCES + tst_surface.cpp + INCLUDE_DIRECTORIES + ../common + LIBRARIES + Qt::Gui + Qt::GuiPrivate + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dsurface/q3dsurface.pro b/tests/auto/cpptest/q3dsurface/q3dsurface.pro deleted file mode 100644 index 9ed3c7f5..00000000 --- a/tests/auto/cpptest/q3dsurface/q3dsurface.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../common/cpptestutil.pri) -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_surface.cpp diff --git a/tests/auto/cpptest/q3dsurface/tst_surface.cpp b/tests/auto/cpptest/q3dsurface/tst_surface.cpp index 04fe5d21..b27dfa0c 100644 --- a/tests/auto/cpptest/q3dsurface/tst_surface.cpp +++ b/tests/auto/cpptest/q3dsurface/tst_surface.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -33,8 +7,6 @@ #include "cpptestutil.h" -using namespace QtDataVisualization; - class tst_surface: public QObject { Q_OBJECT @@ -56,6 +28,7 @@ private slots: void selectSeries(); void removeSeries(); void removeMultipleSeries(); + void hasSeries(); private: Q3DSurface *m_graph; @@ -110,7 +83,7 @@ void tst_surface::construct() void tst_surface::initialProperties() { QVERIFY(m_graph); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); QVERIFY(!m_graph->selectedSeries()); QCOMPARE(m_graph->flipHorizontalGrid(), false); QCOMPARE(m_graph->axisX()->orientation(), QAbstract3DAxis::AxisOrientationX); @@ -185,9 +158,9 @@ void tst_surface::invalidProperties() m_graph->setLocale(QLocale("XX")); QCOMPARE(m_graph->selectionMode(), QAbstract3DGraph::SelectionItem); - QCOMPARE(m_graph->aspectRatio(), -1.0/*2.0*/); // TODO: Fix once QTRD-3367 is done - QCOMPARE(m_graph->horizontalAspectRatio(), -1.0/*0.0*/); // TODO: Fix once QTRD-3367 is done - QCOMPARE(m_graph->reflectivity(), -1.0/*0.5*/); // TODO: Fix once QTRD-3367 is done + QCOMPARE(m_graph->aspectRatio(), 2.0); + QCOMPARE(m_graph->horizontalAspectRatio(), 0.0); + QCOMPARE(m_graph->reflectivity(), 0.5); QCOMPARE(m_graph->locale(), QLocale("C")); } @@ -195,7 +168,7 @@ void tst_surface::addSeries() { m_graph->addSeries(newSeries()); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); QVERIFY(!m_graph->selectedSeries()); } @@ -209,7 +182,7 @@ void tst_surface::addMultipleSeries() m_graph->addSeries(series2); m_graph->addSeries(series3); - QCOMPARE(m_graph->seriesList().length(), 3); + QCOMPARE(m_graph->seriesList().size(), 3); } void tst_surface::selectSeries() @@ -219,7 +192,7 @@ void tst_surface::selectSeries() m_graph->addSeries(series); m_graph->seriesList()[0]->setSelectedPoint(QPoint(0, 0)); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); QCOMPARE(m_graph->selectedSeries(), series); m_graph->clearSelection(); @@ -232,7 +205,7 @@ void tst_surface::removeSeries() m_graph->addSeries(series); m_graph->removeSeries(series); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); delete series; } @@ -251,19 +224,28 @@ void tst_surface::removeMultipleSeries() QCOMPARE(m_graph->selectedSeries(), series); m_graph->removeSeries(series); - QCOMPARE(m_graph->seriesList().length(), 2); + QCOMPARE(m_graph->seriesList().size(), 2); QVERIFY(!m_graph->selectedSeries()); m_graph->removeSeries(series2); - QCOMPARE(m_graph->seriesList().length(), 1); + QCOMPARE(m_graph->seriesList().size(), 1); m_graph->removeSeries(series3); - QCOMPARE(m_graph->seriesList().length(), 0); + QCOMPARE(m_graph->seriesList().size(), 0); delete series; delete series2; delete series3; } +void tst_surface::hasSeries() +{ + QSurface3DSeries *series1 = newSeries(); + m_graph->addSeries(series1); + QCOMPARE(m_graph->hasSeries(series1), true); + QSurface3DSeries *series2 = newSeries(); + QCOMPARE(m_graph->hasSeries(series2), false); +} + QTEST_MAIN(tst_surface) #include "tst_surface.moc" diff --git a/tests/auto/cpptest/q3dtheme/CMakeLists.txt b/tests/auto/cpptest/q3dtheme/CMakeLists.txt new file mode 100644 index 00000000..0b59ed6e --- /dev/null +++ b/tests/auto/cpptest/q3dtheme/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_test(q3dtheme_datavis + SOURCES + tst_theme.cpp + LIBRARIES + Qt::Gui + Qt::DataVisualization +) diff --git a/tests/auto/cpptest/q3dtheme/q3dtheme.pro b/tests/auto/cpptest/q3dtheme/q3dtheme.pro deleted file mode 100644 index 30a4802c..00000000 --- a/tests/auto/cpptest/q3dtheme/q3dtheme.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += testlib datavisualization - -TARGET = tst_cpptest -CONFIG += console testcase - -TEMPLATE = app - -SOURCES += tst_theme.cpp diff --git a/tests/auto/cpptest/q3dtheme/tst_theme.cpp b/tests/auto/cpptest/q3dtheme/tst_theme.cpp index 63635b48..24503d95 100644 --- a/tests/auto/cpptest/q3dtheme/tst_theme.cpp +++ b/tests/auto/cpptest/q3dtheme/tst_theme.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtDataVisualization/Q3DTheme> -using namespace QtDataVisualization; - class tst_theme: public QObject { Q_OBJECT @@ -82,10 +54,10 @@ void tst_theme::construct() QCOMPARE(theme->ambientLightStrength(), 0.5f); QCOMPARE(theme->backgroundColor(), QColor(Qt::black)); QCOMPARE(theme->isBackgroundEnabled(), true); - QCOMPARE(theme->baseColors().length(), 5); + QCOMPARE(theme->baseColors().size(), 5); QCOMPARE(theme->baseColors().at(0), QColor(Qt::white)); QCOMPARE(theme->baseColors().at(4), QColor(QRgb(0x6b6b6b))); - QCOMPARE(theme->baseGradients().length(), 5); + QCOMPARE(theme->baseGradients().size(), 5); QCOMPARE(theme->baseGradients().at(0).stops().at(1).second, QColor(Qt::white)); QCOMPARE(theme->baseGradients().at(4).stops().at(1).second, QColor(QRgb(0x6b6b6b))); QCOMPARE(theme->colorStyle(), Q3DTheme::ColorStyleUniform); @@ -115,9 +87,9 @@ void tst_theme::initialProperties() QCOMPARE(m_theme->ambientLightStrength(), 0.25f); QCOMPARE(m_theme->backgroundColor(), QColor(Qt::black)); QCOMPARE(m_theme->isBackgroundEnabled(), true); - QCOMPARE(m_theme->baseColors().length(), 1); + QCOMPARE(m_theme->baseColors().size(), 1); QCOMPARE(m_theme->baseColors().at(0), QColor(Qt::black)); - QCOMPARE(m_theme->baseGradients().length(), 1); + QCOMPARE(m_theme->baseGradients().size(), 1); QCOMPARE(m_theme->baseGradients().at(0).stops().at(0).second, QColor(Qt::black)); QCOMPARE(m_theme->baseGradients().at(0).stops().at(1).second, QColor(Qt::white)); QCOMPARE(m_theme->colorStyle(), Q3DTheme::ColorStyleUniform); @@ -180,10 +152,10 @@ void tst_theme::initializeProperties() QCOMPARE(m_theme->ambientLightStrength(), 0.3f); QCOMPARE(m_theme->backgroundColor(), QColor(Qt::red)); QCOMPARE(m_theme->isBackgroundEnabled(), false); - QCOMPARE(m_theme->baseColors().length(), 2); + QCOMPARE(m_theme->baseColors().size(), 2); QCOMPARE(m_theme->baseColors().at(0), QColor(Qt::red)); QCOMPARE(m_theme->baseColors().at(1), QColor(Qt::blue)); - QCOMPARE(m_theme->baseGradients().length(), 2); + QCOMPARE(m_theme->baseGradients().size(), 2); QCOMPARE(m_theme->baseGradients().at(0), gradient1); QCOMPARE(m_theme->baseGradients().at(0), gradient2); QCOMPARE(m_theme->colorStyle(), Q3DTheme::ColorStyleRangeGradient); diff --git a/tests/auto/qmltest/CMakeLists.txt b/tests/auto/qmltest/CMakeLists.txt new file mode 100644 index 00000000..3f891438 --- /dev/null +++ b/tests/auto/qmltest/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +file(GLOB_RECURSE test_data_glob + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *) +list(APPEND test_data ${test_data_glob}) + +qt_internal_add_test(tst_qmltest_datavis + QMLTEST + SOURCES + tst_qmltest.cpp + LIBRARIES + Qt::Gui + TESTDATA ${test_data} +) + +set(qmltest_resource_files + "customitem.obj" + "customtexture.jpg" +) + +qt_internal_add_resource(tst_qmltest_datavis "qmltest" + PREFIX + "/" + FILES + ${qmltest_resource_files} +) diff --git a/tests/auto/qmltest/axis3d/tst_category.qml b/tests/auto/qmltest/axis3d/tst_category.qml index 0792ad8f..7400177e 100644 --- a/tests/auto/qmltest/axis3d/tst_category.qml +++ b/tests/auto/qmltest/axis3d/tst_category.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/axis3d/tst_logvalue.qml b/tests/auto/qmltest/axis3d/tst_logvalue.qml index d92f98d7..323bc194 100644 --- a/tests/auto/qmltest/axis3d/tst_logvalue.qml +++ b/tests/auto/qmltest/axis3d/tst_logvalue.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/axis3d/tst_value.qml b/tests/auto/qmltest/axis3d/tst_value.qml index 6e15cb85..d284a874 100644 --- a/tests/auto/qmltest/axis3d/tst_value.qml +++ b/tests/auto/qmltest/axis3d/tst_value.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/bars3d/tst_bars.qml b/tests/auto/qmltest/bars3d/tst_bars.qml index 75cf10a2..03638501 100644 --- a/tests/auto/qmltest/bars3d/tst_bars.qml +++ b/tests/auto/qmltest/bars3d/tst_bars.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { @@ -40,8 +14,8 @@ Item { function constructBars() { bars3d = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Bars3D { anchors.fill: parent }", top) @@ -89,6 +63,14 @@ Item { compare(bars3d.selectedSeries, series1) waitForRendering(top) + } + + function test_6_has_series() { + bars3d.seriesList = [series1] + compare(bars3d.hasSeries(series1), true) + compare(bars3d.hasSeries(series2), false) + + waitForRendering(top) bars3d.destroy() waitForRendering(top) } @@ -103,8 +85,8 @@ Item { function constructBarsWithCustomItemList() { bars3d = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Bars3D { anchors.fill: parent customItemList: [item1, item2] diff --git a/tests/auto/qmltest/bars3d/tst_barseries.qml b/tests/auto/qmltest/bars3d/tst_barseries.qml index 3db19615..7ee38d29 100644 --- a/tests/auto/qmltest/bars3d/tst_barseries.qml +++ b/tests/auto/qmltest/bars3d/tst_barseries.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { @@ -64,6 +38,20 @@ Item { ] } + ThemeColor { + id: rowColor1 + color: "green" + } + + ThemeColor { + id: rowColor2 + color: "blue" + } + ThemeColor { + id: rowColor3 + color: "red" + } + Bar3DSeries { id: initialized dataProxy: ItemModelBarDataProxy { @@ -92,6 +80,7 @@ Item { singleHighlightGradient: gradient3 userDefinedMesh: ":/customitem.obj" visible: false + rowColors: [ rowColor1, rowColor2, rowColor3 ] } ItemModelBarDataProxy { @@ -118,6 +107,7 @@ Item { compare(initial.invalidSelectionPosition, Qt.point(-1, -1)) compare(initial.meshAngle, 0) compare(initial.selectedBar, Qt.point(-1, -1)) + compare(initial.rowColors.length, 0) } function test_2_initial_common() { @@ -149,6 +139,7 @@ Item { compare(initialized.dataProxy.rowCount, 2) fuzzyCompare(initialized.meshAngle, 15.0, 0.01) compare(initialized.selectedBar, Qt.point(0, 0)) + compare(initialized.rowColors.length, 3) } function test_2_initialized_common() { @@ -177,6 +168,7 @@ Item { change.dataProxy = proxy1 change.meshAngle = 15.0 change.selectedBar = Qt.point(0, 0) + change.rowColors = [rowColor1, rowColor2, rowColor3] } function test_2_test_change() { @@ -222,5 +214,10 @@ Item { gradient1.stops[0].color = "yellow" compare(change.baseGradient.stops[0].color, "#ffff00") } + + function test_5_change_rowColors() { + rowColor2.color = "purple" + compare(change.rowColors[1].color, "#800080") + } } } diff --git a/tests/auto/qmltest/bars3d/tst_basic.qml b/tests/auto/qmltest/bars3d/tst_basic.qml index 3ef7101d..881d629e 100644 --- a/tests/auto/qmltest/bars3d/tst_basic.qml +++ b/tests/auto/qmltest/bars3d/tst_basic.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { @@ -43,22 +17,24 @@ Item { function constructEmpty() { empty = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Bars3D { }", top) } function constructBasic() { basic = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Bars3D { anchors.fill: parent multiSeriesUniform: true barThickness: 0.1 barSpacing.width: 0.1 barSpacing.height: 0.1 + barSeriesMargin.width: 0.3 + barSeriesMargin.height: 0.3 barSpacingRelative: false floorLevel: 1.0 }", top) @@ -67,8 +43,8 @@ Item { function constructCommon() { common = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Bars3D { anchors.fill: parent }", top) @@ -77,8 +53,8 @@ Item { function constructCommonInit() { common_init = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Bars3D { anchors.fill: parent selectionMode: AbstractGraph3D.SelectionNone @@ -112,6 +88,7 @@ Item { compare(empty.multiSeriesUniform, false, "multiSeriesUniform") compare(empty.barThickness, 1.0, "barThickness") compare(empty.barSpacing, Qt.size(1.0, 1.0), "barSpacing") + compare(empty.barSeriesMargin, Qt.size(0.0, 0.0), "barSeriesMargin") compare(empty.barSpacingRelative, true, "barSpacingRelative") compare(empty.seriesList.length, 0, "seriesList") compare(empty.selectedSeries, null, "selectedSeries") @@ -124,8 +101,6 @@ Item { compare(empty.rowAxis.type, AbstractAxis3D.AxisTypeCategory) compare(empty.valueAxis.type, AbstractAxis3D.AxisTypeValue) waitForRendering(top) - empty.destroy() - waitForRendering(top) } } @@ -140,6 +115,7 @@ Item { compare(basic.multiSeriesUniform, true, "multiSeriesUniform") compare(basic.barThickness, 0.1, "barThickness") compare(basic.barSpacing, Qt.size(0.1, 0.1), "barSpacing") + compare(basic.barSeriesMargin, Qt.size(0.3, 0.3), "barSeriesMargin") compare(basic.barSpacingRelative, false, "barSpacingRelative") compare(basic.floorLevel, 1.0, "floorLevel") waitForRendering(top) @@ -149,11 +125,13 @@ Item { basic.multiSeriesUniform = false basic.barThickness = 0.5 basic.barSpacing = Qt.size(1.0, 0.0) + basic.barSeriesMargin = Qt.size(0.5, 0.0) basic.barSpacingRelative = true basic.floorLevel = 0.2 compare(basic.multiSeriesUniform, false, "multiSeriesUniform") compare(basic.barThickness, 0.5, "barThickness") compare(basic.barSpacing, Qt.size(1.0, 0.0), "barSpacing") + compare(basic.barSeriesMargin, Qt.size(0.5, 0.0), "barSeriesMargin") compare(basic.barSpacingRelative, true, "barSpacingRelative") compare(basic.floorLevel, 0.2, "floorLevel") waitForRendering(top) @@ -162,10 +140,10 @@ Item { function test_3_basic_change_invalid() { basic.barThickness = -1 basic.barSpacing = Qt.size(-1.0, -1.0) + basic.barSeriesMargin = Qt.size(-1.0, -1.0) compare(basic.barThickness, -1/*0.5*/, "barThickness") // TODO: Fix once QTRD-3367 is done compare(basic.barSpacing, Qt.size(-1.0, -1.0), "barSpacing") - waitForRendering(top) - basic.destroy() + compare(basic.barSeriesMargin, Qt.size(-1.0, -1.0), "barSeriesMargin") waitForRendering(top) } } @@ -175,13 +153,16 @@ Item { when: windowShown function test_1_common() { + if (Qt.platform.os === "android") + return; + constructCommon() + if (common.shadowsSupported === false) + return; + compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode") compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality") - if (common.shadowsSupported === true) - compare(common.msaaSamples, 4, "msaaSamples") - else - compare(common.msaaSamples, 0, "msaaSamples") + compare(common.msaaSamples, 4, "msaaSamples") compare(common.theme.type, Theme3D.ThemeQt, "theme") compare(common.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode") compare(common.measureFps, false, "measureFps") @@ -202,14 +183,14 @@ Item { } function test_2_change_common() { + if (Qt.platform.os === "android" || common.shadowsSupported === false) + return; + common.selectionMode = AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice common.shadowQuality = AbstractGraph3D.ShadowQualitySoftHigh - compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality") common.msaaSamples = 8 - if (common.shadowsSupported === true) - compare(common.msaaSamples, 8, "msaaSamples") - else - compare(common.msaaSamples, 0, "msaaSamples") + compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality") + compare(common.msaaSamples, 8, "msaaSamples") common.theme.type = Theme3D.ThemeRetro common.renderingMode = AbstractGraph3D.RenderDirectToBackground_NoClear common.measureFps = true @@ -243,6 +224,9 @@ Item { } function test_3_change_invalid_common() { + if (Qt.platform.os === "android" || common.shadowsSupported === false) + return; + common.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionColumn | AbstractGraph3D.SelectionSlice common.theme.type = -2 common.renderingMode = -1 @@ -254,28 +238,30 @@ Item { common.reflection = false common.reflectivity = -1.0 compare(common.selectionMode, AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice, "selectionMode") - compare(common.theme.type, -2/*Theme3D.ThemeRetro*/, "theme") // TODO: Fix once QTRD-3367 is done - compare(common.renderingMode, -1/*AbstractGraph3D.RenderDirectToBackground_NoClear*/, "renderingMode") // TODO: Fix once QTRD-3367 is done - compare(common.aspectRatio, -1.0/*1.0*/, "aspectRatio") // TODO: Fix once QTRD-3367 is done - compare(common.horizontalAspectRatio, -2/*1*/, "horizontalAspectRatio") // TODO: Fix once QTRD-3367 is done - compare(common.reflectivity, -1.0/*1.0*/, "reflectivity") // TODO: Fix once QTRD-3367 is done - - waitForRendering(top) - common.destroy() + compare(common.theme.type, Theme3D.ThemeRetro, "theme") + compare(common.renderingMode, AbstractGraph3D.RenderDirectToBackground_NoClear, "renderingMode") + compare(common.aspectRatio, 1.0, "aspectRatio") + compare(common.horizontalAspectRatio, 1.0, "horizontalAspectRatio") + compare(common.reflectivity, 1.0, "reflectivity") waitForRendering(top) } + } + + TestCase { + name: "Bars3D Common Initialized" + when: windowShown + + function test_1_common_initialized() { + if (Qt.platform.os === "android") + return; - function test_4_common_initialized() { constructCommonInit() + if (common_init.shadowsSupported === false) // This test is flaky on VM, use shadowsSupported to detect being run in VM + return; compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode") - if (common_init.shadowsSupported === true) { - tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow) - compare(common_init.msaaSamples, 2, "msaaSamples") - } else { - tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone) - compare(common_init.msaaSamples, 0, "msaaSamples") - } + tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow) + compare(common_init.msaaSamples, 2, "msaaSamples") compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme") compare(common_init.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode") compare(common_init.measureFps, true, "measureFps") @@ -290,9 +276,6 @@ Item { compare(common_init.reflectivity, 0.1, "reflectivity") compare(common_init.locale, Qt.locale("UK"), "locale") compare(common_init.margin, 0.2, "margin") - - waitForRendering(top) - common_init.destroy(); waitForRendering(top) } } diff --git a/tests/auto/qmltest/bars3d/tst_proxy.qml b/tests/auto/qmltest/bars3d/tst_proxy.qml index ca8b8516..bd337017 100644 --- a/tests/auto/qmltest/bars3d/tst_proxy.qml +++ b/tests/auto/qmltest/bars3d/tst_proxy.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { diff --git a/tests/auto/qmltest/custom3d/tst_customitem.qml b/tests/auto/qmltest/custom3d/tst_customitem.qml index 862aa67a..eebfaac1 100644 --- a/tests/auto/qmltest/custom3d/tst_customitem.qml +++ b/tests/auto/qmltest/custom3d/tst_customitem.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/custom3d/tst_customlabel.qml b/tests/auto/qmltest/custom3d/tst_customlabel.qml index f4094efd..28f062ab 100644 --- a/tests/auto/qmltest/custom3d/tst_customlabel.qml +++ b/tests/auto/qmltest/custom3d/tst_customlabel.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/custom3d/tst_customvolume.qml b/tests/auto/qmltest/custom3d/tst_customvolume.qml index aa97a7e2..21630394 100644 --- a/tests/auto/qmltest/custom3d/tst_customvolume.qml +++ b/tests/auto/qmltest/custom3d/tst_customvolume.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/input3d/tst_input.qml b/tests/auto/qmltest/input3d/tst_input.qml index 44b06b65..a2904c53 100644 --- a/tests/auto/qmltest/input3d/tst_input.qml +++ b/tests/auto/qmltest/input3d/tst_input.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/input3d/tst_touch.qml b/tests/auto/qmltest/input3d/tst_touch.qml index 13af8afd..047abb97 100644 --- a/tests/auto/qmltest/input3d/tst_touch.qml +++ b/tests/auto/qmltest/input3d/tst_touch.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/qmltest.pro b/tests/auto/qmltest/qmltest.pro deleted file mode 100644 index 5b52595f..00000000 --- a/tests/auto/qmltest/qmltest.pro +++ /dev/null @@ -1,35 +0,0 @@ -TEMPLATE = app -TARGET = tst_qmltest -CONFIG += qmltestcase -CONFIG += console -SOURCES += tst_qmltest.cpp -OTHER_FILES += bars3d/tst_basic.qml \ - bars3d/tst_bars.qml \ - bars3d/tst_barseries.qml \ - bars3d/tst_proxy.qml \ - scatter3d/tst_basic.qml \ - scatter3d/tst_scatter.qml \ - scatter3d/tst_scatterseries.qml \ - scatter3d/tst_proxy.qml \ - surface3d/tst_basic.qml \ - surface3d/tst_surface.qml \ - surface3d/tst_surfaceseries.qml \ - surface3d/tst_proxy.qml \ - surface3d/tst_heightproxy.qml \ - theme3d/tst_theme.qml \ - theme3d/tst_colorgradient.qml \ - theme3d/tst_themecolor.qml \ - custom3d/tst_customitem.qml \ - custom3d/tst_customlabel.qml \ - custom3d/tst_customvolume.qml \ - scene3d/tst_scene.qml \ - scene3d/tst_camera.qml \ - scene3d/tst_light.qml \ - input3d/tst_input.qml \ - input3d/tst_touch.qml \ - axis3d/tst_category.qml \ - axis3d/tst_value.qml \ - axis3d/tst_logvalue.qml \ - -RESOURCES += \ - qmltest.qrc diff --git a/tests/auto/qmltest/qmltest.qrc b/tests/auto/qmltest/qmltest.qrc deleted file mode 100644 index 61f19086..00000000 --- a/tests/auto/qmltest/qmltest.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>customitem.obj</file> - <file>customtexture.jpg</file> - </qresource> -</RCC> diff --git a/tests/auto/qmltest/scatter3d/tst_basic.qml b/tests/auto/qmltest/scatter3d/tst_basic.qml index a5f20d01..7320ac49 100644 --- a/tests/auto/qmltest/scatter3d/tst_basic.qml +++ b/tests/auto/qmltest/scatter3d/tst_basic.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { @@ -43,16 +17,16 @@ Item { function constructEmpty() { empty = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Scatter3D { }", top) } function constructBasic() { basic = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Scatter3D { anchors.fill: parent }", top) @@ -61,8 +35,8 @@ Item { function constructCommon() { common = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Scatter3D { anchors.fill: parent }", top) @@ -71,8 +45,8 @@ Item { function constructCommonInit() { common_init = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Scatter3D { anchors.fill: parent selectionMode: AbstractGraph3D.SelectionNone @@ -112,8 +86,6 @@ Item { compare(empty.axisZ.type, AbstractAxis3D.AxisTypeValue) compare(empty.axisY.type, AbstractAxis3D.AxisTypeValue) waitForRendering(top) - empty.destroy() - waitForRendering(top) } } @@ -126,8 +98,6 @@ Item { compare(basic.width, 150, "width") compare(basic.height, 150, "height") waitForRendering(top) - basic.destroy() - waitForRendering(top) } } @@ -136,13 +106,16 @@ Item { when: windowShown function test_1_common() { + if (Qt.platform.os === "android") + return; + constructCommon() + if (common.shadowsSupported === false) + return; + compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode") compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality") - if (common.shadowsSupported === true) - compare(common.msaaSamples, 4, "msaaSamples") - else - compare(common.msaaSamples, 0, "msaaSamples") + compare(common.msaaSamples, 4, "msaaSamples") compare(common.theme.type, Theme3D.ThemeQt, "theme") compare(common.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode") compare(common.measureFps, false, "measureFps") @@ -163,14 +136,14 @@ Item { } function test_2_change_common() { + if (Qt.platform.os === "android" || common.shadowsSupported === false) + return; + common.selectionMode = AbstractGraph3D.SelectionNone common.shadowQuality = AbstractGraph3D.ShadowQualitySoftHigh - compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality") common.msaaSamples = 8 - if (common.shadowsSupported === true) - compare(common.msaaSamples, 8, "msaaSamples") - else - compare(common.msaaSamples, 0, "msaaSamples") + compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality") + compare(common.msaaSamples, 8, "msaaSamples") common.theme.type = Theme3D.ThemeRetro common.renderingMode = AbstractGraph3D.RenderDirectToBackground_NoClear common.measureFps = true @@ -204,6 +177,9 @@ Item { } function test_3_change_invalid_common() { + if (Qt.platform.os === "android" || common.shadowsSupported === false) + return; + common.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionColumn | AbstractGraph3D.SelectionSlice common.theme.type = -2 common.renderingMode = -1 @@ -215,28 +191,30 @@ Item { common.reflection = false common.reflectivity = -1.0 compare(common.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode") - compare(common.theme.type, -2/*Theme3D.ThemeRetro*/, "theme") // TODO: Fix once QTRD-3367 is done - compare(common.renderingMode, -1/*AbstractGraph3D.RenderDirectToBackground_NoClear*/, "renderingMode") // TODO: Fix once QTRD-3367 is done - compare(common.aspectRatio, -1.0/*1.0*/, "aspectRatio") // TODO: Fix once QTRD-3367 is done - compare(common.horizontalAspectRatio, -2/*1*/, "horizontalAspectRatio") // TODO: Fix once QTRD-3367 is done - compare(common.reflectivity, -1.0/*1.0*/, "reflectivity") // TODO: Fix once QTRD-3367 is done - - waitForRendering(top) - common.destroy() + compare(common.theme.type, Theme3D.ThemeRetro, "theme") + compare(common.renderingMode, AbstractGraph3D.RenderDirectToBackground_NoClear, "renderingMode") + compare(common.aspectRatio, 1.0, "aspectRatio") + compare(common.horizontalAspectRatio, 1.0, "horizontalAspectRatio") + compare(common.reflectivity, 1.0, "reflectivity") waitForRendering(top) - } + } + } + + TestCase { + name: "Scatter3D Common Initialized" + when: windowShown + + function test_1_common_initialized() { + if (Qt.platform.os === "android") + return; - function test_4_common_initialized() { constructCommonInit() + if (common_init.shadowsSupported === false) + return; compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode") - if (common_init.shadowsSupported === true) { - tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow) - compare(common_init.msaaSamples, 2, "msaaSamples") - } else { - tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone) - compare(common_init.msaaSamples, 0, "msaaSamples") - } + tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow) + compare(common_init.msaaSamples, 2, "msaaSamples") compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme") compare(common_init.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode") compare(common_init.measureFps, true, "measureFps") @@ -251,9 +229,6 @@ Item { compare(common_init.reflectivity, 0.1, "reflectivity") compare(common_init.locale, Qt.locale("UK"), "locale") compare(common_init.margin, 0.2, "margin") - - waitForRendering(top) - common_init.destroy(); waitForRendering(top) } } diff --git a/tests/auto/qmltest/scatter3d/tst_proxy.qml b/tests/auto/qmltest/scatter3d/tst_proxy.qml index bd8c0c74..c970b82a 100644 --- a/tests/auto/qmltest/scatter3d/tst_proxy.qml +++ b/tests/auto/qmltest/scatter3d/tst_proxy.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/scatter3d/tst_scatter.qml b/tests/auto/qmltest/scatter3d/tst_scatter.qml index 9805b2e9..c8c8f93a 100644 --- a/tests/auto/qmltest/scatter3d/tst_scatter.qml +++ b/tests/auto/qmltest/scatter3d/tst_scatter.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { @@ -67,5 +41,11 @@ Item { series.seriesList[0].selectedItem = 0 compare(series.selectedSeries, series1) } + + function test_5_has_series() { + series.seriesList = [series1] + compare(series.hasSeries(series1), true) + compare(series.hasSeries(series2), false) + } } } diff --git a/tests/auto/qmltest/scatter3d/tst_scatterseries.qml b/tests/auto/qmltest/scatter3d/tst_scatterseries.qml index 7d84e83c..9e6cc80e 100644 --- a/tests/auto/qmltest/scatter3d/tst_scatterseries.qml +++ b/tests/auto/qmltest/scatter3d/tst_scatterseries.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/scene3d/tst_camera.qml b/tests/auto/qmltest/scene3d/tst_camera.qml index 96418ae3..c6aa446a 100644 --- a/tests/auto/qmltest/scene3d/tst_camera.qml +++ b/tests/auto/qmltest/scene3d/tst_camera.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/scene3d/tst_light.qml b/tests/auto/qmltest/scene3d/tst_light.qml index 68602316..faf3bce2 100644 --- a/tests/auto/qmltest/scene3d/tst_light.qml +++ b/tests/auto/qmltest/scene3d/tst_light.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.3 diff --git a/tests/auto/qmltest/scene3d/tst_scene.qml b/tests/auto/qmltest/scene3d/tst_scene.qml index 08a55662..b9f84202 100644 --- a/tests/auto/qmltest/scene3d/tst_scene.qml +++ b/tests/auto/qmltest/scene3d/tst_scene.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 @@ -44,7 +18,7 @@ Item { Bars3D { id: initialized scene.activeCamera: Camera3D { zoomLevel: 200 } - scene.devicePixelRatio: 2.0 + scene.devicePixelRatio: 2 // Will work only if actual pixel ratio is 2.0 scene.graphPositionQuery: Qt.point(0, 0) scene.primarySubViewport: Qt.rect(0, 0, 50, 50) scene.secondarySubViewport: Qt.rect(50, 50, 100, 100) @@ -67,7 +41,7 @@ Item { function test_initial() { verify(initial.scene.activeCamera) verify(initial.scene.activeLight) - compare(initial.scene.devicePixelRatio, 1.0) + compare(initial.scene.devicePixelRatio, Screen.devicePixelRatio) compare(initial.scene.graphPositionQuery, Qt.point(-1, -1)) compare(initial.scene.invalidSelectionPoint, Qt.point(-1, -1)) compare(initial.scene.primarySubViewport.x, 0) @@ -93,7 +67,7 @@ Item { function test_initialized() { compare(initialized.scene.activeCamera.zoomLevel, 200) - compare(initialized.scene.devicePixelRatio, 2.0) + compare(initialized.scene.devicePixelRatio, Screen.devicePixelRatio) compare(initialized.scene.graphPositionQuery, Qt.point(0, 0)) compare(initialized.scene.primarySubViewport.x, 0) compare(initialized.scene.primarySubViewport.y, 0) diff --git a/tests/auto/qmltest/surface3d/tst_basic.qml b/tests/auto/qmltest/surface3d/tst_basic.qml index a0a0bd19..2979d6d5 100644 --- a/tests/auto/qmltest/surface3d/tst_basic.qml +++ b/tests/auto/qmltest/surface3d/tst_basic.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 @@ -43,16 +17,16 @@ Item { function constructEmpty() { empty = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Surface3D { }", top) } function constructBasic() { basic = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Surface3D { anchors.fill: parent flipHorizontalGrid: true @@ -62,8 +36,8 @@ Item { function constructCommon() { common = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Surface3D { anchors.fill: parent }", top) @@ -72,8 +46,8 @@ Item { function constructCommonInit() { common_init = Qt.createQmlObject(" - import QtQuick 2.2 - import QtDataVisualization 1.2 + import QtQuick + import QtDataVisualization Surface3D { anchors.fill: parent selectionMode: AbstractGraph3D.SelectionNone @@ -114,8 +88,6 @@ Item { compare(empty.axisZ.type, AbstractAxis3D.AxisTypeValue) compare(empty.axisY.type, AbstractAxis3D.AxisTypeValue) waitForRendering(top) - empty.destroy() - waitForRendering(top) } } @@ -134,8 +106,6 @@ Item { basic.flipHorizontalGrid = false compare(basic.flipHorizontalGrid, false, "flipHorizontalGrid") waitForRendering(top) - basic.destroy() - waitForRendering(top) } } @@ -144,13 +114,16 @@ Item { when: windowShown function test_1_common() { + if (Qt.platform.os === "android") + return; + constructCommon() + if (common.shadowsSupported === false) + return; + compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode") compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality") - if (common.shadowsSupported === true) - compare(common.msaaSamples, 4, "msaaSamples") - else - compare(common.msaaSamples, 0, "msaaSamples") + compare(common.msaaSamples, 4, "msaaSamples") compare(common.theme.type, Theme3D.ThemeQt, "theme") compare(common.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode") compare(common.measureFps, false, "measureFps") @@ -171,14 +144,14 @@ Item { } function test_2_change_common() { + if (Qt.platform.os === "android" || common.shadowsSupported === false) + return; + common.selectionMode = AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice common.shadowQuality = AbstractGraph3D.ShadowQualitySoftHigh - compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality") common.msaaSamples = 8 - if (common.shadowsSupported === true) - compare(common.msaaSamples, 8, "msaaSamples") - else - compare(common.msaaSamples, 0, "msaaSamples") + compare(common.shadowQuality, AbstractGraph3D.ShadowQualitySoftHigh, "shadowQuality") + compare(common.msaaSamples, 8, "msaaSamples") common.theme.type = Theme3D.ThemeRetro common.renderingMode = AbstractGraph3D.RenderDirectToBackground_NoClear common.measureFps = true @@ -212,6 +185,9 @@ Item { } function test_3_change_invalid_common() { + if (Qt.platform.os === "android" || common.shadowsSupported === false) + return; + common.selectionMode = AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionColumn | AbstractGraph3D.SelectionSlice common.theme.type = -2 common.renderingMode = -1 @@ -223,28 +199,30 @@ Item { common.reflection = false common.reflectivity = -1.0 compare(common.selectionMode, AbstractGraph3D.SelectionItem | AbstractGraph3D.SelectionRow | AbstractGraph3D.SelectionSlice, "selectionMode") - compare(common.theme.type, -2/*Theme3D.ThemeRetro*/, "theme") // TODO: Fix once QTRD-3367 is done - compare(common.renderingMode, -1/*AbstractGraph3D.RenderDirectToBackground_NoClear*/, "renderingMode") // TODO: Fix once QTRD-3367 is done - compare(common.aspectRatio, -1.0/*1.0*/, "aspectRatio") // TODO: Fix once QTRD-3367 is done - compare(common.horizontalAspectRatio, -2/*1*/, "horizontalAspectRatio") // TODO: Fix once QTRD-3367 is done - compare(common.reflectivity, -1.0/*1.0*/, "reflectivity") // TODO: Fix once QTRD-3367 is done - - waitForRendering(top) - common.destroy() + compare(common.theme.type, Theme3D.ThemeRetro, "theme") + compare(common.renderingMode, AbstractGraph3D.RenderDirectToBackground_NoClear, "renderingMode") + compare(common.aspectRatio, 1.0, "aspectRatio") + compare(common.horizontalAspectRatio, 1.0, "horizontalAspectRatio") + compare(common.reflectivity, 1.0, "reflectivity") waitForRendering(top) } + } + + TestCase { + name: "Surface3D Common Initialized" + when: windowShown + + function test_1_common_initialized() { + if (Qt.platform.os === "android") + return; - function test_4_common_initialized() { constructCommonInit() + if (common_init.shadowsSupported === false) + return; compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode") - if (common_init.shadowsSupported === true) { - tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow) - compare(common_init.msaaSamples, 2, "msaaSamples") - } else { - tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone) - compare(common_init.msaaSamples, 0, "msaaSamples") - } + tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow) + compare(common_init.msaaSamples, 2, "msaaSamples") compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme") compare(common_init.renderingMode, AbstractGraph3D.RenderIndirect, "renderingMode") compare(common_init.measureFps, true, "measureFps") @@ -259,9 +237,6 @@ Item { compare(common_init.reflectivity, 0.1, "reflectivity") compare(common_init.locale, Qt.locale("UK"), "locale") compare(common_init.margin, 0.2, "margin") - - waitForRendering(top) - common_init.destroy(); waitForRendering(top) } } diff --git a/tests/auto/qmltest/surface3d/tst_heightproxy.qml b/tests/auto/qmltest/surface3d/tst_heightproxy.qml index f92d8198..c3c5b71d 100644 --- a/tests/auto/qmltest/surface3d/tst_heightproxy.qml +++ b/tests/auto/qmltest/surface3d/tst_heightproxy.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/surface3d/tst_proxy.qml b/tests/auto/qmltest/surface3d/tst_proxy.qml index eddad5a2..57058f36 100644 --- a/tests/auto/qmltest/surface3d/tst_proxy.qml +++ b/tests/auto/qmltest/surface3d/tst_proxy.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/surface3d/tst_surface.qml b/tests/auto/qmltest/surface3d/tst_surface.qml index 2ec96007..4c52d184 100644 --- a/tests/auto/qmltest/surface3d/tst_surface.qml +++ b/tests/auto/qmltest/surface3d/tst_surface.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { @@ -67,5 +41,11 @@ Item { series.seriesList[0].selectedPoint = Qt.point(0, 0) compare(series.selectedSeries, series1) } + + function test_5_has_series() { + series.seriesList = [series1] + compare(series.hasSeries(series1), true) + compare(series.hasSeries(series2), false) + } } } diff --git a/tests/auto/qmltest/surface3d/tst_surfaceseries.qml b/tests/auto/qmltest/surface3d/tst_surfaceseries.qml index a4593c94..7d681021 100644 --- a/tests/auto/qmltest/surface3d/tst_surfaceseries.qml +++ b/tests/auto/qmltest/surface3d/tst_surfaceseries.qml @@ -1,34 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 -import QtDataVisualization 1.2 +import QtDataVisualization import QtTest 1.0 Item { @@ -79,6 +53,7 @@ Item { flatShadingEnabled: false selectedPoint: Qt.point(0, 0) textureFile: ":\customtexture.jpg" + wireframeColor: "red" baseColor: "blue" baseGradient: gradient1 @@ -123,6 +98,7 @@ Item { compare(initial.flatShadingEnabled, true) compare(initial.flatShadingSupported, true) compare(initial.selectedPoint, Qt.point(-1, -1)) + compare(initial.wireframeColor, "#000000") } function test_2_initial_common() { @@ -156,6 +132,7 @@ Item { compare(initialized.flatShadingEnabled, false) compare(initialized.selectedPoint, Qt.point(0, 0)) compare(initialized.textureFile, ":\customtexture.jpg") + compare(initialized.wireframeColor, "#ff0000") } function test_2_initialized_common() { @@ -187,6 +164,7 @@ Item { change.flatShadingEnabled = false change.selectedPoint = Qt.point(0, 0) change.textureFile = ":\customtexture.jpg" + change.wireframeColor = "green" } function test_2_test_change() { @@ -196,6 +174,7 @@ Item { compare(change.flatShadingEnabled, false) compare(change.selectedPoint, Qt.point(0, 0)) compare(change.textureFile, ":\customtexture.jpg") + compare(change.wireframeColor, "#008000") } function test_3_change_common() { diff --git a/tests/auto/qmltest/theme3d/tst_colorgradient.qml b/tests/auto/qmltest/theme3d/tst_colorgradient.qml index e1a25400..6d2cdf35 100644 --- a/tests/auto/qmltest/theme3d/tst_colorgradient.qml +++ b/tests/auto/qmltest/theme3d/tst_colorgradient.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/theme3d/tst_theme.qml b/tests/auto/qmltest/theme3d/tst_theme.qml index 880ff87b..3b44a5c8 100644 --- a/tests/auto/qmltest/theme3d/tst_theme.qml +++ b/tests/auto/qmltest/theme3d/tst_theme.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/theme3d/tst_themecolor.qml b/tests/auto/qmltest/theme3d/tst_themecolor.qml index e7b4c1ca..6e662deb 100644 --- a/tests/auto/qmltest/theme3d/tst_themecolor.qml +++ b/tests/auto/qmltest/theme3d/tst_themecolor.qml @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.0 import QtDataVisualization 1.2 diff --git a/tests/auto/qmltest/tst_qmltest.cpp b/tests/auto/qmltest/tst_qmltest.cpp index 6e2e0318..86482f65 100644 --- a/tests/auto/qmltest/tst_qmltest.cpp +++ b/tests/auto/qmltest/tst_qmltest.cpp @@ -1,31 +1,34 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtQuickTest/quicktest.h> -QUICK_TEST_MAIN(qmltest) + +class tst_qmltest: public QObject +{ + Q_OBJECT +private slots: + void skiptest() { QSKIP("This test will fail, skipping."); }; +}; + +int main(int argc, char **argv) +{ + if (!qEnvironmentVariableIsEmpty("QEMU_LD_PREFIX")) { + qWarning("This test would fail due to QEMU emulation shortcomings, so it will be skipped."); + tst_qmltest skip; + return QTest::qExec(&skip, argc, argv); + } +#ifdef Q_OS_QNX + if (qEnvironmentVariable("QTEST_ENVIRONMENT").split(' ').contains("ci") && + qEnvironmentVariable("QT_QPA_PLATFORM").split(' ').contains("offscreen") + ) { + qWarning("This test would fail on CI QNX QEMU without OpenGL support, so it will be skipped."); + tst_qmltest skip; + return QTest::qExec(&skip, argc, argv); + } +#endif + qputenv("QSG_RHI_BACKEND", "opengl"); + QTEST_SET_MAIN_SOURCE_PATH + return quick_test_main(argc, argv, "qmltest", QUICK_TEST_SOURCE_DIR); +} + +#include "tst_qmltest.moc" diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt new file mode 100644 index 00000000..32112c6b --- /dev/null +++ b/tests/manual/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(TARGET Qt::Quick) + add_subdirectory(qmldynamicdata) + add_subdirectory(qmlmultitest) + add_subdirectory(qmlvolume) + add_subdirectory(qmlperf) + add_subdirectory(qmlgradient) + add_subdirectory(qmlheightmap) + add_subdirectory(qmlbarsrowcolors) +endif() +if(NOT ANDROID AND NOT IOS AND NOT WINRT) + add_subdirectory(barstest) + add_subdirectory(scattertest) + add_subdirectory(surfacetest) + add_subdirectory(multigraphs) + add_subdirectory(directional) + add_subdirectory(itemmodeltest) + add_subdirectory(volumetrictest) + add_subdirectory(minimalbars) + add_subdirectory(minimalscatter) + add_subdirectory(minimalsurface) +endif() diff --git a/tests/manual/barstest/CMakeLists.txt b/tests/manual/barstest/CMakeLists.txt new file mode 100644 index 00000000..391b98aa --- /dev/null +++ b/tests/manual/barstest/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(barstest + GUI + SOURCES + chart.cpp chart.h + sliderwrapper.cpp sliderwrapper.h + buttonwrapper.cpp buttonwrapper.h + custominputhandler.cpp custominputhandler.h + main.cpp + NO_PCH_SOURCES + chart.cpp # undef QT_NO_FOREACH + ) +target_link_libraries(barstest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set(barstest_resource_files + "shuttle.obj" + "shuttle.png" + ) + +qt_internal_add_resource(barstest "barstest" + PREFIX + "/" + FILES + ${barstest_resource_files} + ) diff --git a/tests/manual/barstest/buttonwrapper.cpp b/tests/manual/barstest/buttonwrapper.cpp new file mode 100644 index 00000000..c8eef0c7 --- /dev/null +++ b/tests/manual/barstest/buttonwrapper.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "buttonwrapper.h" +#include <QPushButton> + +ButtonWrapper::ButtonWrapper(QPushButton *button) +{ + m_button = button; +} + +void ButtonWrapper::setEnabled(int state) +{ + m_button->setEnabled(state); +} diff --git a/tests/manual/barstest/buttonwrapper.h b/tests/manual/barstest/buttonwrapper.h new file mode 100644 index 00000000..d0112117 --- /dev/null +++ b/tests/manual/barstest/buttonwrapper.h @@ -0,0 +1,22 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef BUTTONWRAPPER_H +#define BUTTONWRAPPER_H + +#include <QObject> +class QPushButton; + +class ButtonWrapper : public QObject +{ + Q_OBJECT +public: + ButtonWrapper(QPushButton *button); + +public Q_SLOTS: + void setEnabled(int state); + +private: + QPushButton *m_button; +}; + +#endif // BUTTONWRAPPER_H diff --git a/tests/manual/barstest/chart.cpp b/tests/manual/barstest/chart.cpp index 2cc52ecf..d427921a 100644 --- a/tests/manual/barstest/chart.cpp +++ b/tests/manual/barstest/chart.cpp @@ -1,31 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "chart.h" #include "custominputhandler.h" @@ -42,8 +18,6 @@ #include <QtCore/QElapsedTimer> #include <QtCore/qmath.h> -using namespace QtDataVisualization; - const QString celsiusString = QString(QChar(0xB0)) + "C"; GraphModifier::GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog) @@ -56,6 +30,8 @@ GraphModifier::GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog) m_static(true), m_barSpacingX(0.1f), m_barSpacingZ(0.1f), + m_barSeriesMarginX(0.0f), + m_barSeriesMarginZ(0.0f), m_fontSize(20), m_segments(10), m_subSegments(3), @@ -268,7 +244,7 @@ void GraphModifier::start() restart(false); } -void GraphModifier::restart(bool dynamicData) +void GraphModifier::restart(int dynamicData) { m_static = !dynamicData; @@ -343,7 +319,7 @@ void GraphModifier::releaseSeries() m_graph->removeSeries(series); } -void GraphModifier::flipViews() +void GraphModifier::flipViews(bool checked) { m_graph->scene()->setSecondarySubviewOnTop(!m_graph->scene()->isSecondarySubviewOnTop()); qDebug() << "secondary subview on top:" << m_graph->scene()->isSecondarySubviewOnTop(); @@ -686,7 +662,9 @@ void GraphModifier::changeSelectionMode() { static int selectionMode = m_graph->selectionMode(); - if (++selectionMode > (QAbstract3DGraph::SelectionItemAndColumn | QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionMultiSeries)) + if (++selectionMode > (int)(QAbstract3DGraph::SelectionItemAndColumn | + QAbstract3DGraph::SelectionSlice | + QAbstract3DGraph::SelectionMultiSeries)) selectionMode = QAbstract3DGraph::SelectionNone; m_graph->setSelectionMode((QAbstract3DGraph::SelectionFlag)selectionMode); @@ -733,7 +711,7 @@ void GraphModifier::handleSelectionChange(const QPoint &position) qDebug() << "Selected bar position:" << position << "series:" << index; } -void GraphModifier::setUseNullInputHandler(bool useNull) +void GraphModifier::setUseNullInputHandler(int useNull) { qDebug() << "setUseNullInputHandler" << useNull; if (m_useNullInputHandler == useNull) @@ -826,7 +804,7 @@ QBarDataArray *GraphModifier::makeDummyData() } // Executes one step of the primary series test -void GraphModifier::primarySeriesTest() +void GraphModifier::primarySeriesTest(bool checked) { static int nextStep = 0; @@ -1048,7 +1026,7 @@ void GraphModifier::insertRemoveTestToggle() } } -void GraphModifier::toggleRotation() +void GraphModifier::toggleRotation(bool checked) { if (m_rotationTimer.isActive()) m_rotationTimer.stop(); @@ -1056,7 +1034,7 @@ void GraphModifier::toggleRotation() m_rotationTimer.start(20); } -void GraphModifier::useLogAxis() +void GraphModifier::useLogAxis(bool checked) { static int counter = -1; static QLogValue3DAxisFormatter *logFormatter = 0; @@ -1212,7 +1190,7 @@ void GraphModifier::addRemoveSeries() counter++; } -void GraphModifier::testItemAndRowChanges() +void GraphModifier::testItemAndRowChanges(bool checked) { static int counter = 0; const int rowCount = 12; @@ -1602,7 +1580,7 @@ void GraphModifier::rotateY(int rotation) m_graph->scene()->activeCamera()->setCameraPosition(m_xRotation, m_yRotation); } -void GraphModifier::setFpsMeasurement(bool enable) +void GraphModifier::setFpsMeasurement(int enable) { m_graph->setMeasureFps(enable); } @@ -1624,6 +1602,18 @@ void GraphModifier::setSpacingSpecsZ(int spacing) m_graph->setBarSpacing(QSizeF(m_barSpacingX, m_barSpacingZ)); } +void GraphModifier::setMarginX(int margin) +{ + m_barSeriesMarginX = (float)margin / 100.0f; + m_graph->setBarSeriesMargin(QSizeF(m_barSeriesMarginX, m_barSeriesMarginZ)); +} + +void GraphModifier::setMarginZ(int margin) +{ + m_barSeriesMarginZ = (float)margin / 100.0f; + m_graph->setBarSeriesMargin(QSizeF(m_barSeriesMarginX, m_barSeriesMarginZ)); +} + void GraphModifier::setSampleCountX(int samples) { m_columnCount = samples; @@ -1659,7 +1649,7 @@ void GraphModifier::setMaxY(int max) m_maxval = max; } -void GraphModifier::changeColorStyle() +void GraphModifier::changeColorStyle(bool checked) { int style = m_graph->activeTheme()->colorStyle(); @@ -1669,7 +1659,7 @@ void GraphModifier::changeColorStyle() m_graph->activeTheme()->setColorStyle(Q3DTheme::ColorStyle(style)); } -void GraphModifier::useOwnTheme() +void GraphModifier::useOwnTheme(bool checked) { // Own theme is persistent, any changes to it via UI will be remembered if (!m_ownTheme) { @@ -1708,7 +1698,7 @@ void GraphModifier::changeBaseColor(const QColor &color) m_graph->activeTheme()->setBaseColors(colors); } -void GraphModifier::setGradient() +void GraphModifier::setGradient(bool checked) { QLinearGradient barGradient(0, 0, 1, 100); barGradient.setColorAt(1.0, Qt::lightGray); @@ -1748,7 +1738,7 @@ void GraphModifier::toggleMultiseriesScaling() m_graph->setMultiSeriesUniform(!m_graph->isMultiSeriesUniform()); } -void GraphModifier::setReflection(bool enabled) +void GraphModifier::setReflection(int enabled) { m_graph->setReflection(enabled); } diff --git a/tests/manual/barstest/chart.h b/tests/manual/barstest/chart.h index eb5b948b..ae72318e 100644 --- a/tests/manual/barstest/chart.h +++ b/tests/manual/barstest/chart.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef CHARTMODIFIER_H #define CHARTMODIFIER_H @@ -42,8 +16,6 @@ #include <QTimer> #include <QLabel> -using namespace QtDataVisualization; - class GraphModifier : public QObject { Q_OBJECT @@ -70,13 +42,15 @@ public: void changeFontSize(int fontsize); void rotateX(int rotation); void rotateY(int rotation); - void setFpsMeasurement(bool enable); + void setFpsMeasurement(int state); void setBackgroundEnabled(int enabled); void setGridEnabled(int enabled); void setSpecsRatio(int barwidth); void setSpecsZ(int bardepth); void setSpacingSpecsX(int spacing); void setSpacingSpecsZ(int spacing); + void setMarginX(int margin); + void setMarginZ(int margin); void setSampleCountX(int samples); void setSampleCountZ(int samples); void setMinX(int min); @@ -84,43 +58,43 @@ public: void setMinY(int min); void setMaxY(int max); void start(); - void restart(bool dynamicData); + void restart(int dynamicData); void selectBar(); void swapAxis(); void releaseAxes(); void releaseSeries(); void createMassiveArray(); - void useOwnTheme(); + void useOwnTheme(bool checked); void changeBaseColor(const QColor &color); - void changeColorStyle(); + void changeColorStyle(bool checked); void showFiveSeries(); QBarDataArray *makeDummyData(); - void primarySeriesTest(); + void primarySeriesTest(bool checked); void insertRemoveTestToggle(); - void toggleRotation(); - void useLogAxis(); + void toggleRotation(bool checked); + void useLogAxis(bool checked); void changeValueAxisFormat(const QString & text); void changeLogBase(const QString & text); void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } void addRemoveSeries(); - void testItemAndRowChanges(); + void testItemAndRowChanges(bool checked); void reverseValueAxis(int enabled); void setInputHandlerRotationEnabled(int enabled); void setInputHandlerZoomEnabled(int enabled); void setInputHandlerSelectionEnabled(int enabled); void setInputHandlerZoomAtTargetEnabled(int enabled); - void setReflection(bool enabled); + void setReflection(int enabled); void setReflectivity(int value); void toggleCustomItem(); public Q_SLOTS: - void flipViews(); - void setGradient(); + void flipViews(bool checked); + void setGradient(bool checked); void toggleMultiseriesScaling(); void changeShadowQuality(int quality); void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality); void handleSelectionChange(const QPoint &position); - void setUseNullInputHandler(bool useNull); + void setUseNullInputHandler(int useNull); void changeValueAxisSegments(int value); void handleRowAxisChanged(QCategory3DAxis *axis); @@ -152,9 +126,11 @@ private: int m_rowCount; float m_xRotation; float m_yRotation; - bool m_static; + int m_static; float m_barSpacingX; float m_barSpacingZ; + float m_barSeriesMarginX; + float m_barSeriesMarginZ; int m_fontSize; int m_segments; int m_subSegments; diff --git a/tests/manual/barstest/custominputhandler.cpp b/tests/manual/barstest/custominputhandler.cpp index e6fe9aa5..2740fddb 100644 --- a/tests/manual/barstest/custominputhandler.cpp +++ b/tests/manual/barstest/custominputhandler.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "custominputhandler.h" diff --git a/tests/manual/barstest/custominputhandler.h b/tests/manual/barstest/custominputhandler.h index ef07d5ec..ee762cee 100644 --- a/tests/manual/barstest/custominputhandler.h +++ b/tests/manual/barstest/custominputhandler.h @@ -1,47 +1,19 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef CUSTOMINPUTHANDLER_H #define CUSTOMINPUTHANDLER_H #include <QtDataVisualization/QAbstract3DInputHandler> -using namespace QtDataVisualization; - class CustomInputHandler : public QAbstract3DInputHandler { Q_OBJECT public: explicit CustomInputHandler(QObject *parent = 0); - virtual void mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos); - virtual void wheelEvent(QWheelEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos) override; + virtual void wheelEvent(QWheelEvent *event) override; }; #endif diff --git a/tests/manual/barstest/main.cpp b/tests/manual/barstest/main.cpp index 88c1884f..178b91f3 100644 --- a/tests/manual/barstest/main.cpp +++ b/tests/manual/barstest/main.cpp @@ -1,33 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "chart.h" +#include "sliderwrapper.h" +#include "buttonwrapper.h" #include <QApplication> #include <QWidget> @@ -52,6 +28,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); // Test creating custom items before graph is created @@ -303,6 +280,18 @@ int main(int argc, char **argv) spacingSliderZ->setValue(10); spacingSliderZ->setMaximum(200); + QSlider *marginSliderX = new QSlider(Qt::Horizontal, widget); + marginSliderX->setTickInterval(1); + marginSliderX->setMinimum(0); + marginSliderX->setValue(0); + marginSliderX->setMaximum(100); + + QSlider *marginSliderZ = new QSlider(Qt::Horizontal, widget); + marginSliderZ->setTickInterval(1); + marginSliderZ->setMinimum(0); + marginSliderZ->setValue(0); + marginSliderZ->setMaximum(100); + QSlider *sampleSliderX = new QSlider(Qt::Horizontal, widget); sampleSliderX->setTickInterval(1); sampleSliderX->setMinimum(1); @@ -432,6 +421,9 @@ int main(int argc, char **argv) vLayout2->addWidget(new QLabel(QStringLiteral("Adjust relative bar spacing")), 0, Qt::AlignTop); vLayout2->addWidget(spacingSliderX, 0, Qt::AlignTop); vLayout2->addWidget(spacingSliderZ, 0, Qt::AlignTop); + vLayout2->addWidget(new QLabel(QStringLiteral("Adjust margin")), 0, Qt::AlignTop); + vLayout2->addWidget(marginSliderX, 0, Qt::AlignTop); + vLayout2->addWidget(marginSliderZ, 0, Qt::AlignTop); vLayout2->addWidget(new QLabel(QStringLiteral("Adjust sample count")), 0, Qt::AlignTop); vLayout2->addWidget(sampleSliderX, 0, Qt::AlignTop); vLayout2->addWidget(sampleSliderZ, 0, Qt::AlignTop); @@ -471,7 +463,7 @@ int main(int argc, char **argv) vLayout3->addWidget(toggleCustomItemButton, 0, Qt::AlignTop); vLayout3->addWidget(new QLabel(QStringLiteral("Adjust floor level")), 0, Qt::AlignTop); vLayout3->addWidget(floorLevelSlider, 0, Qt::AlignTop); - vLayout3->addWidget(new QLabel(QStringLiteral("Adjust margin")), 0, Qt::AlignTop); + vLayout3->addWidget(new QLabel(QStringLiteral("Adjust bar series margin")), 0, Qt::AlignTop); vLayout3->addWidget(marginSlider, 1, Qt::AlignTop); widget->show(); @@ -488,6 +480,9 @@ int main(int argc, char **argv) QObject::connect(spacingSliderZ, &QSlider::valueChanged, modifier, &GraphModifier::setSpacingSpecsZ); + QObject::connect(marginSliderX, &QSlider::valueChanged, modifier, &GraphModifier::setMarginX); + QObject::connect(marginSliderZ, &QSlider::valueChanged, modifier, &GraphModifier::setMarginZ); + QObject::connect(sampleSliderX, &QSlider::valueChanged, modifier, &GraphModifier::setSampleCountX); QObject::connect(sampleSliderZ, &QSlider::valueChanged, modifier, @@ -594,12 +589,14 @@ int main(int argc, char **argv) QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, modifier, &GraphModifier::setUseNullInputHandler); - QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, - &QSlider::setEnabled); + SliderWrapper *rotationSliderWrapperX = new SliderWrapper(rotationSliderX); + SliderWrapper *rotationSliderWrapperY = new SliderWrapper(rotationSliderY); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderWrapperX, + &SliderWrapper::setEnabled); QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, &QSlider::setValue); - QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, - &QSlider::setEnabled); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderWrapperY, + &SliderWrapper::setEnabled); QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, &QSlider::setValue); @@ -614,40 +611,59 @@ int main(int argc, char **argv) QObject::connect(toggleCustomItemButton, &QPushButton::clicked, modifier, &GraphModifier::toggleCustomItem); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addMultiDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertMultiDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeSingleDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowsButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowsButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, massiveArrayButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderX, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderZ, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderX, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderZ, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderY, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, maxSliderY, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, swapAxisButton, - &QSlider::setEnabled); + ButtonWrapper *addDataButtonWrapper = new ButtonWrapper(addDataButton); + ButtonWrapper *addMultiDataButtonWrapper = new ButtonWrapper(addMultiDataButton); + ButtonWrapper *insertDataButtonWrapper = new ButtonWrapper(insertDataButton); + ButtonWrapper *insertMultiDataButtonWrapper = new ButtonWrapper(insertMultiDataButton); + ButtonWrapper *changeSingleDataButtonWrapper = new ButtonWrapper(changeSingleDataButton); + ButtonWrapper *changeRowButtonWrapper = new ButtonWrapper(changeRowButton); + ButtonWrapper *changeRowsButtonWrapper = new ButtonWrapper(changeRowsButton); + ButtonWrapper *massiveArrayButtonWrapper = new ButtonWrapper(massiveArrayButton); + ButtonWrapper *removeRowButtonWrapper = new ButtonWrapper(removeRowButton); + ButtonWrapper *removeRowsButtonWrapper = new ButtonWrapper(removeRowsButton); + + SliderWrapper *sampleSliderWrapperX = new SliderWrapper(sampleSliderX); + SliderWrapper *sampleSliderWrapperZ = new SliderWrapper(sampleSliderZ); + SliderWrapper *minSliderWrapperX = new SliderWrapper(minSliderX); + SliderWrapper *minSliderWrapperZ = new SliderWrapper(minSliderZ); + SliderWrapper *minSliderWrapperY = new SliderWrapper(minSliderY); + SliderWrapper *maxSliderWrapperY = new SliderWrapper(maxSliderY); + ButtonWrapper *swapAxisButtonWrapper = new ButtonWrapper(swapAxisButton); + + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addMultiDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertMultiDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeSingleDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowsButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowsButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, massiveArrayButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderWrapperX, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderWrapperZ, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperX, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperZ, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperY, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, maxSliderWrapperY, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, swapAxisButtonWrapper, + &ButtonWrapper::setEnabled); QObject::connect(staticCheckBox, &QCheckBox::stateChanged, modifier, &GraphModifier::restart); modifier->setFpsLabel(fpsLabel); diff --git a/tests/manual/barstest/sliderwrapper.cpp b/tests/manual/barstest/sliderwrapper.cpp new file mode 100644 index 00000000..bdfeb4f7 --- /dev/null +++ b/tests/manual/barstest/sliderwrapper.cpp @@ -0,0 +1,13 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "sliderwrapper.h" + +SliderWrapper::SliderWrapper(QSlider *slider) +{ + m_slider = slider; +} + +void SliderWrapper::setEnabled(int enabled) +{ + m_slider->setEnabled(enabled); +} diff --git a/tests/manual/barstest/sliderwrapper.h b/tests/manual/barstest/sliderwrapper.h new file mode 100644 index 00000000..f6d9404a --- /dev/null +++ b/tests/manual/barstest/sliderwrapper.h @@ -0,0 +1,23 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef SLIDERWRAPPER_H +#define SLIDERWRAPPER_H +#include <QObject> +#include <QSlider> + +class SliderWrapper : public QObject +{ + Q_OBJECT + +public: + explicit SliderWrapper(QSlider *slider); + +public Q_SLOTS: + void setEnabled(int enabled); + +private: + QSlider *m_slider = nullptr; + +}; + +#endif // SLIDERWRAPPER_H diff --git a/tests/manual/directional/CMakeLists.txt b/tests/manual/directional/CMakeLists.txt new file mode 100644 index 00000000..43b961e0 --- /dev/null +++ b/tests/manual/directional/CMakeLists.txt @@ -0,0 +1,16 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(directional + GUI + SOURCES + main.cpp + scatterdatamodifier.cpp scatterdatamodifier.h + ) +target_link_libraries(directional PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) diff --git a/tests/manual/directional/main.cpp b/tests/manual/directional/main.cpp index a3e7bb8b..66b80d40 100644 --- a/tests/manual/directional/main.cpp +++ b/tests/manual/directional/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "scatterdatamodifier.h" @@ -43,6 +17,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); Q3DScatter *graph = new Q3DScatter(); QWidget *container = QWidget::createWindowContainer(graph); diff --git a/tests/manual/directional/scatterdatamodifier.cpp b/tests/manual/directional/scatterdatamodifier.cpp index 2a98625d..b537a8a2 100644 --- a/tests/manual/directional/scatterdatamodifier.cpp +++ b/tests/manual/directional/scatterdatamodifier.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "scatterdatamodifier.h" #include <QtDataVisualization/qscatterdataproxy.h> @@ -37,8 +11,6 @@ #include <qmath.h> #include <QComboBox> -using namespace QtDataVisualization; - const int numberOfCols = 8; const int numberOfRows = 8; const float limit = 8.0f; diff --git a/tests/manual/directional/scatterdatamodifier.h b/tests/manual/directional/scatterdatamodifier.h index 447e1603..c794d17c 100644 --- a/tests/manual/directional/scatterdatamodifier.h +++ b/tests/manual/directional/scatterdatamodifier.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef SCATTERDATAMODIFIER_H #define SCATTERDATAMODIFIER_H @@ -35,8 +9,6 @@ #include <QtGui/QFont> #include <QtCore/QTimer> -using namespace QtDataVisualization; - class ScatterDataModifier : public QObject { Q_OBJECT @@ -67,7 +39,7 @@ Q_SIGNALS: void backgroundEnabledChanged(bool enabled); void gridEnabledChanged(bool enabled); void shadowQualityChanged(int quality); - void fontChanged(QFont font); + void fontChanged(const QFont &font); private: Q3DScatter *m_graph; diff --git a/tests/manual/galaxy/CMakeLists.txt b/tests/manual/galaxy/CMakeLists.txt new file mode 100644 index 00000000..f089ed7d --- /dev/null +++ b/tests/manual/galaxy/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +qt_add_executable(galaxy + cumulativedistributor.cpp cumulativedistributor.h + galaxydata.cpp galaxydata.h + main.cpp + star.cpp star.h + ) +target_link_libraries(galaxy PUBLIC + Qt::Gui + Qt::Widgets + ) diff --git a/tests/manual/galaxy/cumulativedistributor.cpp b/tests/manual/galaxy/cumulativedistributor.cpp index 4506480c..961583ff 100644 --- a/tests/manual/galaxy/cumulativedistributor.cpp +++ b/tests/manual/galaxy/cumulativedistributor.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only /* * Galaxy creation code obtained from http://beltoforion.de/galaxy/galaxy_en.html diff --git a/tests/manual/galaxy/cumulativedistributor.h b/tests/manual/galaxy/cumulativedistributor.h index 56276e98..60c48ccc 100644 --- a/tests/manual/galaxy/cumulativedistributor.h +++ b/tests/manual/galaxy/cumulativedistributor.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only /* * Galaxy creation code obtained from http://beltoforion.de/galaxy/galaxy_en.html diff --git a/tests/manual/galaxy/galaxydata.cpp b/tests/manual/galaxy/galaxydata.cpp index c49e07fd..73ccf9c5 100644 --- a/tests/manual/galaxy/galaxydata.cpp +++ b/tests/manual/galaxy/galaxydata.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only /* * Galaxy creation code obtained from http://beltoforion.de/galaxy/galaxy_en.html diff --git a/tests/manual/galaxy/galaxydata.h b/tests/manual/galaxy/galaxydata.h index e01db67b..6127482e 100644 --- a/tests/manual/galaxy/galaxydata.h +++ b/tests/manual/galaxy/galaxydata.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef SCATTERDATAMODIFIER_H #define SCATTERDATAMODIFIER_H diff --git a/tests/manual/galaxy/main.cpp b/tests/manual/galaxy/main.cpp index 5fb7b0ca..a0cbda52 100644 --- a/tests/manual/galaxy/main.cpp +++ b/tests/manual/galaxy/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "galaxydata.h" diff --git a/tests/manual/galaxy/star.cpp b/tests/manual/galaxy/star.cpp index ca6b66f0..5b639125 100644 --- a/tests/manual/galaxy/star.cpp +++ b/tests/manual/galaxy/star.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "star.h" diff --git a/tests/manual/galaxy/star.h b/tests/manual/galaxy/star.h index 9c5dc1ac..045a9702 100644 --- a/tests/manual/galaxy/star.h +++ b/tests/manual/galaxy/star.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef STAR_H #define STAR_H diff --git a/tests/manual/itemmodeltest/CMakeLists.txt b/tests/manual/itemmodeltest/CMakeLists.txt new file mode 100644 index 00000000..8fee8d00 --- /dev/null +++ b/tests/manual/itemmodeltest/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(itemmodeltest + GUI + SOURCES + main.cpp + ) +target_link_libraries(itemmodeltest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) diff --git a/tests/manual/itemmodeltest/main.cpp b/tests/manual/itemmodeltest/main.cpp index 90a2e74e..feebd1b1 100644 --- a/tests/manual/itemmodeltest/main.cpp +++ b/tests/manual/itemmodeltest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtDataVisualization/q3dbars.h> #include <QtDataVisualization/q3dsurface.h> @@ -50,8 +24,6 @@ #define USE_STATIC_DATA -using namespace QtDataVisualization; - class GraphDataGenerator : public QObject { public: @@ -236,8 +208,8 @@ void GraphDataGenerator::changeSelectedButtonClicked() { // Change all selected cells to a random value 1-10 QVariant value = QVariant::fromValue(QRandomGenerator::global()->bounded(10.0) + 1); - QList<QTableWidgetItem *> selectedItems = m_tableWidget->selectedItems(); - foreach (QTableWidgetItem *item, selectedItems) { + const QList<QTableWidgetItem *> selectedItems = m_tableWidget->selectedItems(); + for (QTableWidgetItem *item : selectedItems) { QString oldData = item->data(Qt::DisplayRole).toString(); item->setData(Qt::DisplayRole, oldData.left(5) @@ -249,6 +221,7 @@ void GraphDataGenerator::changeSelectedButtonClicked() int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); Q3DBars *barGraph = new Q3DBars(); Q3DSurface *surfaceGraph = new Q3DSurface(); @@ -288,17 +261,17 @@ int main(int argc, char **argv) barProxy->setUseModelCategories(true); surfaceProxy->setUseModelCategories(true); barProxy->setRotationRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); - barProxy->setValueRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); - barProxy->setRotationRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)\\d*\\/\\d*([\\.\\,]?)\\d*(\\/)(\\d*[\\.\\,]?\\d*)$"))); + barProxy->setValueRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); + barProxy->setRotationRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)\\d*\\/\\d*([\\.\\,]?)\\d*(\\/)(\\d*[\\.\\,]?\\d*)$"))); barProxy->setValueRoleReplace(QStringLiteral("\\4")); barProxy->setRotationRoleReplace(QStringLiteral("\\5")); surfaceProxy->setXPosRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); - surfaceProxy->setZPosRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); - surfaceProxy->setXPosRolePattern(QRegExp(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + surfaceProxy->setYPosRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); + surfaceProxy->setXPosRolePattern(QRegularExpression(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); surfaceProxy->setXPosRoleReplace(QStringLiteral("\\2")); - surfaceProxy->setYPosRolePattern(QRegExp(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); + surfaceProxy->setYPosRolePattern(QRegularExpression(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); surfaceProxy->setYPosRoleReplace(QStringLiteral("\\3")); - surfaceProxy->setZPosRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + surfaceProxy->setZPosRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); surfaceProxy->setZPosRoleReplace(QStringLiteral("\\1")); QBar3DSeries *barSeries = new QBar3DSeries(barProxy); QSurface3DSeries *surfaceSeries = new QSurface3DSeries(surfaceProxy); diff --git a/tests/manual/minimalbars/CMakeLists.txt b/tests/manual/minimalbars/CMakeLists.txt new file mode 100644 index 00000000..50ae8a61 --- /dev/null +++ b/tests/manual/minimalbars/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(MinimalBars + GUI + SOURCES + ../../../src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp + ) +target_link_libraries(MinimalBars PUBLIC + Qt::Gui + Qt::DataVisualization + ) diff --git a/tests/manual/minimalscatter/CMakeLists.txt b/tests/manual/minimalscatter/CMakeLists.txt new file mode 100644 index 00000000..5f9c07ae --- /dev/null +++ b/tests/manual/minimalscatter/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(MinimalScatter + GUI + SOURCES + ../../../src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp + ) +target_link_libraries(MinimalScatter PUBLIC + Qt::Gui + Qt::DataVisualization + ) diff --git a/tests/manual/minimalsurface/CMakeLists.txt b/tests/manual/minimalsurface/CMakeLists.txt new file mode 100644 index 00000000..39c3b04d --- /dev/null +++ b/tests/manual/minimalsurface/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(MinimalSurface + GUI + SOURCES + ../../../src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp + ) +target_link_libraries(MinimalSurface PUBLIC + Qt::Gui + Qt::DataVisualization + ) diff --git a/tests/manual/multigraphs/CMakeLists.txt b/tests/manual/multigraphs/CMakeLists.txt new file mode 100644 index 00000000..8e6da82a --- /dev/null +++ b/tests/manual/multigraphs/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(multigraphs + GUI + SOURCES + data.cpp data.h + main.cpp + ) +target_link_libraries(multigraphs PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set(multigraphs_resource_files + "australia.png" + ) + +qt_internal_add_resource(multigraphs "multigraphs" + PREFIX + "/" + FILES + ${multigraphs_resource_files} + ) diff --git a/tests/manual/multigraphs/data.cpp b/tests/manual/multigraphs/data.cpp index 8279e3e6..b46c6a0d 100644 --- a/tests/manual/multigraphs/data.cpp +++ b/tests/manual/multigraphs/data.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #define NOMINMAX @@ -40,8 +14,6 @@ #include <QSize> #include <QImage> -using namespace QtDataVisualization; - Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, QTextEdit *statusArea, QWidget *widget) : m_surface(surface), diff --git a/tests/manual/multigraphs/data.h b/tests/manual/multigraphs/data.h index 8f759f6a..a2c43452 100644 --- a/tests/manual/multigraphs/data.h +++ b/tests/manual/multigraphs/data.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef DATA_H #define DATA_H @@ -38,8 +12,6 @@ #include <QtDataVisualization/QHeightMapSurfaceDataProxy> #include <QTextEdit> -using namespace QtDataVisualization; - class Data : public QObject { Q_OBJECT diff --git a/tests/manual/multigraphs/main.cpp b/tests/manual/multigraphs/main.cpp index a4d4211f..b13dd2ce 100644 --- a/tests/manual/multigraphs/main.cpp +++ b/tests/manual/multigraphs/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "data.h" @@ -43,6 +17,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); QWidget *widget = new QWidget(); diff --git a/tests/manual/qmlbarsrowcolors/CMakeLists.txt b/tests/manual/qmlbarsrowcolors/CMakeLists.txt new file mode 100644 index 00000000..62a2ed98 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlbarsrowcolors + GUI + SOURCES + main.cpp + ) + +target_link_libraries(qmlbarsrowcolors PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization +) + +set(qmlbarsrowcolors_resource_files + "qml/qmlbarsrowcolors/Axes.qml" + "qml/qmlbarsrowcolors/Data.qml" + "qml/qmlbarsrowcolors/main.qml" +) + +qt6_add_resources(qmlbarsrowcolors "qmlbarsrowcolors" + PREFIX + "/" + FILES + ${qmlbarsrowcolors_resource_files} +) diff --git a/tests/manual/qmlbarsrowcolors/main.cpp b/tests/manual/qmlbarsrowcolors/main.cpp new file mode 100644 index 00000000..83a1a78a --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/main.cpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtGui/QGuiApplication> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QSG_RHI_BACKEND", "opengl"); + QGuiApplication app(argc, argv); + + QQuickView viewer; + + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../../%2")); +#else + QString extraImportPath(QStringLiteral("%1/../../../%2")); +#endif + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + + viewer.setTitle(QStringLiteral("Monthly income/expenses")); + + viewer.setSource(QUrl("qrc:/qml/qmlbarsrowcolors/main.qml")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.show(); + + return app.exec(); +} diff --git a/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml new file mode 100644 index 00000000..0e021c34 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml @@ -0,0 +1,41 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtDataVisualization + +Item { + property alias column: columnAxis + property alias row: rowAxis + property alias value: valueAxis + property alias total: totalAxis + + // Custom labels for columns, since the data contains abbreviated month names. + //! [0] + CategoryAxis3D { + id: columnAxis + labels: ["January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December"] + labelAutoRotation: 30 + } + //! [0] + CategoryAxis3D { + id: totalAxis + labels: ["Yearly total"] + labelAutoRotation: 30 + } + CategoryAxis3D { + // For row labels we can use row labels from data proxy, no labels defined for rows. + id: rowAxis + labelAutoRotation: 30 + } + + ValueAxis3D { + id: valueAxis + min: 0 + max: 35 + labelFormat: "%.2f M\u20AC" + title: "Monthly income" + labelAutoRotation: 90 + } +} diff --git a/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml new file mode 100644 index 00000000..6eb27741 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml @@ -0,0 +1,118 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQml.Models + +Item { + property alias model: dataModel + + property var modelAsJsArray: { + var arr = [] + for (var i = 0; i < dataModel.count; i++) { + var row = dataModel.get(i) + arr.push({ + timestamp: row.timestamp, + expenses: row.expenses, + income: row.income + }) + } + return arr + } + + //! [0] + ListModel { + id: dataModel + ListElement{ timestamp: "2006-01"; expenses: "-4"; income: "5" } + ListElement{ timestamp: "2006-02"; expenses: "-5"; income: "6" } + ListElement{ timestamp: "2006-03"; expenses: "-7"; income: "4" } + //! [0] + ListElement{ timestamp: "2006-04"; expenses: "-3"; income: "2" } + ListElement{ timestamp: "2006-05"; expenses: "-4"; income: "1" } + ListElement{ timestamp: "2006-06"; expenses: "-2"; income: "2" } + ListElement{ timestamp: "2006-07"; expenses: "-1"; income: "3" } + ListElement{ timestamp: "2006-08"; expenses: "-5"; income: "1" } + ListElement{ timestamp: "2006-09"; expenses: "-2"; income: "3" } + ListElement{ timestamp: "2006-10"; expenses: "-5"; income: "2" } + ListElement{ timestamp: "2006-11"; expenses: "-8"; income: "5" } + ListElement{ timestamp: "2006-12"; expenses: "-3"; income: "3" } + + ListElement{ timestamp: "2007-01"; expenses: "-3"; income: "1" } + ListElement{ timestamp: "2007-02"; expenses: "-4"; income: "2" } + ListElement{ timestamp: "2007-03"; expenses: "-12"; income: "4" } + ListElement{ timestamp: "2007-04"; expenses: "-13"; income: "6" } + ListElement{ timestamp: "2007-05"; expenses: "-14"; income: "11" } + ListElement{ timestamp: "2007-06"; expenses: "-7"; income: "7" } + ListElement{ timestamp: "2007-07"; expenses: "-6"; income: "4" } + ListElement{ timestamp: "2007-08"; expenses: "-4"; income: "15" } + ListElement{ timestamp: "2007-09"; expenses: "-2"; income: "18" } + ListElement{ timestamp: "2007-10"; expenses: "-29"; income: "25" } + ListElement{ timestamp: "2007-11"; expenses: "-23"; income: "29" } + ListElement{ timestamp: "2007-12"; expenses: "-5"; income: "9" } + + ListElement{ timestamp: "2008-01"; expenses: "-3"; income: "8" } + ListElement{ timestamp: "2008-02"; expenses: "-8"; income: "14" } + ListElement{ timestamp: "2008-03"; expenses: "-10"; income: "20" } + ListElement{ timestamp: "2008-04"; expenses: "-12"; income: "24" } + ListElement{ timestamp: "2008-05"; expenses: "-10"; income: "19" } + ListElement{ timestamp: "2008-06"; expenses: "-5"; income: "8" } + ListElement{ timestamp: "2008-07"; expenses: "-1"; income: "4" } + ListElement{ timestamp: "2008-08"; expenses: "-7"; income: "12" } + ListElement{ timestamp: "2008-09"; expenses: "-4"; income: "16" } + ListElement{ timestamp: "2008-10"; expenses: "-22"; income: "33" } + ListElement{ timestamp: "2008-11"; expenses: "-16"; income: "25" } + ListElement{ timestamp: "2008-12"; expenses: "-2"; income: "7" } + + ListElement{ timestamp: "2009-01"; expenses: "-4"; income: "5" } + ListElement{ timestamp: "2009-02"; expenses: "-4"; income: "7" } + ListElement{ timestamp: "2009-03"; expenses: "-11"; income: "14" } + ListElement{ timestamp: "2009-04"; expenses: "-16"; income: "22" } + ListElement{ timestamp: "2009-05"; expenses: "-3"; income: "5" } + ListElement{ timestamp: "2009-06"; expenses: "-4"; income: "8" } + ListElement{ timestamp: "2009-07"; expenses: "-7"; income: "9" } + ListElement{ timestamp: "2009-08"; expenses: "-9"; income: "13" } + ListElement{ timestamp: "2009-09"; expenses: "-1"; income: "6" } + ListElement{ timestamp: "2009-10"; expenses: "-14"; income: "25" } + ListElement{ timestamp: "2009-11"; expenses: "-19"; income: "29" } + ListElement{ timestamp: "2009-12"; expenses: "-5"; income: "7" } + + ListElement{ timestamp: "2010-01"; expenses: "-14"; income: "22" } + ListElement{ timestamp: "2010-02"; expenses: "-5"; income: "7" } + ListElement{ timestamp: "2010-03"; expenses: "-1"; income: "9" } + ListElement{ timestamp: "2010-04"; expenses: "-1"; income: "12" } + ListElement{ timestamp: "2010-05"; expenses: "-5"; income: "9" } + ListElement{ timestamp: "2010-06"; expenses: "-5"; income: "8" } + ListElement{ timestamp: "2010-07"; expenses: "-3"; income: "7" } + ListElement{ timestamp: "2010-08"; expenses: "-1"; income: "5" } + ListElement{ timestamp: "2010-09"; expenses: "-2"; income: "4" } + ListElement{ timestamp: "2010-10"; expenses: "-10"; income: "13" } + ListElement{ timestamp: "2010-11"; expenses: "-12"; income: "17" } + ListElement{ timestamp: "2010-12"; expenses: "-6"; income: "9" } + + ListElement{ timestamp: "2011-01"; expenses: "-2"; income: "6" } + ListElement{ timestamp: "2011-02"; expenses: "-4"; income: "8" } + ListElement{ timestamp: "2011-03"; expenses: "-7"; income: "12" } + ListElement{ timestamp: "2011-04"; expenses: "-9"; income: "15" } + ListElement{ timestamp: "2011-05"; expenses: "-7"; income: "19" } + ListElement{ timestamp: "2011-06"; expenses: "-9"; income: "18" } + ListElement{ timestamp: "2011-07"; expenses: "-13"; income: "17" } + ListElement{ timestamp: "2011-08"; expenses: "-5"; income: "9" } + ListElement{ timestamp: "2011-09"; expenses: "-3"; income: "8" } + ListElement{ timestamp: "2011-10"; expenses: "-13"; income: "15" } + ListElement{ timestamp: "2011-11"; expenses: "-8"; income: "17" } + ListElement{ timestamp: "2011-12"; expenses: "-7"; income: "10" } + + ListElement{ timestamp: "2012-01"; expenses: "-12"; income: "16" } + ListElement{ timestamp: "2012-02"; expenses: "-24"; income: "28" } + ListElement{ timestamp: "2012-03"; expenses: "-27"; income: "22" } + ListElement{ timestamp: "2012-04"; expenses: "-29"; income: "25" } + ListElement{ timestamp: "2012-05"; expenses: "-27"; income: "29" } + ListElement{ timestamp: "2012-06"; expenses: "-19"; income: "18" } + ListElement{ timestamp: "2012-07"; expenses: "-13"; income: "17" } + ListElement{ timestamp: "2012-08"; expenses: "-15"; income: "19" } + ListElement{ timestamp: "2012-09"; expenses: "-3"; income: "8" } + ListElement{ timestamp: "2012-10"; expenses: "-3"; income: "6" } + ListElement{ timestamp: "2012-11"; expenses: "-4"; income: "8" } + ListElement{ timestamp: "2012-12"; expenses: "-5"; income: "9" } + } +} diff --git a/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml new file mode 100644 index 00000000..2f15b453 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml @@ -0,0 +1,392 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtDataVisualization +import QtQuick.Window +import Qt.labs.qmlmodels +import "." + +Item { + id: mainview + + property int buttonLayoutHeight: 180; + property int currentRow + property Bar3DSeries selectedSeries + + function toggleRowColorsForBarSeries(enable) { + if (enable) + barSeries.rowColors = [color1, color2, color3] + else + barSeries.rowColors = [] + } + + function toggleRowColorsForSecondarySeries(enable) { + if (enable) + secondarySeries.rowColors = [color4, color5, color6] + else + secondarySeries.rowColors = [] + } + + function handleSelectionChange(series, position) { + if (position !== series.invalidSelectionPosition) + selectedSeries = series + + // Set tableView current row to selected bar + var rowRole = series.dataProxy.rowLabels[position.x]; + var colRole + if (barGraph.columnAxis === graphAxes.total) + colRole = "01"; + else + colRole = series.dataProxy.columnLabels[position.y]; + var checkTimestamp = rowRole + "-" + colRole + + if (currentRow === -1 || checkTimestamp !== graphData.model.get(currentRow).timestamp) { + var totalRows = tableView.rows; + for (var i = 0; i < totalRows; i++) { + var modelTimestamp = graphData.model.get(i).timestamp + if (modelTimestamp === checkTimestamp) { + currentRow = i + break + } + } + } + } + + width: 1280 + height: 1024 + + state: Screen.width < Screen.height ? "portrait" : "landscape" + selectedSeries: barSeries + + onCurrentRowChanged: { + var timestamp = graphData.model.get(currentRow).timestamp + var pattern = /(\d\d\d\d)-(\d\d)/ + var matches = pattern.exec(timestamp) + var rowIndex = modelProxy.rowCategoryIndex(matches[1]) + var colIndex + if (barGraph.columnAxis === graphAxes.total) + colIndex = 0 // Just one column when showing yearly totals + else + colIndex = modelProxy.columnCategoryIndex(matches[2]) + if (selectedSeries.visible) + mainview.selectedSeries.selectedBar = Qt.point(rowIndex, colIndex) + else if (barSeries.visible) + barSeries.selectedBar = Qt.point(rowIndex, colIndex) + else + secondarySeries.selectedBar = Qt.point(rowIndex, colIndex) + } + + Data { + id: graphData + } + + Axes { + id: graphAxes + } + + ThemeColor { + id: color1 + color: "green" + } + + ThemeColor { + id: color2 + color: "blue" + } + + ThemeColor { + id: color3 + color: "red" + } + + ThemeColor { + id: color4 + color: "yellow" + } + + ThemeColor { + id: color5 + color: "purple" + } + + ThemeColor { + id: color6 + color: "orange" + } + + Theme3D { + id: theme1 + type: Theme3D.ThemeRetro + labelBorderEnabled: true + font.pointSize: 35 + labelBackgroundEnabled: true + colorStyle: Theme3D.ColorStyleUniform + } + + Theme3D { + id: theme2 + type: Theme3D.ThemeArmyBlue + labelBorderEnabled: true + font.pointSize: 35 + labelBackgroundEnabled: true + colorStyle: Theme3D.ColorStyleUniform + } + + Item { + id: dataView + anchors.right: mainview.right; + anchors.bottom: mainview.bottom + + Bars3D { + id: barGraph + width: dataView.width + height: dataView.height + shadowQuality: AbstractGraph3D.ShadowQualityMedium + selectionMode: AbstractGraph3D.SelectionItem + theme: theme1 + barThickness: 0.7 + barSpacing: Qt.size(0.5, 0.5) + barSpacingRelative: false + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh + columnAxis: graphAxes.column + rowAxis: graphAxes.row + valueAxis: graphAxes.value + + Bar3DSeries { + id: secondarySeries + visible: false + itemLabelFormat: "Expenses, @colLabel, @rowLabel: -@valueLabel" + rowColors: [color4 , color5, color6] + + onSelectedBarChanged: (position)=> handleSelectionChange(secondarySeries, position) + + ItemModelBarDataProxy { + id: secondaryProxy + itemModel: graphData.model + rowRole: "timestamp" + columnRole: "timestamp" + valueRole: "expenses" + rowRolePattern: /^(\d\d\d\d).*$/ + columnRolePattern: /^.*-(\d\d)$/ + valueRolePattern: /-/ + rowRoleReplace: "\\1" + columnRoleReplace: "\\1" + multiMatchBehavior: ItemModelBarDataProxy.MMBCumulative + } + } + + Bar3DSeries { + id: barSeries + itemLabelFormat: "Income, @colLabel, @rowLabel: @valueLabel" + rowColors: [color1, color2, color3] + + onSelectedBarChanged: (position)=> handleSelectionChange(barSeries, position) + + ItemModelBarDataProxy { + id: modelProxy + itemModel: graphData.model + rowRole: "timestamp" + columnRole: "timestamp" + valueRole: "income" + rowRolePattern: /^(\d\d\d\d).*$/ + columnRolePattern: /^.*-(\d\d)$/ + rowRoleReplace: "\\1" + columnRoleReplace: "\\1" + multiMatchBehavior: ItemModelBarDataProxy.MMBCumulative + } + } + } + } + + ColumnLayout { + id: tableViewLayout + + anchors.top: parent.top + anchors.left: parent.left + + HorizontalHeaderView { + id: header + property var columnNames: ["Month", "Expenses", "Income"] + + syncView: tableView + Layout.fillWidth: true + delegate: Text { + padding: 3 + text: header.columnNames[index] + } + + } + + TableView { + id: tableView + Layout.fillWidth: true + Layout.fillHeight: true + + reuseItems: false + clip: true + + model: TableModel { + id: tableModel + TableModelColumn { display: "timestamp" } + TableModelColumn { display: "expenses" } + TableModelColumn { display: "income" } + + rows: graphData.modelAsJsArray + } + + delegate: Rectangle { + implicitHeight: 30 + implicitWidth: tableView.width / 3 + color: row === currentRow ? "#e0e0e0" : "#ffffff" + MouseArea { + anchors.fill: parent + onClicked: currentRow = row + } + + Text { + id: delegateText + anchors.verticalCenter: parent.verticalCenter + width: parent.width + anchors.leftMargin: 4 + anchors.left: parent.left + anchors.right: parent.right + text: formattedText + property string formattedText: { + if (column === 0) { + if (display !== "") { + var pattern = /(\d\d\d\d)-(\d\d)/ + var matches = pattern.exec(display) + var colIndex = parseInt(matches[2], 10) - 1 + return matches[1] + " - " + graphAxes.column.labels[colIndex] + } + } else { + return display + } + } + } + } + } + } + + ColumnLayout { + id: controlLayout + spacing: 0 + + Button { + id: seriesToggle + Layout.fillWidth: true + Layout.fillHeight: true + text: "Show Expenses" + clip: true + + onClicked: { + if (text === "Show Expenses") { + barSeries.visible = false + secondarySeries.visible = true + barGraph.valueAxis.labelFormat = "-%.2f M\u20AC" + secondarySeries.itemLabelFormat = "Expenses, @colLabel, @rowLabel: @valueLabel" + text = "Show Both" + } else if (text === "Show Both") { + barSeries.visible = true + barGraph.valueAxis.labelFormat = "%.2f M\u20AC" + secondarySeries.itemLabelFormat = "Expenses, @colLabel, @rowLabel: -@valueLabel" + text = "Show Income" + } else { // text === "Show Income" + secondarySeries.visible = false + text = "Show Expenses" + } + } + } + + Button { + id: themeToggle + Layout.fillWidth: true + Layout.fillHeight: true + text: "Use theme 2" + clip: true + + onClicked: { + if (text === "Use theme 2") { + barGraph.theme = theme2 + text = "Use theme 1" + } else { + barGraph.theme = theme1 + text = "Use theme 2" + } + } + } + + Button { + id: barSeriesRowColorToggle + Layout.fillWidth: true + Layout.fillHeight: true + text: "Disable row colors" + + onClicked: { + if (text === "Disable row colors") { + toggleRowColorsForBarSeries(false) + toggleRowColorsForSecondarySeries(false) + text = "Enable row colors" + } else { + toggleRowColorsForBarSeries(true) + toggleRowColorsForSecondarySeries(true) + text = "Disable row colors" + } + } + } + } + + states: [ + State { + name: "landscape" + PropertyChanges { + target: dataView + width: mainview.width / 4 * 3 + height: mainview.height + } + PropertyChanges { + target: tableViewLayout + height: mainview.height - buttonLayoutHeight + anchors.right: dataView.left + anchors.left: mainview.left + anchors.bottom: undefined + } + PropertyChanges { + target: controlLayout + width: mainview.width / 4 + height: buttonLayoutHeight + anchors.top: tableViewLayout.bottom + anchors.bottom: mainview.bottom + anchors.left: mainview.left + anchors.right: dataView.left + } + }, + State { + name: "portrait" + PropertyChanges { + target: dataView + width: mainview.height / 4 * 3 + height: mainview.width + } + PropertyChanges { + target: tableViewLayout + height: mainview.width + anchors.right: controlLayout.left + anchors.left: mainview.left + anchors.bottom: dataView.top + } + PropertyChanges { + target: controlLayout + width: mainview.height / 4 + height: mainview.width / 4 + anchors.top: mainview.top + anchors.bottom: dataView.top + anchors.left: undefined + anchors.right: mainview.right + } + } + ] +} diff --git a/tests/manual/qmldynamicdata/CMakeLists.txt b/tests/manual/qmldynamicdata/CMakeLists.txt new file mode 100644 index 00000000..739ecd15 --- /dev/null +++ b/tests/manual/qmldynamicdata/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(qmldynamicdata + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmldynamicdata PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmldynamicdata_resource_files + "qml/qmldynamicdata/main.qml" + ) + +qt_internal_add_resource(qmldynamicdata "qmldynamicdata" + PREFIX + "/" + FILES + ${qmldynamicdata_resource_files} + ) diff --git a/tests/manual/qmldynamicdata/main.cpp b/tests/manual/qmldynamicdata/main.cpp index 3a69ca8f..6a416829 100644 --- a/tests/manual/qmldynamicdata/main.cpp +++ b/tests/manual/qmldynamicdata/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtGui/QGuiApplication> #include <QtCore/QDir> @@ -34,6 +8,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmldynamicdata/qml/qmldynamicdata/NewButton.qml b/tests/manual/qmldynamicdata/qml/qmldynamicdata/NewButton.qml deleted file mode 100644 index 54cdce24..00000000 --- a/tests/manual/qmldynamicdata/qml/qmldynamicdata/NewButton.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 - -Item { - id: newbutton - - property alias text: buttonText.text - - signal clicked - - height: 80 - - Button { - width: parent.width - height: parent.height - Text { - id: buttonText - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent - } - onClicked: newbutton.clicked() - } -} diff --git a/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml b/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml index a49a1184..1d0e65bf 100644 --- a/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml +++ b/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml @@ -1,37 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 -import QtDataVisualization 1.0 +import QtQuick +import QtDataVisualization 1.2 +import QtQuick.Controls import "." -Rectangle { +Item { id: mainView width: 1280 height: 720 @@ -154,15 +129,15 @@ Rectangle { anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - property int mouseX: -1 - property int mouseY: -1 + property int mouseXPos: -1 + property int mouseYPos: -1 - onPositionChanged: { - mouseX = mouse.x; - mouseY = mouse.y; + onPositionChanged: (mouse)=> { + mouseXPos = mouse.x; + mouseYPos = mouse.y; } - onWheel: { + onWheel: (wheel)=> { // Adjust zoom level based on what zoom range we're in. var zoomLevel = scatterGraph.scene.activeCamera.zoomLevel; if (zoomLevel > 100) @@ -186,7 +161,8 @@ Rectangle { running: true repeat: true onTriggered: { - scatterGraph.scene.selectionQueryPosition = Qt.point(inputArea.mouseX, inputArea.mouseY); + scatterGraph.scene.selectionQueryPosition = Qt.point(inputArea.mouseXPos, + inputArea.mouseYPos); } } } @@ -227,7 +203,7 @@ Rectangle { } } - NewButton { + Button { id: shadowToggle width: parent.width / 3 // We're adding 3 buttons and want to divide them equally text: "Hide Shadows" @@ -244,7 +220,7 @@ Rectangle { } } - NewButton { + Button { id: cameraToggle width: parent.width / 3 text: "Pause Camera" @@ -261,11 +237,11 @@ Rectangle { } } - NewButton { + Button { id: exitButton width: parent.width / 3 text: "Quit" anchors.left: cameraToggle.right - onClicked: Qt.quit(0); + onClicked: Qt.quit(); } } diff --git a/tests/manual/qmldynamicdata/qmldynamicdata.qrc b/tests/manual/qmldynamicdata/qmldynamicdata.qrc index 76641cf9..e1997ffc 100644 --- a/tests/manual/qmldynamicdata/qmldynamicdata.qrc +++ b/tests/manual/qmldynamicdata/qmldynamicdata.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> <file>qml/qmldynamicdata/main.qml</file> - <file>qml/qmldynamicdata/NewButton.qml</file> </qresource> </RCC> diff --git a/tests/manual/qmlgradient/CMakeLists.txt b/tests/manual/qmlgradient/CMakeLists.txt new file mode 100644 index 00000000..8288e1b2 --- /dev/null +++ b/tests/manual/qmlgradient/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(qmlgradient + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmlgradient PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlgradient_resource_files + "qml/qmlgradient/main.qml" + "crater.png" + ) + +set_source_files_properties("crater.png" + PROPERTIES QT_RESOURCE_ALIAS "map" + ) + +qt_internal_add_resource(qmlgradient "qmlgradient" + PREFIX + "/" + FILES + ${qmlgradient_resource_files} + ) diff --git a/tests/manual/qmlgradient/crater.png b/tests/manual/qmlgradient/crater.png Binary files differnew file mode 100644 index 00000000..91bba197 --- /dev/null +++ b/tests/manual/qmlgradient/crater.png diff --git a/tests/manual/qmlgradient/main.cpp b/tests/manual/qmlgradient/main.cpp new file mode 100644 index 00000000..b3a65f0f --- /dev/null +++ b/tests/manual/qmlgradient/main.cpp @@ -0,0 +1,37 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtGui/QGuiApplication> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QSG_RHI_BACKEND", "opengl"); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + + QQuickView viewer; + + const QUrl url(QStringLiteral("qrc:/qml/qmlgradient/main.qml")); + + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../%2")); +#else + QString extraImportPath(QStringLiteral("%1/../../%2")); +#endif + + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + QObject::connect( viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close); + viewer.setSource(url); + viewer.show(); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + return app.exec(); +} diff --git a/tests/auto/cpptest/q3dsurface-heightproxy/q3dsurface-heightproxy.qrc b/tests/manual/qmlgradient/qml.qrc index b83c7ef9..cd67689c 100644 --- a/tests/auto/cpptest/q3dsurface-heightproxy/q3dsurface-heightproxy.qrc +++ b/tests/manual/qmlgradient/qml.qrc @@ -1,5 +1,5 @@ <RCC> <qresource prefix="/"> - <file>customtexture.jpg</file> + <file>qml/qmlgradient/main.qml</file> </qresource> </RCC> diff --git a/tests/manual/qmlgradient/qml/qmlgradient/main.qml b/tests/manual/qmlgradient/qml/qmlgradient/main.qml new file mode 100644 index 00000000..650dd087 --- /dev/null +++ b/tests/manual/qmlgradient/qml/qmlgradient/main.qml @@ -0,0 +1,191 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization 1.2 +import "." + +Item { + id: mainwindow + + function updateinfoLabels() + { + if (surfaceGraph.theme.baseGradients[0] === mainGradient) + gradientLabel.text = "Main gradient"; + else if (surfaceGraph.theme.baseGradients[0] === secondaryGradient) + gradientLabel.text = "Secondary gradient"; + } + + width: 1024 + height: 768 + visible: true + + Item { + id: surfaceview + width: mainwindow.width + height: mainwindow.height + + anchors.top: mainwindow.top + anchors.left: mainwindow.left + + ColorGradient { + id: mainGradient + ColorGradientStop { position: 0.0; color: "red"} + ColorGradientStop { position: 0.5; color: "green"} + ColorGradientStop { position: 0.8; color: "blue"} + ColorGradientStop { position: 0.6; color: "yellow"} + ColorGradientStop { position: 0.8; color: "black"} + ColorGradientStop { position: 1.0; color: "peru"} + } + + ColorGradient { + id: secondaryGradient + ColorGradientStop { position: 0.0; color: "crimson"} + ColorGradientStop { position: 0.5; color: "chartreuse"} + ColorGradientStop { position: 0.8; color: "blueviolet"} + ColorGradientStop { position: 0.6; color: "gold"} + ColorGradientStop { position: 0.8; color: "darkslategrey"} + ColorGradientStop { position: 1.0; color: "seagreen"} + } + + ColorGradient { + id: seriesGradient + ColorGradientStop { position: 0.0; color: "gold" } + ColorGradientStop { position: 0.5; color: "crimson" } + ColorGradientStop { position: 1.0; color: "blueviolet" } + } + + Theme3D { + id: mainTheme + type: Q3DTheme.ThemeStoneMoss + + colorStyle: Q3DTheme.ColorStyleRangeGradient + baseGradients: [mainGradient] + } + + Theme3D { + id: secondaryTheme + type: Q3DTheme.ThemeArmyBlue + baseGradients: [secondaryGradient] + } + + Surface3D { + id: surfaceGraph + width: surfaceview.width + height: surfaceview.height + theme: mainTheme + + shadowQuality: AbstractGraph3D.ShadowQualityMedium + selectionMode: AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionItemAndRow + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeft + axisY.min: 0.0 + axisY.max: 500.0 + axisX.segmentCount: 10 + axisX.subSegmentCount: 2 + axisX.labelFormat: "%i" + axisZ.segmentCount: 10 + axisZ.subSegmentCount: 2 + axisZ.labelFormat: "%i" + axisY.segmentCount: 5 + axisY.subSegmentCount: 2 + axisY.labelFormat: "%i" + axisY.title: "Height" + axisX.title: "Latitude" + axisZ.title: "Longitude" + + Surface3DSeries { + id: heightSeries + drawMode: Surface3DSeries.DrawSurface + visible: true + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/map" + } + } + } + + RowLayout { + id: buttonLayout + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + Button { + id: toggleTheme + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Toggle theme") + onClicked: { + if (surfaceGraph.theme == mainTheme) { + surfaceGraph.theme = secondaryTheme; + themeLabel.text = "Secondary theme"; + updateinfoLabels(); + } else if (surfaceGraph.theme == secondaryTheme) { + surfaceGraph.theme = mainTheme; + updateinfoLabels(); + themeLabel.text = "Main theme"; + } + } + } + + Button { + id: toggleGradient + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Toggle theme gradient") + onClicked: { + if (surfaceGraph.theme.baseGradients[0] === mainGradient) { + surfaceGraph.theme.baseGradients[0] = secondaryGradient; + updateinfoLabels(); + } else if (surfaceGraph.theme.baseGradients[0] === secondaryGradient) { + surfaceGraph.theme.baseGradients[0] = mainGradient; + updateinfoLabels(); + } + } + } + + Button { + id: toggleSeriesGradient + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Override theme gradient with series gradient") + + onClicked: { + heightSeries.baseGradient = seriesGradient; + gradientLabel.text = "Series gradient"; + } + } + } + + ColumnLayout { + id: infoLayout + anchors.top: buttonLayout.bottom + anchors.left: parent.left + + Rectangle { + Layout.minimumHeight: 20 + + Label { + id: themeLabel + text: qsTr("Main theme") + } + } + + Rectangle { + Layout.minimumHeight: 20 + + Label { + id: gradientLabel + text: qsTr("Main gradient") + } + } + } + } +} diff --git a/tests/manual/qmlheightmap/CMakeLists.txt b/tests/manual/qmlheightmap/CMakeLists.txt new file mode 100644 index 00000000..17e7f3f2 --- /dev/null +++ b/tests/manual/qmlheightmap/CMakeLists.txt @@ -0,0 +1,43 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlheightmap + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmlheightmap PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set_source_files_properties("gradientGRAY8.png" + PROPERTIES QT_RESOURCE_ALIAS "mapGRAY8" + ) +set_source_files_properties("gradientGRAY16.png" + PROPERTIES QT_RESOURCE_ALIAS "mapGRAY16" + ) +set_source_files_properties("gradientRGB8.png" + PROPERTIES QT_RESOURCE_ALIAS "mapRGB8" + ) +set_source_files_properties("gradientRGB16.png" + PROPERTIES QT_RESOURCE_ALIAS "mapRGB16" + ) + +set(qmlheightmap_resource_files + "qml/qmlheightmap/main.qml" + "gradientGRAY8.png" + "gradientGRAY16.png" + "gradientRGB8.png" + "gradientRGB16.png" + ) +qt_internal_add_resource(qmlheightmap "qmlheightmap" + PREFIX + "/" + FILES + ${qmlheightmap_resource_files} + ) diff --git a/tests/manual/qmlheightmap/gradientGRAY16.png b/tests/manual/qmlheightmap/gradientGRAY16.png Binary files differnew file mode 100644 index 00000000..28df3673 --- /dev/null +++ b/tests/manual/qmlheightmap/gradientGRAY16.png diff --git a/tests/manual/qmlheightmap/gradientGRAY8.png b/tests/manual/qmlheightmap/gradientGRAY8.png Binary files differnew file mode 100644 index 00000000..6696e57c --- /dev/null +++ b/tests/manual/qmlheightmap/gradientGRAY8.png diff --git a/tests/manual/qmlheightmap/gradientRGB16.png b/tests/manual/qmlheightmap/gradientRGB16.png Binary files differnew file mode 100644 index 00000000..b62e510b --- /dev/null +++ b/tests/manual/qmlheightmap/gradientRGB16.png diff --git a/tests/manual/qmlheightmap/gradientRGB8.png b/tests/manual/qmlheightmap/gradientRGB8.png Binary files differnew file mode 100644 index 00000000..79879f35 --- /dev/null +++ b/tests/manual/qmlheightmap/gradientRGB8.png diff --git a/tests/manual/qmlheightmap/main.cpp b/tests/manual/qmlheightmap/main.cpp new file mode 100644 index 00000000..371b78a8 --- /dev/null +++ b/tests/manual/qmlheightmap/main.cpp @@ -0,0 +1,37 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtGui/QGuiApplication> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QSG_RHI_BACKEND", "opengl"); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + + QQuickView viewer; + + const QUrl url(QStringLiteral("qrc:/qml/qmlheightmap/main.qml")); + + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../%2")); +#else + QString extraImportPath(QStringLiteral("%1/../../%2")); +#endif + + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + QObject::connect( viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close); + viewer.setSource(url); + viewer.show(); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + return app.exec(); +} diff --git a/tests/manual/qmlheightmap/qml.qrc b/tests/manual/qmlheightmap/qml.qrc new file mode 100644 index 00000000..b1cbc545 --- /dev/null +++ b/tests/manual/qmlheightmap/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>qml/qmlheightmap/qml/main.qml</file> + </qresource> +</RCC> diff --git a/tests/manual/qmlheightmap/qml/qmlheightmap/main.qml b/tests/manual/qmlheightmap/qml/qmlheightmap/main.qml new file mode 100644 index 00000000..53003b59 --- /dev/null +++ b/tests/manual/qmlheightmap/qml/qmlheightmap/main.qml @@ -0,0 +1,181 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization +import "." + +Item { + id: mainwindow + + width: 1024 + height: 768 + visible: true + + Item { + id: surfaceview + width: mainwindow.width + height: mainwindow.height + + anchors.top: mainwindow.top + anchors.left: mainwindow.left + + ColorGradient { + id: surfaceGradient + ColorGradientStop { position: 0.0; color: "darkslategray" } + ColorGradientStop { id: middleGradient; position: 0.50; color: "peru" } + ColorGradientStop { position: 1.0; color: "red" } + } + + Theme3D { + id: mainTheme + type: Q3DTheme.ThemeStoneMoss + colorStyle: Q3DTheme.ColorStyleRangeGradient + baseGradients: [surfaceGradient] + } + + Surface3D { + id: surfaceGraph + width: surfaceview.width + height: surfaceview.height + theme: mainTheme + shadowQuality: AbstractGraph3D.ShadowQualityMedium + selectionMode: AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionItemAndRow + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeft + axisY.min: 0.0 + axisY.max: 500.0 + axisX.segmentCount: 10 + axisX.subSegmentCount: 2 + axisX.labelFormat: "%i" + axisZ.segmentCount: 10 + axisZ.subSegmentCount: 2 + axisZ.labelFormat: "%i" + axisY.segmentCount: 5 + axisY.subSegmentCount: 2 + axisY.labelFormat: "%i" + axisY.title: "Y" + axisX.title: "X" + axisZ.title: "Z" + + Surface3DSeries { + id: heightSeriesRGB8 + drawMode: Surface3DSeries.DrawSurface + visible: true + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapRGB8" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + + Surface3DSeries { + id: heightSeriesRGB16 + drawMode: Surface3DSeries.DrawSurface + visible: false + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapRGB16" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + + Surface3DSeries { + id: heightSeriesGRAY8 + drawMode: Surface3DSeries.DrawSurface + visible: false + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapGRAY8" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + + Surface3DSeries { + id: heightSeriesGRAY16 + drawMode: Surface3DSeries.DrawSurface + visible: false + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapGRAY16" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + } + + RowLayout { + id: buttonLayout + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + Button { + id: toggleHeightSeries + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Use 16-bit rgb map") + onClicked: { + if (heightSeriesRGB8.visible === true) { + heightSeriesRGB8.visible = false + heightSeriesRGB16.visible = true + heightSeriesGRAY8.visible = false + heightSeriesGRAY16.visible = false + text = "Use 8-bit grayscale map" + } else if (heightSeriesRGB16.visible === true){ + heightSeriesRGB8.visible = false + heightSeriesRGB16.visible = false + heightSeriesGRAY8.visible = true + heightSeriesGRAY16.visible = false + text = "Use 16-bit grayscale map" + } else if (heightSeriesGRAY8.visible === true){ + heightSeriesRGB8.visible = false + heightSeriesRGB16.visible = false + heightSeriesGRAY8.visible = false + heightSeriesGRAY16.visible = true + text = "Use 8-bit rgb map" + } else if (heightSeriesGRAY16.visible === true){ + heightSeriesRGB8.visible = true + heightSeriesRGB16.visible = false + heightSeriesGRAY8.visible = false + heightSeriesGRAY16.visible = false + text = "Use 16-bit rgb map" + } + } + } + + Button { + id: toggleAutoScaleY + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Enable autoScaleY") + onClicked: { + if (text === "Enable autoScaleY") { + heightSeriesRGB8.dataProxy.autoScaleY = true + heightSeriesRGB16.dataProxy.autoScaleY = true + heightSeriesGRAY8.dataProxy.autoScaleY = true + heightSeriesGRAY16.dataProxy.autoScaleY = true + text = "Disable autoScaleY" + } else { + heightSeriesRGB8.dataProxy.autoScaleY = false + heightSeriesRGB16.dataProxy.autoScaleY = false + heightSeriesGRAY8.dataProxy.autoScaleY = false + heightSeriesGRAY16.dataProxy.autoScaleY = false + text = "Enable autoScaleY" + } + } + } + } + } +} diff --git a/tests/manual/qmlmultitest/CMakeLists.txt b/tests/manual/qmlmultitest/CMakeLists.txt new file mode 100644 index 00000000..a92ff8db --- /dev/null +++ b/tests/manual/qmlmultitest/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(qmlmultitest + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmlmultitest PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlmultitest_resource_files + "qml/qmlmultitest/Data.qml" + "qml/qmlmultitest/main.qml" + ) + +qt_internal_add_resource(qmlmultitest "qmlmultitest" + PREFIX + "/" + FILES + ${qmlmultitest_resource_files} + ) diff --git a/tests/manual/qmlmultitest/main.cpp b/tests/manual/qmlmultitest/main.cpp index e6010697..555dff63 100644 --- a/tests/manual/qmlmultitest/main.cpp +++ b/tests/manual/qmlmultitest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtGui/QGuiApplication> #include <QtCore/QDir> @@ -34,6 +8,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml b/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml index 9bbbd7f8..78e65575 100644 --- a/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml +++ b/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml @@ -1,33 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 +import QtQuick Item { property alias sharedData: dataModel diff --git a/tests/manual/qmlmultitest/qml/qmlmultitest/NewButton.qml b/tests/manual/qmlmultitest/qml/qmlmultitest/NewButton.qml deleted file mode 100644 index 19309cca..00000000 --- a/tests/manual/qmlmultitest/qml/qmlmultitest/NewButton.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 - -Item { - id: newbutton - - property alias text: buttonText.text - - signal clicked - - implicitWidth: buttonText.implicitWidth + 5 - implicitHeight: buttonText.implicitHeight + 10 - - Button { - id: buttonText - width: parent.width - height: parent.height - - style: ButtonStyle { - label: Component { - Text { - text: buttonText.text - clip: true - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent - } - } - } - onClicked: newbutton.clicked() - } -} diff --git a/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml b/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml index 388cf391..493feb79 100644 --- a/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml +++ b/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml @@ -1,38 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 -import QtQuick.Layouts 1.0 -import QtDataVisualization 1.1 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization 1.2 import "." -Rectangle { +Item { id: mainView width: 800 height: 600 @@ -56,6 +31,7 @@ Rectangle { Layout.fillWidth: true border.color: surfaceGraph.theme.gridLineColor border.width: 2 + color: "#00000000" Surface3D { id: surfaceGraph @@ -106,7 +82,7 @@ Rectangle { anchors.bottom: parent.bottom columns: 2 - NewButton { + Button { Layout.minimumWidth: parent.width / 2 Layout.fillHeight: true Layout.fillWidth: true @@ -114,22 +90,22 @@ Rectangle { onClicked: clearSelections() // call a helper function to keep button itself simpler } - NewButton { + Button { Layout.minimumWidth: parent.width / 2 Layout.fillHeight: true Layout.fillWidth: true text: "Quit" - onClicked: Qt.quit(0); + onClicked: Qt.quit(); } - NewButton { + Button { Layout.fillHeight: true Layout.fillWidth: true text: "Reset Cameras" onClicked: resetCameras() // call a helper function to keep button itself simpler } - NewButton { + Button { id: mmbButton Layout.fillHeight: true Layout.fillWidth: true @@ -144,6 +120,7 @@ Rectangle { Layout.fillWidth: true border.color: scatterGraph.theme.gridLineColor border.width: 2 + color: "#00000000" Scatter3D { id: scatterGraph @@ -184,6 +161,7 @@ Rectangle { Layout.fillWidth: true border.color: barGraph.theme.gridLineColor border.width: 2 + color: "#00000000" Bars3D { id: barGraph diff --git a/tests/manual/qmlmultitest/qmlmultitest.qrc b/tests/manual/qmlmultitest/qmlmultitest.qrc index 7fc9ade2..ae52b7e7 100644 --- a/tests/manual/qmlmultitest/qmlmultitest.qrc +++ b/tests/manual/qmlmultitest/qmlmultitest.qrc @@ -2,6 +2,5 @@ <qresource prefix="/"> <file>qml/qmlmultitest/Data.qml</file> <file>qml/qmlmultitest/main.qml</file> - <file>qml/qmlmultitest/NewButton.qml</file> </qresource> </RCC> diff --git a/tests/manual/qmlperf/CMakeLists.txt b/tests/manual/qmlperf/CMakeLists.txt new file mode 100644 index 00000000..31235e32 --- /dev/null +++ b/tests/manual/qmlperf/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlperf + GUI + SOURCES + datagenerator.cpp datagenerator.h + main.cpp + ) +target_link_libraries(qmlperf PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlperf_resource_files + "qml/qmlperf/main.qml" + ) + +qt_internal_add_resource(qmlperf "qmlperf" + PREFIX + "/" + FILES + ${qmlperf_resource_files} + ) diff --git a/tests/manual/qmlperf/datagenerator.cpp b/tests/manual/qmlperf/datagenerator.cpp index 0d8cf9b2..df00d483 100644 --- a/tests/manual/qmlperf/datagenerator.cpp +++ b/tests/manual/qmlperf/datagenerator.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datagenerator.h" #include <QDebug> #include <QRandomGenerator> -using namespace QtDataVisualization; - Q_DECLARE_METATYPE(QScatter3DSeries *) DataGenerator::DataGenerator(QObject *parent) : diff --git a/tests/manual/qmlperf/datagenerator.h b/tests/manual/qmlperf/datagenerator.h index affcebbb..99a9dbf7 100644 --- a/tests/manual/qmlperf/datagenerator.h +++ b/tests/manual/qmlperf/datagenerator.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef DATAGENERATOR_H #define DATAGENERATOR_H @@ -33,8 +7,6 @@ #include <QtDataVisualization/QScatter3DSeries> #include <QtCore/QFile> -using namespace QtDataVisualization; - class DataGenerator : public QObject { Q_OBJECT diff --git a/tests/manual/qmlperf/main.cpp b/tests/manual/qmlperf/main.cpp index 27a9fb3a..2566fc7d 100644 --- a/tests/manual/qmlperf/main.cpp +++ b/tests/manual/qmlperf/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datagenerator.h" @@ -37,6 +11,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmlperf/qml/qmlperf/main.qml b/tests/manual/qmlperf/qml/qmlperf/main.qml index 43c6c5bf..4562e538 100644 --- a/tests/manual/qmlperf/qml/qmlperf/main.qml +++ b/tests/manual/qmlperf/qml/qmlperf/main.qml @@ -1,39 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 -import QtDataVisualization 1.1 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization 1.2 import "." -Rectangle { +Item { id: mainview width: 1280 height: 1024 @@ -136,17 +110,17 @@ Rectangle { fpsText.text = itemCount + " : " + scatterPlot.currentFps.toFixed(1); } -// theme: Theme3D { -// type: Theme3D.ThemeRetro -// colorStyle: Theme3D.ColorStyleRangeGradient -// baseGradients: customGradient + theme: Theme3D { + type: Theme3D.ThemeRetro + colorStyle: Theme3D.ColorStyleRangeGradient + baseGradients: customGradient -// ColorGradient { -// id: customGradient -// ColorGradientStop { position: 1.0; color: "red" } -// ColorGradientStop { position: 0.0; color: "blue" } -// } -// } + ColorGradient { + id: customGradient + ColorGradientStop { position: 1.0; color: "red" } + ColorGradientStop { position: 0.0; color: "blue" } + } + } Scatter3DSeries { id: scatterSeries diff --git a/tests/manual/qmlvolume/CMakeLists.txt b/tests/manual/qmlvolume/CMakeLists.txt new file mode 100644 index 00000000..5a0e446a --- /dev/null +++ b/tests/manual/qmlvolume/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlvolume + GUI + SOURCES + datasource.cpp datasource.h + main.cpp + ) +target_link_libraries(qmlvolume PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlvolume_resource_files + "qml/qmlvolume/main.qml" + ) + +qt_internal_add_resource(qmlvolume "qmlvolume" + PREFIX + "/" + FILES + ${qmlvolume_resource_files} + ) diff --git a/tests/manual/qmlvolume/datasource.cpp b/tests/manual/qmlvolume/datasource.cpp index a06ea6d9..6a16278e 100644 --- a/tests/manual/qmlvolume/datasource.cpp +++ b/tests/manual/qmlvolume/datasource.cpp @@ -1,39 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datasource.h" #include <QtCore/qmath.h> #include <QtGui/QRgb> #include <QtGui/QVector3D> -using namespace QtDataVisualization; - Q_DECLARE_METATYPE(QCustom3DVolume *) DataSource::DataSource(QObject *parent) : @@ -52,7 +24,7 @@ void DataSource::fillVolume(QCustom3DVolume *volumeItem) // This can take a while if the dimensions are large, so we support incremental data generation. int index = 0; - int textureSize = 256; + int textureSize = 1024; QVector3D midPoint(float(textureSize) / 2.0f, float(textureSize) / 2.0f, float(textureSize) / 2.0f); diff --git a/tests/manual/qmlvolume/datasource.h b/tests/manual/qmlvolume/datasource.h index cd7ca2d6..de502337 100644 --- a/tests/manual/qmlvolume/datasource.h +++ b/tests/manual/qmlvolume/datasource.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef DATASOURCE_H #define DATASOURCE_H @@ -33,8 +7,6 @@ #include <QtDataVisualization/QCustom3DVolume> #include <QtCore/QObject> -using namespace QtDataVisualization; - class DataSource : public QObject { Q_OBJECT diff --git a/tests/manual/qmlvolume/main.cpp b/tests/manual/qmlvolume/main.cpp index ac69d4f1..1c4e4492 100644 --- a/tests/manual/qmlvolume/main.cpp +++ b/tests/manual/qmlvolume/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datasource.h" @@ -39,6 +13,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmlvolume/qml/qmlvolume/NewButton.qml b/tests/manual/qmlvolume/qml/qmlvolume/NewButton.qml deleted file mode 100644 index 19309cca..00000000 --- a/tests/manual/qmlvolume/qml/qmlvolume/NewButton.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 - -Item { - id: newbutton - - property alias text: buttonText.text - - signal clicked - - implicitWidth: buttonText.implicitWidth + 5 - implicitHeight: buttonText.implicitHeight + 10 - - Button { - id: buttonText - width: parent.width - height: parent.height - - style: ButtonStyle { - label: Component { - Text { - text: buttonText.text - clip: true - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent - } - } - } - onClicked: newbutton.clicked() - } -} diff --git a/tests/manual/qmlvolume/qml/qmlvolume/main.qml b/tests/manual/qmlvolume/qml/qmlvolume/main.qml index 24946a12..da061483 100644 --- a/tests/manual/qmlvolume/qml/qmlvolume/main.qml +++ b/tests/manual/qmlvolume/qml/qmlvolume/main.qml @@ -1,35 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls import QtDataVisualization 1.2 import "." @@ -50,15 +24,7 @@ Item { width: dataView.width height: dataView.height orthoProjection: true - //measureFps: true - - onCurrentFpsChanged: { - if (fps > 10) - fpsText.text = "FPS: " + Math.round(surfaceGraph.currentFps) - else - fpsText.text = "FPS: " + Math.round(surfaceGraph.currentFps * 10.0) / 10.0 - } - + measureFps : false Surface3DSeries { id: surfaceSeries drawMode: Surface3DSeries.DrawSurface; @@ -68,7 +34,7 @@ Item { itemLabelVisible: false onItemLabelChanged: { - if (surfaceSeries.selectedPoint === surfaceSeries.invalidSelectionPosition) + if (surfaceSeries.selectedPoint == surfaceSeries.invalidSelectionPosition) selectionText.text = "No selection" else selectionText.text = surfaceSeries.itemLabel @@ -92,12 +58,9 @@ Item { anchors.fill: parent RowLayout { id: sliderLayout - anchors.top: parent.top - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumHeight: 150 + Layout.fillHeight: false spacing: 0 - + visible: surfaceGraph.measureFps Rectangle { Layout.fillHeight: true Layout.fillWidth: true @@ -116,19 +79,21 @@ Item { anchors.fill: parent verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter + text: { + return "FPS: " + surfaceGraph.currentFps > 10 + ? Math.round(surfaceGraph.currentFps) + : Math.round(surfaceGraph.currentFps * 10.0) / 10.0 + } } } } RowLayout { id: buttonLayout - Layout.fillHeight: true - Layout.fillWidth: true Layout.minimumHeight: 50 - anchors.bottom: parent.bottom spacing: 0 - NewButton { + Button { id: sliceButton Layout.fillHeight: true Layout.fillWidth: true @@ -136,7 +101,7 @@ Item { text: "Slice" onClicked: { - if (volumeItem.sliceIndexZ == -1) { + if (volumeItem.sliceIndexZ === -1) { volumeItem.sliceIndexZ = 128 volumeItem.drawSlices = true volumeItem.drawSliceFrames = true @@ -147,18 +112,38 @@ Item { } } } - NewButton { + Button { id: exitButton Layout.fillHeight: true Layout.fillWidth: true text: "Quit" - onClicked: Qt.quit(0); + onClicked: Qt.quit(); } } } + } + + SequentialAnimation { + running: volumeItem.drawSlices + loops: Animation.Infinite + PropertyAnimation { + target: volumeItem + property: "sliceIndexZ" + from: 0 + to: 1024 + duration: 5000 + } + + PropertyAnimation { + target: volumeItem + property: "sliceIndexZ" + from: 1024 + to: 0 + duration: 5000 + } } Custom3DVolume { diff --git a/tests/manual/qmlvolume/qmlvolume.qrc b/tests/manual/qmlvolume/qmlvolume.qrc index 18fe57e1..b1cb2997 100644 --- a/tests/manual/qmlvolume/qmlvolume.qrc +++ b/tests/manual/qmlvolume/qmlvolume.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> <file>qml/qmlvolume/main.qml</file> - <file>qml/qmlvolume/NewButton.qml</file> </qresource> </RCC> diff --git a/tests/manual/scattertest/CMakeLists.txt b/tests/manual/scattertest/CMakeLists.txt new file mode 100644 index 00000000..89013c12 --- /dev/null +++ b/tests/manual/scattertest/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(scattertest + GUI + SOURCES + main.cpp + scatterchart.cpp scatterchart.h + NO_PCH_SOURCES + scatterchart.cpp # undef QT_NO_FOREACH + ) +target_link_libraries(scattertest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) diff --git a/tests/manual/scattertest/main.cpp b/tests/manual/scattertest/main.cpp index d7e349bc..af4d477f 100644 --- a/tests/manual/scattertest/main.cpp +++ b/tests/manual/scattertest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "scatterchart.h" @@ -46,6 +20,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); diff --git a/tests/manual/scattertest/scatterchart.cpp b/tests/manual/scattertest/scatterchart.cpp index c6775df2..fce115d4 100644 --- a/tests/manual/scattertest/scatterchart.cpp +++ b/tests/manual/scattertest/scatterchart.cpp @@ -1,31 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "scatterchart.h" #include <QtDataVisualization/qscatterdataproxy.h> @@ -37,7 +13,6 @@ #include <QtDataVisualization/Q3DInputHandler> #include <qmath.h> #include <qrandom.h> -using namespace QtDataVisualization; //#define RANDOM_SCATTER @@ -245,7 +220,7 @@ void ScatterDataModifier::massiveTestAppendAndScroll() m_chart->axisZ()->setRange(min, max); } -void ScatterDataModifier::setFpsMeasurement(bool enable) +void ScatterDataModifier::setFpsMeasurement(int enable) { m_chart->setMeasureFps(enable); } @@ -974,14 +949,14 @@ void ScatterDataModifier::changeRadialLabelOffset(int offset) m_chart->setRadialLabelOffset(float(offset) / 100.0f); } -void ScatterDataModifier::toggleAxisTitleVisibility(bool enabled) +void ScatterDataModifier::toggleAxisTitleVisibility(int enabled) { m_chart->axisX()->setTitleVisible(enabled); m_chart->axisY()->setTitleVisible(enabled); m_chart->axisZ()->setTitleVisible(enabled); } -void ScatterDataModifier::toggleAxisTitleFixed(bool enabled) +void ScatterDataModifier::toggleAxisTitleFixed(int enabled) { m_chart->axisX()->setTitleFixed(enabled); m_chart->axisY()->setTitleFixed(enabled); @@ -1010,12 +985,12 @@ void ScatterDataModifier::renderToImage() } } -void ScatterDataModifier::togglePolar(bool enable) +void ScatterDataModifier::togglePolar(int enable) { m_chart->setPolar(enable); } -void ScatterDataModifier::toggleStatic(bool enable) +void ScatterDataModifier::toggleStatic(int enable) { if (enable) m_chart->setOptimizationHints(QAbstract3DGraph::OptimizationStatic); @@ -1023,7 +998,7 @@ void ScatterDataModifier::toggleStatic(bool enable) m_chart->setOptimizationHints(QAbstract3DGraph::OptimizationDefault); } -void ScatterDataModifier::toggleOrtho(bool enable) +void ScatterDataModifier::toggleOrtho(int enable) { m_chart->setOrthoProjection(enable); } diff --git a/tests/manual/scattertest/scatterchart.h b/tests/manual/scattertest/scatterchart.h index 05fb0b03..2771a9a4 100644 --- a/tests/manual/scattertest/scatterchart.h +++ b/tests/manual/scattertest/scatterchart.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef SCATTERDATAMODIFIER_H #define SCATTERDATAMODIFIER_H @@ -38,8 +12,6 @@ #include <QTimer> #include <QLabel> -using namespace QtDataVisualization; - class ScatterDataModifier : public QObject { Q_OBJECT @@ -69,7 +41,7 @@ public: void massiveDataTest(); void massiveTestScroll(); void massiveTestAppendAndScroll(); - void setFpsMeasurement(bool enable); + void setFpsMeasurement(int enable); void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } void testItemChanges(); void testAxisReverse(); @@ -103,12 +75,12 @@ public Q_SLOTS: void handleFpsChange(qreal fps); void changeLabelRotation(int rotation); void changeRadialLabelOffset(int offset); - void toggleAxisTitleVisibility(bool enabled); - void toggleAxisTitleFixed(bool enabled); + void toggleAxisTitleVisibility(int enabled); + void toggleAxisTitleFixed(int enabled); void renderToImage(); - void togglePolar(bool enable); - void toggleStatic(bool enable); - void toggleOrtho(bool enable); + void togglePolar(int enable); + void toggleStatic(int enable); + void toggleOrtho(int enable); void setCameraTargetX(int value); void setCameraTargetY(int value); void setCameraTargetZ(int value); diff --git a/tests/manual/surfacetest/CMakeLists.txt b/tests/manual/surfacetest/CMakeLists.txt new file mode 100644 index 00000000..bb3f0500 --- /dev/null +++ b/tests/manual/surfacetest/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(surfacetest + GUI + SOURCES + buttonwrapper.cpp buttonwrapper.h + checkboxwrapper.cpp checkboxwrapper.h + graphmodifier.cpp graphmodifier.h + main.cpp + NO_PCH_SOURCES + graphmodifier.cpp # undef QT_NO_FOREACH + ) +target_link_libraries(surfacetest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set_source_files_properties("Heightmap.png" + PROPERTIES QT_RESOURCE_ALIAS "map" + ) +set_source_files_properties("mapimage.png" + PROPERTIES QT_RESOURCE_ALIAS "mapimage" + ) +set(surfacetest_resource_files + "Heightmap.png" + "mapimage.png" + ) + +qt_internal_add_resource(surfacetest "surfacetest" + PREFIX + "/maps" + FILES + ${surfacetest_resource_files} + ) diff --git a/tests/manual/surfacetest/buttonwrapper.cpp b/tests/manual/surfacetest/buttonwrapper.cpp new file mode 100644 index 00000000..c8eef0c7 --- /dev/null +++ b/tests/manual/surfacetest/buttonwrapper.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "buttonwrapper.h" +#include <QPushButton> + +ButtonWrapper::ButtonWrapper(QPushButton *button) +{ + m_button = button; +} + +void ButtonWrapper::setEnabled(int state) +{ + m_button->setEnabled(state); +} diff --git a/tests/manual/surfacetest/buttonwrapper.h b/tests/manual/surfacetest/buttonwrapper.h new file mode 100644 index 00000000..d0112117 --- /dev/null +++ b/tests/manual/surfacetest/buttonwrapper.h @@ -0,0 +1,22 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef BUTTONWRAPPER_H +#define BUTTONWRAPPER_H + +#include <QObject> +class QPushButton; + +class ButtonWrapper : public QObject +{ + Q_OBJECT +public: + ButtonWrapper(QPushButton *button); + +public Q_SLOTS: + void setEnabled(int state); + +private: + QPushButton *m_button; +}; + +#endif // BUTTONWRAPPER_H diff --git a/tests/manual/surfacetest/checkboxwrapper.cpp b/tests/manual/surfacetest/checkboxwrapper.cpp new file mode 100644 index 00000000..37bd3ded --- /dev/null +++ b/tests/manual/surfacetest/checkboxwrapper.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "checkboxwrapper.h" +#include <QCheckBox> + +CheckBoxWrapper::CheckBoxWrapper(QCheckBox *cb) +{ + m_checkbox = cb; +} + +void CheckBoxWrapper::setEnabled(int enabled) +{ + m_checkbox->setEnabled(enabled); +} diff --git a/tests/manual/surfacetest/checkboxwrapper.h b/tests/manual/surfacetest/checkboxwrapper.h new file mode 100644 index 00000000..37e72346 --- /dev/null +++ b/tests/manual/surfacetest/checkboxwrapper.h @@ -0,0 +1,23 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef CHECKBOXWRAPPER_H +#define CHECKBOXWRAPPER_H + +#include <QObject> + +class QCheckBox; + +class CheckBoxWrapper : public QObject +{ + Q_OBJECT +public: + explicit CheckBoxWrapper(QCheckBox *cb); + +public Q_SLOTS: + void setEnabled(int enabled); + +private: + QCheckBox *m_checkbox; +}; + +#endif // CHECKBOXWRAPPER_H diff --git a/tests/manual/surfacetest/graphmodifier.cpp b/tests/manual/surfacetest/graphmodifier.cpp index 11cabb4d..f406513d 100644 --- a/tests/manual/surfacetest/graphmodifier.cpp +++ b/tests/manual/surfacetest/graphmodifier.cpp @@ -1,31 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "graphmodifier.h" #include <QtDataVisualization/QValue3DAxis> @@ -42,7 +18,6 @@ #ifndef QT_NO_CURSOR #include <QtGui/QCursor> #endif -using namespace QtDataVisualization; //#define JITTER_PLANE //#define WONKY_PLANE @@ -194,7 +169,7 @@ void GraphModifier::fillSeries() m_multiseries[3]->dataProxy()->resetArray(dataArray4); } -void GraphModifier::toggleSeries1(bool enabled) +void GraphModifier::toggleSeries1(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -205,7 +180,7 @@ void GraphModifier::toggleSeries1(bool enabled) } } -void GraphModifier::toggleSeries2(bool enabled) +void GraphModifier::toggleSeries2(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -216,7 +191,7 @@ void GraphModifier::toggleSeries2(bool enabled) } } -void GraphModifier::toggleSeries3(bool enabled) +void GraphModifier::toggleSeries3(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -227,7 +202,7 @@ void GraphModifier::toggleSeries3(bool enabled) } } -void GraphModifier::toggleSeries4(bool enabled) +void GraphModifier::toggleSeries4(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -238,7 +213,7 @@ void GraphModifier::toggleSeries4(bool enabled) } } -void GraphModifier::toggleSmooth(bool enabled) +void GraphModifier::toggleSmooth(int enabled) { qDebug() << "GraphModifier::toggleSmooth " << enabled; m_theSeries->setFlatShadingEnabled(enabled); @@ -247,7 +222,7 @@ void GraphModifier::toggleSmooth(bool enabled) #endif } -void GraphModifier::toggleSurfaceGrid(bool enable) +void GraphModifier::toggleSurfaceGrid(int enable) { qDebug() << "GraphModifier::toggleSurfaceGrid" << enable; if (enable) @@ -261,7 +236,7 @@ void GraphModifier::toggleSurfaceGrid(bool enable) #endif } -void GraphModifier::toggleSurface(bool enable) +void GraphModifier::toggleSurface(int enable) { qDebug() << "GraphModifier::toggleSurface" << enable; if (enable) @@ -275,7 +250,7 @@ void GraphModifier::toggleSurface(bool enable) #endif } -void GraphModifier::toggleSeriesVisible(bool enable) +void GraphModifier::toggleSeriesVisible(int enable) { m_theSeries->setVisible(enable); #ifdef MULTI_SERIES @@ -283,13 +258,13 @@ void GraphModifier::toggleSeriesVisible(bool enable) #endif } -void GraphModifier::toggleSmoothS2(bool enabled) +void GraphModifier::toggleSmoothS2(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[1]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS2(bool enable) +void GraphModifier::toggleSurfaceGridS2(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -300,7 +275,7 @@ void GraphModifier::toggleSurfaceGridS2(bool enable) m_multiseries[1]->setDrawMode(m_drawMode2); } -void GraphModifier::toggleSurfaceS2(bool enable) +void GraphModifier::toggleSurfaceS2(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -311,19 +286,19 @@ void GraphModifier::toggleSurfaceS2(bool enable) m_multiseries[1]->setDrawMode(m_drawMode2); } -void GraphModifier::toggleSeries2Visible(bool enable) +void GraphModifier::toggleSeries2Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[1]->setVisible(enable); } -void GraphModifier::toggleSmoothS3(bool enabled) +void GraphModifier::toggleSmoothS3(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[2]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS3(bool enable) +void GraphModifier::toggleSurfaceGridS3(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -334,7 +309,7 @@ void GraphModifier::toggleSurfaceGridS3(bool enable) m_multiseries[2]->setDrawMode(m_drawMode3); } -void GraphModifier::toggleSurfaceS3(bool enable) +void GraphModifier::toggleSurfaceS3(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -345,19 +320,19 @@ void GraphModifier::toggleSurfaceS3(bool enable) m_multiseries[2]->setDrawMode(m_drawMode3); } -void GraphModifier::toggleSeries3Visible(bool enable) +void GraphModifier::toggleSeries3Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[2]->setVisible(enable); } -void GraphModifier::toggleSmoothS4(bool enabled) +void GraphModifier::toggleSmoothS4(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[3]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS4(bool enable) +void GraphModifier::toggleSurfaceGridS4(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -368,7 +343,7 @@ void GraphModifier::toggleSurfaceGridS4(bool enable) m_multiseries[3]->setDrawMode(m_drawMode4); } -void GraphModifier::toggleSurfaceS4(bool enable) +void GraphModifier::toggleSurfaceS4(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -379,13 +354,13 @@ void GraphModifier::toggleSurfaceS4(bool enable) m_multiseries[3]->setDrawMode(m_drawMode4); } -void GraphModifier::toggleSeries4Visible(bool enable) +void GraphModifier::toggleSeries4Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[3]->setVisible(enable); } -void GraphModifier::toggleSqrtSin(bool enable) +void GraphModifier::toggleSqrtSin(int enable) { if (enable) { qDebug() << "Create Sqrt&Sin surface, (" << m_xCount << ", " << m_zCount << ")"; @@ -427,7 +402,7 @@ void GraphModifier::toggleSqrtSin(bool enable) } } -void GraphModifier::togglePlane(bool enable) +void GraphModifier::togglePlane(int enable) { qDebug() << "GraphModifier::togglePlane " << enable; @@ -750,21 +725,21 @@ void GraphModifier::changeLabelRotation(int rotation) m_graph->axisZ()->setLabelAutoRotation(float(rotation)); } -void GraphModifier::toggleAxisTitleVisibility(bool enabled) +void GraphModifier::toggleAxisTitleVisibility(int enabled) { m_graph->axisX()->setTitleVisible(enabled); m_graph->axisY()->setTitleVisible(enabled); m_graph->axisZ()->setTitleVisible(enabled); } -void GraphModifier::toggleAxisTitleFixed(bool enabled) +void GraphModifier::toggleAxisTitleFixed(int enabled) { m_graph->axisX()->setTitleFixed(enabled); m_graph->axisY()->setTitleFixed(enabled); m_graph->axisZ()->setTitleFixed(enabled); } -void GraphModifier::toggleXAscending(bool enabled) +void GraphModifier::toggleXAscending(int enabled) { m_ascendingX = enabled; @@ -794,7 +769,7 @@ void GraphModifier::toggleXAscending(bool enabled) } } -void GraphModifier::toggleZAscending(bool enabled) +void GraphModifier::toggleZAscending(int enabled) { m_ascendingZ = enabled; @@ -824,7 +799,7 @@ void GraphModifier::toggleZAscending(bool enabled) } } -void GraphModifier::togglePolar(bool enabled) +void GraphModifier::togglePolar(int enabled) { m_graph->setPolar(enabled); } @@ -1682,7 +1657,7 @@ void GraphModifier::setHorizontalAspectRatio(int ratio) m_graph->setHorizontalAspectRatio(aspectRatio); } -void GraphModifier::setSurfaceTexture(bool enabled) +void GraphModifier::setSurfaceTexture(int enabled) { if (enabled) m_multiseries[3]->setTexture(QImage(":/maps/mapimage")); diff --git a/tests/manual/surfacetest/graphmodifier.h b/tests/manual/surfacetest/graphmodifier.h index c520f3c5..fe839976 100644 --- a/tests/manual/surfacetest/graphmodifier.h +++ b/tests/manual/surfacetest/graphmodifier.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef GRAPHMODIFIER_H #define GRAPHMODIFIER_H @@ -40,8 +14,6 @@ #define MULTI_SERIES -using namespace QtDataVisualization; - class GraphModifier : public QObject { Q_OBJECT @@ -55,29 +27,29 @@ public: explicit GraphModifier(Q3DSurface *graph, QWidget *parentWidget); ~GraphModifier(); - void toggleSeries1(bool enabled); - void toggleSeries2(bool enabled); - void toggleSeries3(bool enabled); - void toggleSeries4(bool enabled); - void toggleSmooth(bool enabled); - void toggleSurfaceGrid(bool enable); - void toggleSurface(bool enable); - void toggleSeriesVisible(bool enable); - void toggleSmoothS2(bool enabled); - void toggleSurfaceGridS2(bool enable); - void toggleSurfaceS2(bool enable); - void toggleSeries2Visible(bool enable); - void toggleSmoothS3(bool enabled); - void toggleSurfaceGridS3(bool enable); - void toggleSurfaceS3(bool enable); - void toggleSeries3Visible(bool enable); - void toggleSmoothS4(bool enabled); - void toggleSurfaceGridS4(bool enable); - void toggleSurfaceS4(bool enable); - void toggleSeries4Visible(bool enable); + void toggleSeries1(int enabled); + void toggleSeries2(int enabled); + void toggleSeries3(int enabled); + void toggleSeries4(int enabled); + void toggleSmooth(int enabled); + void toggleSurfaceGrid(int enable); + void toggleSurface(int enable); + void toggleSeriesVisible(int enable); + void toggleSmoothS2(int enabled); + void toggleSurfaceGridS2(int enable); + void toggleSurfaceS2(int enable); + void toggleSeries2Visible(int enable); + void toggleSmoothS3(int enabled); + void toggleSurfaceGridS3(int enable); + void toggleSurfaceS3(int enable); + void toggleSeries3Visible(int enable); + void toggleSmoothS4(int enabled); + void toggleSurfaceGridS4(int enable); + void toggleSurfaceS4(int enable); + void toggleSeries4Visible(int enable); - void toggleSqrtSin(bool enable); - void togglePlane(bool enable); + void toggleSqrtSin(int enable); + void togglePlane(int enable); void setHeightMapData(bool enable); void toggleGridSliderLock(bool enable); void setGridSliderX(QSlider *slider) { m_gridSliderX = slider; } @@ -125,7 +97,7 @@ public: void testDataOrdering(); void setAspectRatio(int ratio); void setHorizontalAspectRatio(int ratio); - void setSurfaceTexture(bool enabled); + void setSurfaceTexture(int enabled); public Q_SLOTS: void changeShadowQuality(int quality); @@ -140,11 +112,11 @@ public Q_SLOTS: void handleAxisZChanged(QValue3DAxis *axis); void handleFpsChange(qreal fps); void changeLabelRotation(int rotation); - void toggleAxisTitleVisibility(bool enabled); - void toggleAxisTitleFixed(bool enabled); - void toggleXAscending(bool enabled); - void toggleZAscending(bool enabled); - void togglePolar(bool enabled); + void toggleAxisTitleVisibility(int enabled); + void toggleAxisTitleFixed(int enabled); + void toggleXAscending(int enabled); + void toggleZAscending(int enabled); + void togglePolar(int enabled); void setCameraTargetX(int value); void setCameraTargetY(int value); void setCameraTargetZ(int value); diff --git a/tests/manual/surfacetest/main.cpp b/tests/manual/surfacetest/main.cpp index 2a638f0f..7b90a0c2 100644 --- a/tests/manual/surfacetest/main.cpp +++ b/tests/manual/surfacetest/main.cpp @@ -1,33 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "graphmodifier.h" +#include "buttonwrapper.h" +#include "checkboxwrapper.h" #include <QtDataVisualization/q3dtheme.h> #include <QApplication> @@ -45,12 +21,11 @@ #include <QFrame> #include <QDebug> -using namespace QtDataVisualization; - const int initialTheme = 4; int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); QWidget *widget = new QWidget; @@ -581,49 +556,66 @@ int main(int argc, char *argv[]) QObject::connect(series4VisibleCB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries4Visible); + CheckBoxWrapper *series1SmoothCBWrapper = new CheckBoxWrapper(smoothCB); + CheckBoxWrapper *series1SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridCB); + CheckBoxWrapper *series1surfaceCBWrapper = new CheckBoxWrapper(surfaceCB); + CheckBoxWrapper *series1VisibleCBWrapper = new CheckBoxWrapper(seriesVisibleCB); QObject::connect(series1CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries1); QObject::connect(series1CB, &QCheckBox::stateChanged, - smoothCB, &QPushButton::setEnabled); + series1SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - surfaceGridCB, &QPushButton::setEnabled); + series1SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - surfaceCB, &QPushButton::setEnabled); + series1surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - seriesVisibleCB, &QPushButton::setEnabled); + series1VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + + CheckBoxWrapper *series2SmoothCBWrapper = new CheckBoxWrapper(smoothS2CB); + CheckBoxWrapper *series2SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS2CB); + CheckBoxWrapper *series2surfaceCBWrapper = new CheckBoxWrapper(surfaceS2CB); + CheckBoxWrapper *series2VisibleCBWrapper = new CheckBoxWrapper(series2VisibleCB); QObject::connect(series2CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries2); QObject::connect(series2CB, &QCheckBox::stateChanged, - smoothS2CB, &QPushButton::setEnabled); + series2SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - surfaceGridS2CB, &QPushButton::setEnabled); + series2SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - surfaceS2CB, &QPushButton::setEnabled); + series2surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - series2VisibleCB, &QPushButton::setEnabled); + series2VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + CheckBoxWrapper *series3SmoothCBWrapper = new CheckBoxWrapper(smoothS3CB); + CheckBoxWrapper *series3SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS3CB); + CheckBoxWrapper *series3surfaceCBWrapper = new CheckBoxWrapper(surfaceS3CB); + CheckBoxWrapper *series3VisibleCBWrapper = new CheckBoxWrapper(series3VisibleCB); QObject::connect(series3CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries3); QObject::connect(series3CB, &QCheckBox::stateChanged, - smoothS3CB, &QPushButton::setEnabled); + series3SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - surfaceGridS3CB, &QPushButton::setEnabled); + series3SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - surfaceS3CB, &QPushButton::setEnabled); + series3surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - series3VisibleCB, &QPushButton::setEnabled); + series3VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + CheckBoxWrapper *series4SmoothCBWrapper = new CheckBoxWrapper(smoothS4CB); + CheckBoxWrapper *series4SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS4CB); + CheckBoxWrapper *series4surfaceCBWrapper = new CheckBoxWrapper(surfaceS4CB); + CheckBoxWrapper *series4VisibleCBWrapper = new CheckBoxWrapper(series4VisibleCB); QObject::connect(series4CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries4); QObject::connect(series4CB, &QCheckBox::stateChanged, - smoothS4CB, &QPushButton::setEnabled); + series4SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - surfaceGridS4CB, &QPushButton::setEnabled); + series4SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - surfaceS4CB, &QPushButton::setEnabled); + series4surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - series4VisibleCB, &QPushButton::setEnabled); + series4VisibleCBWrapper, &CheckBoxWrapper::setEnabled); #else QObject::connect(sqrtSinCB, &QRadioButton::toggled, modifier, &GraphModifier::toggleSqrtSin); diff --git a/tests/manual/volumetrictest/CMakeLists.txt b/tests/manual/volumetrictest/CMakeLists.txt new file mode 100644 index 00000000..7e39bdf5 --- /dev/null +++ b/tests/manual/volumetrictest/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(volumetrictest + GUI + SOURCES + main.cpp + volumetrictest.cpp volumetrictest.h + ) + +target_link_libraries(volumetrictest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set_source_files_properties("cubeFilledFlat.obj" + PROPERTIES QT_RESOURCE_ALIAS "mesh" + ) +set(volumetrictest_resource_files + "cubeFilledFlat.obj" + "logo.png" + "logo_no_padding.png" + ) + +qt_internal_add_resource(volumetrictest "volumetrictest" + PREFIX + "/" + FILES + ${volumetrictest_resource_files} + ) diff --git a/tests/manual/volumetrictest/main.cpp b/tests/manual/volumetrictest/main.cpp index 412de874..d9d322be 100644 --- a/tests/manual/volumetrictest/main.cpp +++ b/tests/manual/volumetrictest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "volumetrictest.h" #include <QtWidgets/QApplication> @@ -41,6 +15,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); //Q3DScatter *graph = new Q3DScatter(); //Q3DSurface *graph = new Q3DSurface(); diff --git a/tests/manual/volumetrictest/volumetrictest.cpp b/tests/manual/volumetrictest/volumetrictest.cpp index a60c55bc..49293873 100644 --- a/tests/manual/volumetrictest/volumetrictest.cpp +++ b/tests/manual/volumetrictest/volumetrictest.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "volumetrictest.h" #include <QtDataVisualization/qbar3dseries.h> @@ -40,8 +14,6 @@ #include <QtWidgets/QLabel> #include <QtCore/QDebug> -using namespace QtDataVisualization; - const int imageCount = 512; const float xMiddle = 100.0f; const float yMiddle = 2.5f; diff --git a/tests/manual/volumetrictest/volumetrictest.h b/tests/manual/volumetrictest/volumetrictest.h index 83e0d01a..20b197d0 100644 --- a/tests/manual/volumetrictest/volumetrictest.h +++ b/tests/manual/volumetrictest/volumetrictest.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** 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 General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) 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.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-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef VOLUMETRICMODIFIER_H #define VOLUMETRICMODIFIER_H @@ -37,8 +11,6 @@ #include <QtDataVisualization/q3dbars.h> #include <QtWidgets/QLabel> -using namespace QtDataVisualization; - class VolumetricModifier : public QObject { Q_OBJECT diff --git a/tests/tests.pro b/tests/tests.pro deleted file mode 100644 index caa90722..00000000 --- a/tests/tests.pro +++ /dev/null @@ -1,11 +0,0 @@ -!contains(QT_CONFIG, opengl) { - error(Tests requires OpenGL!) -} -contains(QT_CONFIG, opengles1) { - error(Tests do not support OpenGL ES 1!) -} - -TEMPLATE = subdirs - -SUBDIRS += auto -exists(manual): SUBDIRS += manual |