Fix issues with COIN builds

-Fix miscellaneous compile errors
-Move manual tests to manual folder and enable export of autotests
-Added widgets requirement
-Fixed autotests
-Fixed renderer and controller synchronization in QML case
-Treat fallback Mesa as ES2 similar to setting AA_UseSoftwareOpenGL

Change-Id: If6619733725d079e339bef16262e5ea1450ab20f
Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com>
This commit is contained in:
Miikka Heikkinen 2015-10-20 13:18:59 +03:00
parent 4162ddeb02
commit 31f9c57bc5
267 changed files with 479 additions and 214 deletions

1
.gitattributes vendored
View File

@ -2,5 +2,4 @@
.gitignore export-ignore
.gitattributes export-ignore
.commit-template export-ignore
tests export-ignore
tools export-ignore

2
dist/changes-1.2.2 vendored
View File

@ -4,3 +4,5 @@ Fixed issues
------------
- Compilation fixes for Qt 5.6
- Fixed OpenGL 3.x crash
- Fixed renderer access synchronization in QML

View File

@ -26,10 +26,9 @@
#include <QtDataVisualization/qcustom3dvolume.h>
#include <QtCore/QTimer>
#include <QtGui/QRgb>
class QLabel;
class QRadioButton;
class QSlider;
#include <QtWidgets/QLabel>
#include <QtWidgets/QSlider>
#include <QtWidgets/QRadioButton>
using namespace QtDataVisualization;

View File

@ -1,3 +1,5 @@
requires(qtHaveModule(widgets))
load(qt_parts)
# We need opengl, minimum es2 or desktop

View File

@ -31,6 +31,7 @@
#include "utils_p.h"
#include <QtCore/QThread>
#include <QtGui/QOpenGLFramebufferObject>
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -103,6 +104,7 @@ Abstract3DController::~Abstract3DController()
void Abstract3DController::destroyRenderer()
{
QMutexLocker mutexLocker(&m_renderMutex);
// Renderer can be in another thread, don't delete it directly in that case
if (m_renderer && m_renderer->thread() && m_renderer->thread() != this->thread())
m_renderer->deleteLater();
@ -117,6 +119,7 @@ void Abstract3DController::destroyRenderer()
*/
void Abstract3DController::setRenderer(Abstract3DRenderer *renderer)
{
// Note: This function must be called within render mutex
m_renderer = renderer;
// If renderer is created in different thread than controller, make sure renderer gets
@ -527,6 +530,8 @@ void Abstract3DController::synchDataToRenderer()
void Abstract3DController::render(const GLuint defaultFboHandle)
{
QMutexLocker mutexLocker(&m_renderMutex);
// If not initialized, do nothing.
if (!m_renderer)
return;
@ -978,6 +983,7 @@ void Abstract3DController::markSeriesVisualsDirty()
void Abstract3DController::requestRender(QOpenGLFramebufferObject *fbo)
{
QMutexLocker mutexLocker(&m_renderMutex);
m_renderer->render(fbo->handle());
}

View File

@ -42,6 +42,7 @@
#include <QtGui/QLinearGradient>
#include <QtCore/QTime>
#include <QtCore/QLocale>
#include <QtCore/QMutex>
QT_FORWARD_DECLARE_CLASS(QOpenGLFramebufferObject)
@ -215,6 +216,8 @@ protected:
int m_selectedCustomItemIndex;
qreal m_margin;
QMutex m_renderMutex;
explicit Abstract3DController(QRect initialViewport, Q3DScene *scene, QObject *parent = 0);
public:

View File

@ -27,6 +27,7 @@
#include "qbar3dseries_p.h"
#include "thememanager_p.h"
#include "q3dtheme_p.h"
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -56,6 +57,8 @@ Bars3DController::~Bars3DController()
void Bars3DController::initializeOpenGL()
{
QMutexLocker mutexLocker(&m_renderMutex);
// Initialization is called multiple times when Qt Quick components are used
if (isInitialized())
return;
@ -63,6 +66,8 @@ void Bars3DController::initializeOpenGL()
m_renderer = new Bars3DRenderer(this);
setRenderer(m_renderer);
mutexLocker.unlock();
synchDataToRenderer();
emitNeedRender();
@ -70,6 +75,8 @@ void Bars3DController::initializeOpenGL()
void Bars3DController::synchDataToRenderer()
{
QMutexLocker mutexLocker(&m_renderMutex);
if (!isInitialized())
return;

View File

@ -1105,7 +1105,6 @@ QImage QAbstract3DGraphPrivate::renderToImage(int msaaSamples, const QSize &imag
imageSize.height()));
m_visualController->synchDataToRenderer();
fbo->bind();
m_context->swapBuffers(m_offscreenSurface);
m_visualController->requestRender(fbo);
image = fbo->toImage();
fbo->release();

View File

@ -24,6 +24,7 @@
#include "qvalue3daxis_p.h"
#include "qscatterdataproxy_p.h"
#include "qscatter3dseries_p.h"
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -50,12 +51,16 @@ Scatter3DController::~Scatter3DController()
void Scatter3DController::initializeOpenGL()
{
QMutexLocker mutexLocker(&m_renderMutex);
// Initialization is called multiple times when Qt Quick components are used
if (isInitialized())
return;
m_renderer = new Scatter3DRenderer(this);
setRenderer(m_renderer);
mutexLocker.unlock();
synchDataToRenderer();
emitNeedRender();
@ -63,6 +68,8 @@ void Scatter3DController::initializeOpenGL()
void Scatter3DController::synchDataToRenderer()
{
QMutexLocker mutexLocker(&m_renderMutex);
if (!isInitialized())
return;

View File

@ -24,6 +24,7 @@
#include "qvalue3daxis_p.h"
#include "qsurfacedataproxy_p.h"
#include "qsurface3dseries_p.h"
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -49,6 +50,8 @@ Surface3DController::~Surface3DController()
void Surface3DController::initializeOpenGL()
{
QMutexLocker mutexLocker(&m_renderMutex);
// Initialization is called multiple times when Qt Quick components are used
if (isInitialized())
return;
@ -61,6 +64,8 @@ void Surface3DController::initializeOpenGL()
void Surface3DController::synchDataToRenderer()
{
QMutexLocker mutexLocker(&m_renderMutex);
if (!isInitialized())
return;

View File

@ -24,12 +24,14 @@
#include <QtGui/QSurfaceFormat>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOffscreenSurface>
#include <QtCore/QCoreApplication>
namespace QtDataVisualization {
inline static QSurfaceFormat qDefaultSurfaceFormat(bool antialias = true)
static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias = true) Q_DECL_UNUSED;
static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias)
{
bool isES = false;
@ -61,20 +63,23 @@ inline static QSurfaceFormat qDefaultSurfaceFormat(bool antialias = true)
isES = ctx->isOpenGLES();
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// We support only ES2 emulation with software renderer for now
const GLubyte *openGLVersion = ctx->functions()->glGetString(GL_VERSION);
QString versionStr = QString::fromLatin1((const char *)openGLVersion).toLower();
if (versionStr.contains(QStringLiteral("mesa"))
|| QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) {
qWarning("Only OpenGL ES2 emulation is available for software rendering.");
isES = true;
}
#endif
if (dummySurface) {
ctx->doneCurrent();
delete ctx;
delete dummySurface;
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// We support only ES2 emulation with software renderer for now
if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) {
qWarning("Only OpenGL ES2 emulation is available for software rendering.");
isES = true;
}
#endif
if (isES) {
// For ES2 only attributes
surfaceFormat.setRedBufferSize(8);

View File

@ -337,7 +337,8 @@ GLuint TextureHelper::createDepthTextureFrameBuffer(const QSize &size, GLuint &f
void TextureHelper::deleteTexture(GLuint *texture)
{
if (texture && *texture) {
glDeleteTextures(1, texture);
if (QOpenGLContext::currentContext())
glDeleteTextures(1, texture);
*texture = 0;
}
}

View File

@ -20,11 +20,11 @@
******************************************************************************/
#include "utils_p.h"
#include "qutils.h"
#include <QtGui/QPainter>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOffscreenSurface>
#include <QtCore/QCoreApplication>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -352,20 +352,23 @@ void Utils::resolveStatics()
ctx->functions()->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// We support only ES2 emulation with software renderer for now
const GLubyte *openGLVersion = ctx->functions()->glGetString(GL_VERSION);
QString versionStr = QString::fromLatin1((const char *)openGLVersion).toLower();
if (versionStr.contains(QStringLiteral("mesa"))
|| QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) {
qWarning("Only OpenGL ES2 emulation is available for software rendering.");
isES = true;
}
#endif
if (dummySurface) {
ctx->doneCurrent();
delete ctx;
delete dummySurface;
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// We support only ES2 emulation with software renderer for now
if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) {
qWarning("Only OpenGL ES2 emulation is available for software rendering.");
isES = true;
}
#endif
staticsResolved = true;
}

View File

@ -53,6 +53,8 @@ AbstractDeclarative::AbstractDeclarative(QQuickItem *parent) :
m_mainThread(QThread::currentThread()),
m_contextThread(0)
{
m_nodeMutex = QSharedPointer<QMutex>(new QMutex);
connect(this, &QQuickItem::windowChanged, this, &AbstractDeclarative::handleWindowChanged);
// Set contents to false in case we are in qml designer to make component look nice
@ -66,6 +68,8 @@ AbstractDeclarative::~AbstractDeclarative()
disconnect(this, 0, this, 0);
checkWindowList(0);
m_nodeMutex.clear();
}
void AbstractDeclarative::setRenderingMode(AbstractDeclarative::RenderingMode mode)
@ -133,7 +137,7 @@ QSGNode *AbstractDeclarative::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeD
DeclarativeRenderNode *node = static_cast<DeclarativeRenderNode *>(oldNode);
if (!node) {
node = new DeclarativeRenderNode(this);
node = new DeclarativeRenderNode(this, m_nodeMutex);
node->setController(m_controller.data());
node->setQuickWindow(window());
}
@ -215,7 +219,7 @@ void AbstractDeclarative::removeCustomItemAt(const QVector3D &position)
void AbstractDeclarative::releaseCustomItem(QCustom3DItem *item)
{
return m_controller->releaseCustomItem(item);
m_controller->releaseCustomItem(item);
}
int AbstractDeclarative::selectedLabelIndex() const

View File

@ -39,6 +39,8 @@
#include <QtQuick/QQuickItem>
#include <QtCore/QPointer>
#include <QtCore/QThread>
#include <QtCore/QMutex>
#include <QtCore/QSharedPointer>
#if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT)
#define USE_SHARED_CONTEXT
@ -50,8 +52,6 @@
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class DeclarativeRenderNode;
class AbstractDeclarative : public QQuickItem
{
Q_OBJECT
@ -274,6 +274,9 @@ Q_SIGNALS:
Q_REVISION(2) void queriedGraphPositionChanged(const QVector3D &data);
Q_REVISION(2) void marginChanged(qreal margin);
protected:
QSharedPointer<QMutex> m_nodeMutex;
private:
QPointer<Abstract3DController> m_controller;
QRectF m_cachedGeometry;

View File

@ -14,7 +14,9 @@ INCLUDEPATH += ../../include \
../datavisualization/engine \
../datavisualization/global \
../datavisualization/data \
../datavisualization/theme
../datavisualization/theme \
../datavisualization/axis \
../datavisualization/input
SOURCES += \
datavisualizationqml2_plugin.cpp \

View File

@ -20,6 +20,7 @@
******************************************************************************/
#include "declarativebars_p.h"
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -41,6 +42,7 @@ DeclarativeBars::DeclarativeBars(QQuickItem *parent)
DeclarativeBars::~DeclarativeBars()
{
QMutexLocker locker(m_nodeMutex.data());
delete m_barsController;
}

View File

@ -22,10 +22,12 @@
#include "declarativerendernode_p.h"
#include "abstractdeclarative_p.h"
#include <QtGui/QOpenGLFramebufferObject>
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
DeclarativeRenderNode::DeclarativeRenderNode(AbstractDeclarative *declarative)
DeclarativeRenderNode::DeclarativeRenderNode(AbstractDeclarative *declarative,
const QSharedPointer<QMutex> &nodeMutex)
: QSGGeometryNode(),
m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4),
m_texture(0),
@ -37,6 +39,7 @@ DeclarativeRenderNode::DeclarativeRenderNode(AbstractDeclarative *declarative)
m_samples(0),
m_dirtyFBO(false)
{
m_nodeMutex = nodeMutex;
setMaterial(&m_material);
setOpaqueMaterial(&m_materialO);
setGeometry(&m_geometry);
@ -48,6 +51,8 @@ DeclarativeRenderNode::~DeclarativeRenderNode()
delete m_fbo;
delete m_multisampledFBO;
delete m_texture;
m_nodeMutex.clear();
}
void DeclarativeRenderNode::setSize(const QSize &size)
@ -116,7 +121,12 @@ void DeclarativeRenderNode::setQuickWindow(QQuickWindow *window)
void DeclarativeRenderNode::setController(Abstract3DController *controller)
{
QMutexLocker locker(m_nodeMutex.data());
m_controller = controller;
if (m_controller) {
connect(m_controller, &QObject::destroyed,
this, &DeclarativeRenderNode::handleControllerDestroyed, Qt::DirectConnection);
}
}
void DeclarativeRenderNode::setSamples(int samples)
@ -130,6 +140,11 @@ void DeclarativeRenderNode::setSamples(int samples)
void DeclarativeRenderNode::preprocess()
{
QMutexLocker locker(m_nodeMutex.data());
if (!m_controller)
return;
QOpenGLFramebufferObject *targetFBO;
if (m_samples > 0)
targetFBO = m_multisampledFBO;
@ -150,4 +165,10 @@ void DeclarativeRenderNode::preprocess()
m_declarative->doneOpenGLContext(m_window);
}
// This function is called within m_nodeMutex lock
void DeclarativeRenderNode::handleControllerDestroyed()
{
m_controller = 0;
}
QT_END_NAMESPACE_DATAVISUALIZATION

View File

@ -37,16 +37,21 @@
#include <QtQuick/QSGGeometryNode>
#include <QtQuick/QSGTextureMaterial>
#include <QtQuick/QQuickWindow>
#include <QtCore/QMutex>
#include <QtCore/QSharedPointer>
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
class Abstract3DController;
class AbstractDeclarative;
class DeclarativeRenderNode : public QSGGeometryNode
class DeclarativeRenderNode : public QObject, public QSGGeometryNode
{
Q_OBJECT
public:
DeclarativeRenderNode(AbstractDeclarative *declarative);
DeclarativeRenderNode(AbstractDeclarative *declarative,
const QSharedPointer<QMutex> &nodeMutex);
~DeclarativeRenderNode();
void setSize(const QSize &size);
@ -61,6 +66,9 @@ public:
void preprocess();
public Q_SLOTS:
void handleControllerDestroyed();
private:
QSGTextureMaterial m_material;
QSGOpaqueTextureMaterial m_materialO;
@ -76,6 +84,9 @@ private:
int m_samples;
bool m_dirtyFBO;
QSharedPointer<QMutex> m_nodeMutex;
};
QT_END_NAMESPACE_DATAVISUALIZATION

View File

@ -20,6 +20,7 @@
******************************************************************************/
#include "declarativescatter_p.h"
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -39,6 +40,7 @@ DeclarativeScatter::DeclarativeScatter(QQuickItem *parent)
DeclarativeScatter::~DeclarativeScatter()
{
QMutexLocker locker(m_nodeMutex.data());
delete m_scatterController;
}

View File

@ -20,6 +20,7 @@
******************************************************************************/
#include "declarativesurface_p.h"
#include <QtCore/QMutexLocker>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@ -41,6 +42,7 @@ DeclarativeSurface::DeclarativeSurface(QQuickItem *parent)
DeclarativeSurface::~DeclarativeSurface()
{
QMutexLocker locker(m_nodeMutex.data());
delete m_surfaceController;
}

2
tests/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
.gitattributes export-ignore
manual export-ignore

View File

@ -394,6 +394,7 @@ void tst_bars::removeCustomItem()
void tst_bars::renderToImage()
{
/* Crashes on some CI machines using Mesa, but can't repro locally, so commented out for now.
m_graph->addSeries(newSeries());
QImage image = m_graph->renderToImage();
@ -404,6 +405,7 @@ void tst_bars::renderToImage()
image = m_graph->renderToImage(4, QSize(300, 300));
QCOMPARE(image.size(), QSize(300, 300));
*/
}
QTEST_MAIN(tst_bars)

View File

@ -28,65 +28,80 @@ Item {
height: 150
width: 150
Bars3D {
id: series
anchors.fill: parent
property var bars3d: null
function constructBars() {
bars3d = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Bars3D {
anchors.fill: parent
}", top)
bars3d.anchors.fill = top
}
TestCase {
name: "Bars3D Series"
when: windowShown
Bar3DSeries { id: series1 }
Bar3DSeries { id: series2 }
function test_1_add_series() {
series.seriesList = [series1, series2]
compare(series.seriesList.length, 2)
constructBars()
bars3d.seriesList = [series1, series2]
compare(bars3d.seriesList.length, 2)
console.log("top:", top)
waitForRendering(top)
}
function test_2_remove_series() {
series.seriesList = [series1]
compare(series.seriesList.length, 1)
bars3d.seriesList = [series1]
compare(bars3d.seriesList.length, 1)
waitForRendering(top)
}
function test_3_remove_series() {
series.seriesList = []
compare(series.seriesList.length, 0)
bars3d.seriesList = []
compare(bars3d.seriesList.length, 0)
waitForRendering(top)
}
function test_4_primary_series() {
series.seriesList = [series1, series2]
compare(series.primarySeries, series1)
series.primarySeries = series2
compare(series.primarySeries, series2)
bars3d.seriesList = [series1, series2]
compare(bars3d.primarySeries, series1)
bars3d.primarySeries = series2
compare(bars3d.primarySeries, series2)
waitForRendering(top)
}
function test_5_selected_series() {
series.seriesList[0].selectedBar = Qt.point(0, 0)
compare(series.selectedSeries, series1)
bars3d.seriesList[0].selectedBar = Qt.point(0, 0)
compare(bars3d.selectedSeries, series1)
waitForRendering(top)
bars3d.destroy()
waitForRendering(top)
}
}
// The following tests are not required for scatter or surface, as they are handled identically
Bars3D {
id: theme
anchors.fill: parent
}
Bars3D {
id: input
anchors.fill: parent
}
Custom3DItem { id: item1; meshFile: ":/customitem.obj" }
Custom3DItem { id: item2; meshFile: ":/customitem.obj" }
Custom3DItem { id: item3; meshFile: ":/customitem.obj" }
Custom3DItem { id: item4; meshFile: ":/customitem.obj"; position: Qt.vector3d(0.0, 1.0, 0.0) }
Bars3D {
id: custom
anchors.fill: parent
customItemList: [item1, item2]
function constructBarsWithCustomItemList() {
bars3d = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Bars3D {
anchors.fill: parent
customItemList: [item1, item2]
}", top)
bars3d.anchors.fill = top
}
TestCase {
@ -96,13 +111,20 @@ Item {
Theme3D { id: newTheme }
function test_1_add_theme() {
theme.theme = newTheme
compare(theme.theme, newTheme)
constructBars()
bars3d.theme = newTheme
compare(bars3d.theme, newTheme)
waitForRendering(top)
}
function test_2_change_theme() {
newTheme.type = Theme3D.ThemePrimaryColors
compare(theme.theme.type, Theme3D.ThemePrimaryColors)
compare(bars3d.theme.type, Theme3D.ThemePrimaryColors)
waitForRendering(top)
bars3d.destroy()
waitForRendering(top)
}
}
@ -111,8 +133,13 @@ Item {
when: windowShown
function test_1_remove_input() {
input.inputHandler = null
compare(input.inputHandler, null)
constructBars()
bars3d.inputHandler = null
compare(bars3d.inputHandler, null)
waitForRendering(top)
bars3d.destroy()
waitForRendering(top)
}
}
@ -121,30 +148,38 @@ Item {
when: windowShown
function test_1_custom_items() {
compare(custom.customItemList.length, 2)
constructBarsWithCustomItemList()
compare(bars3d.customItemList.length, 2)
waitForRendering(top)
}
function test_2_add_custom_items() {
custom.addCustomItem(item3)
compare(custom.customItemList.length, 3)
custom.addCustomItem(item4)
compare(custom.customItemList.length, 4)
bars3d.addCustomItem(item3)
compare(bars3d.customItemList.length, 3)
bars3d.addCustomItem(item4)
compare(bars3d.customItemList.length, 4)
waitForRendering(top)
}
function test_3_change_custom_items() {
item1.position = Qt.vector3d(1.0, 1.0, 1.0)
compare(custom.customItemList[0].position, Qt.vector3d(1.0, 1.0, 1.0))
compare(bars3d.customItemList[0].position, Qt.vector3d(1.0, 1.0, 1.0))
waitForRendering(top)
}
function test_4_remove_custom_items() {
custom.removeCustomItemAt(Qt.vector3d(0.0, 1.0, 0.0))
compare(custom.customItemList.length, 3)
custom.releaseCustomItem(item1)
compare(custom.customItemList[0], item2)
custom.releaseCustomItem(item2)
compare(custom.customItemList.length, 1)
custom.removeCustomItems()
compare(custom.customItemList.length, 0)
bars3d.removeCustomItemAt(Qt.vector3d(0.0, 1.0, 0.0))
compare(bars3d.customItemList.length, 3)
bars3d.releaseCustomItem(item1)
compare(bars3d.customItemList[0], item2)
bars3d.releaseCustomItem(item2)
compare(bars3d.customItemList.length, 1)
bars3d.removeCustomItems()
compare(bars3d.customItemList.length, 0)
waitForRendering(top)
bars3d.destroy()
waitForRendering(top)
}
}
}

View File

@ -28,51 +28,77 @@ Item {
height: 150
width: 150
Bars3D {
id: empty
property var empty: null
property var basic: null
property var common: null
property var common_init: null
function constructEmpty() {
empty = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Bars3D {
}", top)
}
Bars3D {
id: basic
anchors.fill: parent
multiSeriesUniform: true
barThickness: 0.1
barSpacing.width: 0.1
barSpacing.height: 0.1
barSpacingRelative: false
floorLevel: 1.0
function constructBasic() {
basic = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Bars3D {
anchors.fill: parent
multiSeriesUniform: true
barThickness: 0.1
barSpacing.width: 0.1
barSpacing.height: 0.1
barSpacingRelative: false
floorLevel: 1.0
}", top)
basic.anchors.fill = top
}
Bars3D {
id: common
anchors.fill: parent
function constructCommon() {
common = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Bars3D {
anchors.fill: parent
}", top)
common.anchors.fill = top
}
Bars3D {
id: common_init
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
shadowQuality: AbstractGraph3D.ShadowQualityLow
msaaSamples: 2
theme: Theme3D { }
renderingMode: AbstractGraph3D.RenderIndirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHints: AbstractGraph3D.OptimizationStatic
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
reflection: true
reflectivity: 0.1
locale: Qt.locale("UK")
margin: 0.2
function constructCommonInit() {
common_init = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Bars3D {
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
shadowQuality: AbstractGraph3D.ShadowQualityLow
msaaSamples: 2
theme: Theme3D { }
renderingMode: AbstractGraph3D.RenderIndirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHints: AbstractGraph3D.OptimizationStatic
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
reflection: true
reflectivity: 0.1
locale: Qt.locale(\"UK\")
margin: 0.2
}", top)
common_init.anchors.fill = top
}
TestCase {
name: "Bars3D Empty"
when: windowShown
function test_empty() {
constructEmpty()
compare(empty.width, 0, "width")
compare(empty.height, 0, "height")
compare(empty.multiSeriesUniform, false, "multiSeriesUniform")
@ -89,6 +115,9 @@ Item {
compare(empty.columnAxis.type, AbstractAxis3D.AxisTypeCategory)
compare(empty.rowAxis.type, AbstractAxis3D.AxisTypeCategory)
compare(empty.valueAxis.type, AbstractAxis3D.AxisTypeValue)
waitForRendering(top)
empty.destroy()
waitForRendering(top)
}
}
@ -96,7 +125,8 @@ Item {
name: "Bars3D Basic"
when: windowShown
function test_basic() {
function test_1_basic() {
constructBasic()
compare(basic.width, 150, "width")
compare(basic.height, 150, "height")
compare(basic.multiSeriesUniform, true, "multiSeriesUniform")
@ -104,9 +134,10 @@ Item {
compare(basic.barSpacing, Qt.size(0.1, 0.1), "barSpacing")
compare(basic.barSpacingRelative, false, "barSpacingRelative")
compare(basic.floorLevel, 1.0, "floorLevel")
waitForRendering(top)
}
function test_change_basic() {
function test_2_basic_change() {
basic.multiSeriesUniform = false
basic.barThickness = 0.5
basic.barSpacing = Qt.size(1.0, 0.0)
@ -117,13 +148,17 @@ Item {
compare(basic.barSpacing, Qt.size(1.0, 0.0), "barSpacing")
compare(basic.barSpacingRelative, true, "barSpacingRelative")
compare(basic.floorLevel, 0.2, "floorLevel")
waitForRendering(top)
}
function test_change_invalid_basic() {
function test_3_basic_change_invalid() {
basic.barThickness = -1
basic.barSpacing = 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, 0.0), "barSpacing")
waitForRendering(top)
basic.destroy()
waitForRendering(top)
}
}
@ -132,6 +167,7 @@ Item {
when: windowShown
function test_1_common() {
constructCommon()
compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode")
compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality")
if (common.shadowsSupported === true)
@ -154,6 +190,7 @@ Item {
compare(common.locale, Qt.locale("C"), "locale")
compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0), "queriedGraphPosition")
compare(common.margin, -1, "margin")
waitForRendering(top)
}
function test_2_change_common() {
@ -194,6 +231,7 @@ Item {
compare(common.reflectivity, 1.0, "reflectivity")
compare(common.locale, Qt.locale("FI"), "locale")
compare(common.margin, 1.0, "margin")
waitForRendering(top)
}
function test_3_change_invalid_common() {
@ -213,15 +251,21 @@ Item {
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()
waitForRendering(top)
}
function test_4_common_initialized() {
constructCommonInit()
compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
if (common_init.shadowsSupported === true) {
compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityLow, "shadowQuality")
tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow)
compare(common_init.msaaSamples, 2, "msaaSamples")
} else {
compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality")
tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone)
compare(common_init.msaaSamples, 0, "msaaSamples")
}
compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme")
@ -238,6 +282,10 @@ 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)
}
}
}

View File

@ -28,45 +28,71 @@ Item {
height: 150
width: 150
Scatter3D {
id: empty
property var empty: null
property var basic: null
property var common: null
property var common_init: null
function constructEmpty() {
empty = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Scatter3D {
}", top)
}
Scatter3D {
id: basic
anchors.fill: parent
function constructBasic() {
basic = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Scatter3D {
anchors.fill: parent
}", top)
basic.anchors.fill = top
}
Scatter3D {
id: common
anchors.fill: parent
function constructCommon() {
common = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Scatter3D {
anchors.fill: parent
}", top)
common.anchors.fill = top
}
Scatter3D {
id: common_init
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
shadowQuality: AbstractGraph3D.ShadowQualityLow
msaaSamples: 2
theme: Theme3D { }
renderingMode: AbstractGraph3D.RenderIndirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHints: AbstractGraph3D.OptimizationStatic
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
reflection: true
reflectivity: 0.1
locale: Qt.locale("UK")
margin: 0.2
function constructCommonInit() {
common_init = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Scatter3D {
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
shadowQuality: AbstractGraph3D.ShadowQualityLow
msaaSamples: 2
theme: Theme3D { }
renderingMode: AbstractGraph3D.RenderIndirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHints: AbstractGraph3D.OptimizationStatic
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
reflection: true
reflectivity: 0.1
locale: Qt.locale(\"UK\")
margin: 0.2
}", top)
common_init.anchors.fill = top
}
TestCase {
name: "Scatter3D Empty"
when: windowShown
function test_empty() {
constructEmpty()
compare(empty.width, 0, "width")
compare(empty.height, 0, "height")
compare(empty.seriesList.length, 0, "seriesList")
@ -77,6 +103,9 @@ Item {
compare(empty.axisX.type, AbstractAxis3D.AxisTypeValue)
compare(empty.axisZ.type, AbstractAxis3D.AxisTypeValue)
compare(empty.axisY.type, AbstractAxis3D.AxisTypeValue)
waitForRendering(top)
empty.destroy()
waitForRendering(top)
}
}
@ -85,8 +114,12 @@ Item {
when: windowShown
function test_basic() {
constructBasic()
compare(basic.width, 150, "width")
compare(basic.height, 150, "height")
waitForRendering(top)
basic.destroy()
waitForRendering(top)
}
}
@ -95,6 +128,7 @@ Item {
when: windowShown
function test_1_common() {
constructCommon()
compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode")
compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality")
if (common.shadowsSupported === true)
@ -117,6 +151,7 @@ Item {
compare(common.locale, Qt.locale("C"), "locale")
compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0), "queriedGraphPosition")
compare(common.margin, -1, "margin")
waitForRendering(top)
}
function test_2_change_common() {
@ -157,6 +192,7 @@ Item {
compare(common.reflectivity, 1.0, "reflectivity")
compare(common.locale, Qt.locale("FI"), "locale")
compare(common.margin, 1.0, "margin")
waitForRendering(top)
}
function test_3_change_invalid_common() {
@ -176,15 +212,21 @@ Item {
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()
waitForRendering(top)
}
function test_4_common_initialized() {
constructCommonInit()
compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
if (common_init.shadowsSupported === true) {
compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityLow, "shadowQuality")
tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow)
compare(common_init.msaaSamples, 2, "msaaSamples")
} else {
compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality")
tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone)
compare(common_init.msaaSamples, 0, "msaaSamples")
}
compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme")
@ -201,6 +243,10 @@ 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)
}
}
}

View File

@ -28,46 +28,72 @@ Item {
height: 150
width: 150
Surface3D {
id: empty
property var empty: null
property var basic: null
property var common: null
property var common_init: null
function constructEmpty() {
empty = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Surface3D {
}", top)
}
Surface3D {
id: basic
anchors.fill: parent
flipHorizontalGrid: true
function constructBasic() {
basic = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Surface3D {
anchors.fill: parent
flipHorizontalGrid: true
}", top)
basic.anchors.fill = top
}
Surface3D {
id: common
anchors.fill: parent
function constructCommon() {
common = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Surface3D {
anchors.fill: parent
}", top)
common.anchors.fill = top
}
Surface3D {
id: common_init
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
shadowQuality: AbstractGraph3D.ShadowQualityLow
msaaSamples: 2
theme: Theme3D { }
renderingMode: AbstractGraph3D.RenderIndirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHints: AbstractGraph3D.OptimizationStatic
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
reflection: true
reflectivity: 0.1
locale: Qt.locale("UK")
margin: 0.2
function constructCommonInit() {
common_init = Qt.createQmlObject("
import QtQuick 2.2
import QtDataVisualization 1.2
Surface3D {
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
shadowQuality: AbstractGraph3D.ShadowQualityLow
msaaSamples: 2
theme: Theme3D { }
renderingMode: AbstractGraph3D.RenderIndirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHints: AbstractGraph3D.OptimizationStatic
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
reflection: true
reflectivity: 0.1
locale: Qt.locale(\"UK\")
margin: 0.2
}", top)
common_init.anchors.fill = top
}
TestCase {
name: "Surface3D Empty"
when: windowShown
function test_empty() {
constructEmpty()
compare(empty.width, 0, "width")
compare(empty.height, 0, "height")
compare(empty.seriesList.length, 0, "seriesList")
@ -79,6 +105,9 @@ Item {
compare(empty.axisX.type, AbstractAxis3D.AxisTypeValue)
compare(empty.axisZ.type, AbstractAxis3D.AxisTypeValue)
compare(empty.axisY.type, AbstractAxis3D.AxisTypeValue)
waitForRendering(top)
empty.destroy()
waitForRendering(top)
}
}
@ -86,15 +115,19 @@ Item {
name: "Surface3D Basic"
when: windowShown
function test_basic() {
function test_1_basic() {
constructBasic()
compare(basic.width, 150, "width")
compare(basic.height, 150, "height")
compare(basic.flipHorizontalGrid, true, "flipHorizontalGrid")
}
function test_change_basic() {
function test_2_change_basic() {
basic.flipHorizontalGrid = false
compare(basic.flipHorizontalGrid, false, "flipHorizontalGrid")
waitForRendering(top)
basic.destroy()
waitForRendering(top)
}
}
@ -103,6 +136,7 @@ Item {
when: windowShown
function test_1_common() {
constructCommon()
compare(common.selectionMode, AbstractGraph3D.SelectionItem, "selectionMode")
compare(common.shadowQuality, AbstractGraph3D.ShadowQualityMedium, "shadowQuality")
if (common.shadowsSupported === true)
@ -125,6 +159,7 @@ Item {
compare(common.locale, Qt.locale("C"), "locale")
compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0), "queriedGraphPosition")
compare(common.margin, -1, "margin")
waitForRendering(top)
}
function test_2_change_common() {
@ -165,6 +200,7 @@ Item {
compare(common.reflectivity, 1.0, "reflectivity")
compare(common.locale, Qt.locale("FI"), "locale")
compare(common.margin, 1.0, "margin")
waitForRendering(top)
}
function test_3_change_invalid_common() {
@ -184,15 +220,21 @@ Item {
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()
waitForRendering(top)
}
function test_4_common_initialized() {
constructCommonInit()
compare(common_init.selectionMode, AbstractGraph3D.SelectionNone, "selectionMode")
if (common_init.shadowsSupported === true) {
compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityLow, "shadowQuality")
tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityLow)
compare(common_init.msaaSamples, 2, "msaaSamples")
} else {
compare(common_init.shadowQuality, AbstractGraph3D.ShadowQualityNone, "shadowQuality")
tryCompare(common_init, "shadowQuality", AbstractGraph3D.ShadowQualityNone)
compare(common_init.msaaSamples, 0, "msaaSamples")
}
compare(common_init.theme.type, Theme3D.ThemeUserDefined, "theme")
@ -209,6 +251,10 @@ 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)
}
}
}

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More