blob: eef9f908af253c5b9b138a10346e049f6e4d5a61 [file] [log] [blame]
/****************************************************************************
**
** 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$
**
****************************************************************************/
#include <QtTest/QtTest>
#include <QtDataVisualization/QScatter3DSeries>
using namespace QtDataVisualization;
class tst_series: public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
void construct();
void initialProperties();
void initializeProperties();
private:
QScatter3DSeries *m_series;
};
void tst_series::initTestCase()
{
}
void tst_series::cleanupTestCase()
{
}
void tst_series::init()
{
m_series = new QScatter3DSeries();
}
void tst_series::cleanup()
{
delete m_series;
}
void tst_series::construct()
{
QScatter3DSeries *series = new QScatter3DSeries();
QVERIFY(series);
delete series;
QScatterDataProxy *proxy = new QScatterDataProxy();
series = new QScatter3DSeries(proxy);
QVERIFY(series);
QCOMPARE(series->dataProxy(), proxy);
delete series;
}
void tst_series::initialProperties()
{
QVERIFY(m_series);
QVERIFY(m_series->dataProxy());
QCOMPARE(m_series->itemSize(), 0.0f);
QCOMPARE(m_series->selectedItem(), m_series->invalidSelectionIndex());
// 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);
QCOMPARE(m_series->type(), QAbstract3DSeries::SeriesTypeScatter);
}
void tst_series::initializeProperties()
{
QVERIFY(m_series);
m_series->setDataProxy(new QScatterDataProxy());
m_series->setItemSize(0.5f);
m_series->setSelectedItem(0);
QCOMPARE(m_series->itemSize(), 0.5f);
QCOMPARE(m_series->selectedItem(), 0);
// Common properties. The ones identical between different series are tested in QBar3DSeries tests
m_series->setMesh(QAbstract3DSeries::MeshPoint);
m_series->setMeshRotation(QQuaternion(1, 1, 10, 20));
QCOMPARE(m_series->mesh(), QAbstract3DSeries::MeshPoint);
QCOMPARE(m_series->meshRotation(), QQuaternion(1, 1, 10, 20));
}
QTEST_MAIN(tst_series)
#include "tst_series.moc"