diff options
Diffstat (limited to 'tests/auto/cpptest/q3dsurface')
-rw-r--r-- | tests/auto/cpptest/q3dsurface/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/auto/cpptest/q3dsurface/tst_surface.cpp | 62 |
2 files changed, 28 insertions, 41 deletions
diff --git a/tests/auto/cpptest/q3dsurface/CMakeLists.txt b/tests/auto/cpptest/q3dsurface/CMakeLists.txt index 0cbfae3a..71f78da8 100644 --- a/tests/auto/cpptest/q3dsurface/CMakeLists.txt +++ b/tests/auto/cpptest/q3dsurface/CMakeLists.txt @@ -1,9 +1,12 @@ -qt_internal_add_test(q3dsurface +# 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 - PUBLIC_LIBRARIES + LIBRARIES Qt::Gui Qt::GuiPrivate Qt::DataVisualization diff --git a/tests/auto/cpptest/q3dsurface/tst_surface.cpp b/tests/auto/cpptest/q3dsurface/tst_surface.cpp index e0add57c..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> @@ -54,6 +28,7 @@ private slots: void selectSeries(); void removeSeries(); void removeMultipleSeries(); + void hasSeries(); private: Q3DSurface *m_graph; @@ -108,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); @@ -183,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")); } @@ -193,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()); } @@ -207,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() @@ -217,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(); @@ -230,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; } @@ -249,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" |