diff options
Diffstat (limited to 'tests/auto')
115 files changed, 1214 insertions, 2180 deletions
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/q3dsurface-heightproxy.qrc b/tests/auto/cpptest/q3dsurface-heightproxy/q3dsurface-heightproxy.qrc deleted file mode 100644 index b83c7ef9..00000000 --- a/tests/auto/cpptest/q3dsurface-heightproxy/q3dsurface-heightproxy.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>customtexture.jpg</file> - </qresource> -</RCC> 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" |