Check for invalid aspect ratio values

At the same time, fix unqualified accesses in the touched
test files.

Pick-to: 6.8
Fixes: QTBUG-131730
Change-Id: Ib840c9f745751ee4738a62ca39df7d3d7b0699e4
Reviewed-by: Sami Varanka <sami.varanka@qt.io>
Reviewed-by: Sakaria Pouke <sakaria.pouke@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
This commit is contained in:
Tomi Korpipaa 2024-11-29 09:25:19 +02:00
parent 2acad5b4ba
commit dfefb422ff
7 changed files with 597 additions and 606 deletions

View File

@ -5372,7 +5372,7 @@ QtGraphs3D::ElementType QQuickGraphsItem::selectedElement() const
void QQuickGraphsItem::setAspectRatio(qreal ratio)
{
if (m_aspectRatio != ratio) {
if (m_aspectRatio != ratio && ratio > 0.0) {
m_aspectRatio = ratio;
m_changeTracker.aspectRatioChanged = true;
emit aspectRatioChanged(m_aspectRatio);
@ -5454,7 +5454,7 @@ float QQuickGraphsItem::radialLabelOffset() const
void QQuickGraphsItem::setHorizontalAspectRatio(qreal ratio)
{
if (m_horizontalAspectRatio != ratio) {
if (m_horizontalAspectRatio != ratio && ratio > 0.0) {
m_horizontalAspectRatio = ratio;
m_changeTracker.horizontalAspectRatioChanged = true;
emit horizontalAspectRatioChanged(m_horizontalAspectRatio);

View File

@ -296,8 +296,8 @@ void tst_bars::invalidProperties()
m_graph->setLocale(QLocale("XX"));
QCOMPARE(m_graph->selectionMode(), QtGraphs3D::SelectionFlag::Item);
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->aspectRatio(), 2.0);
QCOMPARE(m_graph->horizontalAspectRatio(), 0.0);
QCOMPARE(m_graph->locale(), QLocale("C"));
m_graph->setAmbientLightStrength(-1.0f);

View File

@ -152,8 +152,8 @@ void tst_scatter::invalidProperties()
m_graph->setCameraTargetPosition(QVector3D(2.f, -2.f, -2.f));
QCOMPARE(m_graph->selectionMode(), QtGraphs3D::SelectionFlag::Item);
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->aspectRatio(), 2.0);
QCOMPARE(m_graph->horizontalAspectRatio(), 0.0);
QCOMPARE(m_graph->locale(), QLocale("C"));
QCOMPARE(m_graph->cameraTargetPosition(), QVector3D(1.f, -1.f, -1.f));
}

View File

@ -164,8 +164,8 @@ void tst_surface::invalidProperties()
m_graph->setCameraTargetPosition(QVector3D(2.f, -2.f, -2.f));
QCOMPARE(m_graph->selectionMode(), QtGraphs3D::SelectionFlag::Item);
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->aspectRatio(), 2.0);
QCOMPARE(m_graph->horizontalAspectRatio(), 0.0);
QCOMPARE(m_graph->locale(), QLocale("C"));
QCOMPARE(m_graph->cameraTargetPosition(), QVector3D(1.f, -1.f, -1.f));
}

View File

@ -15,71 +15,71 @@ Item {
property var common_init: null
function constructEmpty() {
empty = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Bars3D {
}", top)
empty = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Bars3D {
}`, top)
}
function constructBasic() {
basic = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
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)
basic.anchors.fill = top
basic = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
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)
top.basic.anchors.fill = top
}
function constructCommon() {
common = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Bars3D {
anchors.fill: parent
}", top)
common = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Bars3D {
anchors.fill: parent
}`, top)
common.anchors.fill = top
}
function constructCommonInit() {
common_init = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Bars3D {
anchors.fill: parent
selectionMode: Graphs3D.SelectionFlag.None
shadowQuality: Graphs3D.ShadowQuality.Low
msaaSamples: 2
theme: GraphsTheme { }
renderingMode: Graphs3D.RenderingMode.Indirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHint: Graphs3D.OptimizationHint.Default
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
locale: Qt.locale(\"UK\")
margin: 0.2
labelMargin: 0.2
lightColor: \"black\"
ambientLightStrength: 0.5
lightStrength: 10.0
shadowStrength: 50.0
minCameraXRotation: 0.0
maxCameraXRotation: 90.0
minCameraYRotation: -90.0
maxCameraYRotation: 0.0
}", top)
common_init = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Bars3D {
anchors.fill: parent
selectionMode: Graphs3D.SelectionFlag.None
shadowQuality: Graphs3D.ShadowQuality.Low
msaaSamples: 2
theme: GraphsTheme { }
renderingMode: Graphs3D.RenderingMode.Indirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHint: Graphs3D.OptimizationHint.Default
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
locale: Qt.locale("UK")
margin: 0.2
labelMargin: 0.2
lightColor: "black"
ambientLightStrength: 0.5
lightStrength: 10.0
shadowStrength: 50.0
minCameraXRotation: 0.0
maxCameraXRotation: 90.0
minCameraYRotation: -90.0
maxCameraYRotation: 0.0
}`, top)
common_init.anchors.fill = top
}
@ -88,26 +88,26 @@ maxCameraYRotation: 0.0
when: windowShown
function test_empty() {
constructEmpty()
compare(empty.width, 0, "width")
compare(empty.height, 0, "height")
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")
compare(empty.primarySeries, null, "primarySeries")
compare(empty.floorLevel, 0.0, "floorLevel")
compare(empty.columnAxis.orientation, Abstract3DAxis.AxisOrientation.X)
compare(empty.rowAxis.orientation, Abstract3DAxis.AxisOrientation.Z)
compare(empty.valueAxis.orientation, Abstract3DAxis.AxisOrientation.Y)
compare(empty.columnAxis.type, Abstract3DAxis.AxisType.Category)
compare(empty.rowAxis.type, Abstract3DAxis.AxisType.Category)
compare(empty.valueAxis.type, Abstract3DAxis.AxisType.Value)
top.constructEmpty()
compare(top.empty.width, 0, "width")
compare(top.empty.height, 0, "height")
compare(top.empty.multiSeriesUniform, false, "multiSeriesUniform")
compare(top.empty.barThickness, 1.0, "barThickness")
compare(top.empty.barSpacing, Qt.size(1.0, 1.0), "barSpacing")
compare(top.empty.barSeriesMargin, Qt.size(0.0, 0.0), "barSeriesMargin")
compare(top.empty.barSpacingRelative, true, "barSpacingRelative")
compare(top.empty.seriesList.length, 0, "seriesList")
compare(top.empty.selectedSeries, null, "selectedSeries")
compare(top.empty.primarySeries, null, "primarySeries")
compare(top.empty.floorLevel, 0.0, "floorLevel")
compare(top.empty.columnAxis.orientation, Abstract3DAxis.AxisOrientation.X)
compare(top.empty.rowAxis.orientation, Abstract3DAxis.AxisOrientation.Z)
compare(top.empty.valueAxis.orientation, Abstract3DAxis.AxisOrientation.Y)
compare(top.empty.columnAxis.type, Abstract3DAxis.AxisType.Category)
compare(top.empty.rowAxis.type, Abstract3DAxis.AxisType.Category)
compare(top.empty.valueAxis.type, Abstract3DAxis.AxisType.Value)
waitForRendering(top)
empty.destroy()
top.empty.destroy()
waitForRendering(top)
}
}
@ -117,45 +117,45 @@ maxCameraYRotation: 0.0
when: windowShown
function test_1_basic() {
constructBasic()
compare(basic.width, 150, "width")
compare(basic.height, 150, "height")
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")
top.constructBasic()
compare(top.basic.width, 150, "width")
compare(top.basic.height, 150, "height")
compare(top.basic.multiSeriesUniform, true, "multiSeriesUniform")
compare(top.basic.barThickness, 0.1, "barThickness")
compare(top.basic.barSpacing, Qt.size(0.1, 0.1), "barSpacing")
compare(top.basic.barSeriesMargin, Qt.size(0.3, 0.3), "barSeriesMargin")
compare(top.basic.barSpacingRelative, false, "barSpacingRelative")
compare(top.basic.floorLevel, 1.0, "floorLevel")
waitForRendering(top)
}
function test_2_basic_change() {
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")
top.basic.multiSeriesUniform = false
top.basic.barThickness = 0.5
top.basic.barSpacing = Qt.size(1.0, 0.0)
top.basic.barSeriesMargin = Qt.size(0.5, 0.0)
top.basic.barSpacingRelative = true
top.basic.floorLevel = 0.2
compare(top.basic.multiSeriesUniform, false, "multiSeriesUniform")
compare(top.basic.barThickness, 0.5, "barThickness")
compare(top.basic.barSpacing, Qt.size(1.0, 0.0), "barSpacing")
compare(top.basic.barSeriesMargin, Qt.size(0.5, 0.0), "barSeriesMargin")
compare(top.basic.barSpacingRelative, true, "barSpacingRelative")
compare(top.basic.floorLevel, 0.2, "floorLevel")
waitForRendering(top)
}
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*/
top.basic.barThickness = -1
top.basic.barSpacing = Qt.size(-1.0, -1.0)
top.basic.barSeriesMargin = Qt.size(-1.0, -1.0)
compare(top.basic.barThickness, -1 /*0.5*/
, "barThickness") // TODO: Fix once QTRD-3367 is done
compare(basic.barSpacing, Qt.size(-1.0, -1.0), "barSpacing")
compare(basic.barSeriesMargin, Qt.size(-1.0, -1.0),
compare(top.basic.barSpacing, Qt.size(-1.0, -1.0), "barSpacing")
compare(top.basic.barSeriesMargin, Qt.size(-1.0, -1.0),
"barSeriesMargin")
waitForRendering(top)
basic.destroy()
top.basic.destroy()
waitForRendering(top)
}
}
@ -165,190 +165,187 @@ maxCameraYRotation: 0.0
when: windowShown
function test_1_common() {
constructCommon()
compare(common.selectionMode, Graphs3D.SelectionFlag.Item,
top.constructCommon()
compare(top.common.selectionMode, Graphs3D.SelectionFlag.Item,
"selectionMode")
compare(common.shadowQuality, Graphs3D.ShadowQuality.Medium,
compare(top.common.shadowQuality, Graphs3D.ShadowQuality.Medium,
"shadowQuality")
compare(common.msaaSamples, 4, "msaaSamples")
compare(common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
compare(common.renderingMode, Graphs3D.RenderingMode.Indirect,
compare(top.common.msaaSamples, 4, "msaaSamples")
compare(top.common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
compare(top.common.renderingMode, Graphs3D.RenderingMode.Indirect,
"renderingMode")
compare(common.measureFps, false, "measureFps")
compare(common.customItemList.length, 0, "customItemList")
compare(common.orthoProjection, false, "orthoProjection")
compare(common.selectedElement, Graphs3D.ElementType.None,
compare(top.common.measureFps, false, "measureFps")
compare(top.common.customItemList.length, 0, "customItemList")
compare(top.common.orthoProjection, false, "orthoProjection")
compare(top.common.selectedElement, Graphs3D.ElementType.None,
"selectedElement")
compare(common.aspectRatio, 2.0, "aspectRatio")
compare(common.optimizationHint, Graphs3D.OptimizationHint.Default,
compare(top.common.aspectRatio, 2.0, "aspectRatio")
compare(top.common.optimizationHint, Graphs3D.OptimizationHint.Default,
"optimizationHint")
compare(common.polar, false, "polar")
compare(common.radialLabelOffset, 1, "radialLabelOffset")
compare(common.horizontalAspectRatio, 0, "horizontalAspectRatio")
compare(common.locale, Qt.locale("C"), "locale")
compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0),
compare(top.common.polar, false, "polar")
compare(top.common.radialLabelOffset, 1, "radialLabelOffset")
compare(top.common.horizontalAspectRatio, 0, "horizontalAspectRatio")
compare(top.common.locale, Qt.locale("C"), "locale")
compare(top.common.queriedGraphPosition, Qt.vector3d(0, 0, 0),
"queriedGraphPosition")
compare(common.margin, -1, "margin")
compare(common.labelMargin, 0.1, "labelMargin")
compare(common.lightColor, "#ffffff", "lightColor")
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
compare(common.lightStrength, 5.0, "lightStrength")
compare(common.shadowStrength, 25.0, "shadowStrength")
compare(common.minCameraXRotation, -180.0, "minCameraXRotation")
compare(common.maxCameraXRotation, 180.0, "maxCameraXRotation")
compare(common.minCameraYRotation, 0.0, "minCameraYRotation")
compare(common.maxCameraYRotation, 90.0, "maxCameraYRotation")
compare(common.cameraTargetPosition, Qt.vector3d(0, 0, 0),
compare(top.common.margin, -1, "margin")
compare(top.common.labelMargin, 0.1, "labelMargin")
compare(top.common.lightColor, "#ffffff", "lightColor")
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
compare(top.common.lightStrength, 5.0, "lightStrength")
compare(top.common.shadowStrength, 25.0, "shadowStrength")
compare(top.common.minCameraXRotation, -180.0, "minCameraXRotation")
compare(top.common.maxCameraXRotation, 180.0, "maxCameraXRotation")
compare(top.common.minCameraYRotation, 0.0, "minCameraYRotation")
compare(top.common.maxCameraYRotation, 90.0, "maxCameraYRotation")
compare(top.common.cameraTargetPosition, Qt.vector3d(0, 0, 0),
"cameraTargetPosition")
}
function test_2_change_common() {
common.selectionMode = Graphs3D.SelectionFlag.Item
top.common.selectionMode = Graphs3D.SelectionFlag.Item
| Graphs3D.SelectionFlag.Row | Graphs3D.SelectionFlag.Slice
common.shadowQuality = Graphs3D.ShadowQuality.SoftHigh
compare(common.shadowQuality, Graphs3D.ShadowQuality.SoftHigh,
top.common.shadowQuality = Graphs3D.ShadowQuality.SoftHigh
compare(top.common.shadowQuality, Graphs3D.ShadowQuality.SoftHigh,
"shadowQuality")
common.msaaSamples = 8
compare(common.msaaSamples, 8, "msaaSamples")
common.theme.theme = GraphsTheme.Theme.QtGreenNeon
top.common.msaaSamples = 8
compare(top.common.msaaSamples, 8, "msaaSamples")
top.common.theme.theme = GraphsTheme.Theme.QtGreenNeon
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// common.renderingMode = Graphs3D.RenderingMode.DirectToBackground
common.measureFps = true
common.orthoProjection = true
common.aspectRatio = 1.0
common.optimizationHint = Graphs3D.OptimizationHint.Default
common.polar = true
common.radialLabelOffset = 2
common.horizontalAspectRatio = 1
common.locale = Qt.locale("FI")
common.margin = 1.0
common.labelMargin = 1.0
common.lightColor = "#ff0000"
common.ambientLightStrength = 0.5
common.lightStrength = 10.0
common.shadowStrength = 50.0
common.minCameraXRotation = 0
common.maxCameraXRotation = 90
common.minCameraYRotation = -90
common.maxCameraYRotation = 0
common.cameraTargetPosition = Qt.vector3d(1.0, 0.0, -1.0)
// top.common.renderingMode = Graphs3D.RenderingMode.DirectToBackground
top.common.measureFps = true
top.common.orthoProjection = true
top.common.aspectRatio = 1.0
top.common.optimizationHint = Graphs3D.OptimizationHint.Default
top.common.polar = true
top.common.radialLabelOffset = 2
top.common.horizontalAspectRatio = 1
top.common.locale = Qt.locale("FI")
top.common.margin = 1.0
top.common.labelMargin = 1.0
top.common.lightColor = "#ff0000"
top.common.ambientLightStrength = 0.5
top.common.lightStrength = 10.0
top.common.shadowStrength = 50.0
top.common.minCameraXRotation = 0
top.common.maxCameraXRotation = 90
top.common.minCameraYRotation = -90
top.common.maxCameraYRotation = 0
top.common.cameraTargetPosition = Qt.vector3d(1.0, 0.0, -1.0)
compare(common.selectionMode,
compare(top.common.selectionMode,
Graphs3D.SelectionFlag.Item | Graphs3D.SelectionFlag.Row
| Graphs3D.SelectionFlag.Slice, "selectionMode")
compare(common.shadowQuality, Graphs3D.ShadowQuality.None,
compare(top.common.shadowQuality, Graphs3D.ShadowQuality.None,
"shadowQuality") // Ortho disables shadows
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// compare(common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
compare(common.theme.theme, GraphsTheme.Theme.QtGreenNeon, "theme")
// compare(top.common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
compare(top.common.theme.theme, GraphsTheme.Theme.QtGreenNeon, "theme")
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// compare(common.renderingMode, Graphs3D.RenderingMode.DirectToBackground, "renderingMode")
compare(common.measureFps, true, "measureFps")
compare(common.orthoProjection, true, "orthoProjection")
compare(common.aspectRatio, 1.0, "aspectRatio")
compare(common.optimizationHint, Graphs3D.OptimizationHint.Default,
// compare(top.common.renderingMode, Graphs3D.RenderingMode.DirectToBackground, "renderingMode")
compare(top.common.measureFps, true, "measureFps")
compare(top.common.orthoProjection, true, "orthoProjection")
compare(top.common.aspectRatio, 1.0, "aspectRatio")
compare(top.common.optimizationHint, Graphs3D.OptimizationHint.Default,
"optimizationHint")
compare(common.polar, true, "polar")
compare(common.radialLabelOffset, 2, "radialLabelOffset")
compare(common.horizontalAspectRatio, 1, "horizontalAspectRatio")
compare(common.locale, Qt.locale("FI"), "locale")
compare(common.margin, 1.0, "margin")
compare(common.labelMargin, 1.0, "labelMargin")
compare(common.lightColor, "#ff0000", "lightColor")
compare(common.ambientLightStrength, 0.5, "ambientLightStrength")
compare(common.lightStrength, 10.0, "lightStrength")
compare(common.shadowStrength, 50.0, "shadowStrength")
compare(common.minCameraXRotation, 0.0, "minCameraXRotation")
compare(common.maxCameraXRotation, 90.0, "maxCameraXRotation")
compare(common.minCameraYRotation, -90.0, "minCameraYRotation")
compare(common.maxCameraYRotation, 0.0, "maxCameraYRotation")
compare(common.cameraTargetPosition, Qt.vector3d(1.0, 0.0, -1.0),
compare(top.common.polar, true, "polar")
compare(top.common.radialLabelOffset, 2, "radialLabelOffset")
compare(top.common.horizontalAspectRatio, 1, "horizontalAspectRatio")
compare(top.common.locale, Qt.locale("FI"), "locale")
compare(top.common.margin, 1.0, "margin")
compare(top.common.labelMargin, 1.0, "labelMargin")
compare(top.common.lightColor, "#ff0000", "lightColor")
compare(top.common.ambientLightStrength, 0.5, "ambientLightStrength")
compare(top.common.lightStrength, 10.0, "lightStrength")
compare(top.common.shadowStrength, 50.0, "shadowStrength")
compare(top.common.minCameraXRotation, 0.0, "minCameraXRotation")
compare(top.common.maxCameraXRotation, 90.0, "maxCameraXRotation")
compare(top.common.minCameraYRotation, -90.0, "minCameraYRotation")
compare(top.common.maxCameraYRotation, 0.0, "maxCameraYRotation")
compare(top.common.cameraTargetPosition, Qt.vector3d(1.0, 0.0, -1.0),
"cameraTargetPosition")
}
function test_3_change_invalid_common() {
common.selectionMode = Graphs3D.SelectionFlag.Row
top.common.selectionMode = Graphs3D.SelectionFlag.Row
| Graphs3D.SelectionFlag.Column | Graphs3D.SelectionFlag.Slice
common.theme.theme = -2
common.renderingMode = -1
common.measureFps = false
common.orthoProjection = false
common.aspectRatio = -1.0
common.polar = false
common.horizontalAspectRatio = -2
compare(common.selectionMode,
top.common.theme.theme = -2
top.common.renderingMode = -1
top.common.measureFps = false
top.common.orthoProjection = false
top.common.aspectRatio = -1.0
top.common.polar = false
top.common.horizontalAspectRatio = -2
compare(top.common.selectionMode,
Graphs3D.SelectionFlag.Item | Graphs3D.SelectionFlag.Row
| Graphs3D.SelectionFlag.Slice, "selectionMode")
compare(common.theme.theme, -2 /*GraphsTheme.GreySeries*/
compare(top.common.theme.theme, -2 /*GraphsTheme.GreySeries*/
, "theme") // TODO: Fix once QTRD-3367 is done
compare(common.renderingMode,
compare(top.common.renderingMode,
-1 /*Graphs3D.RenderingMode.DirectToBackground*/
, "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(top.common.aspectRatio, 1.0, "aspectRatio")
compare(top.common.horizontalAspectRatio, 1, "horizontalAspectRatio")
common.destroy()
top.common.destroy()
constructCommon()
top.constructCommon()
common.ambientLightStrength = -1.0
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
common.ambientLightStrength = -1.1
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
common.lightStrength = 11.0
compare(common.lightStrength, 5.0, "lightStrength")
common.lightStrength = -1.0
compare(common.lightStrength, 5.0, "lightStrength")
common.shadowStrength = 101.0
compare(common.shadowStrength, 25.0, "shadowStrength")
common.shadowStrength = -1.0
compare(common.shadowStrength, 25.0, "shadowStrength")
top.common.ambientLightStrength = -1.0
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
top.common.ambientLightStrength = -1.1
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
top.common.lightStrength = 11.0
compare(top.common.lightStrength, 5.0, "lightStrength")
top.common.lightStrength = -1.0
compare(top.common.lightStrength, 5.0, "lightStrength")
top.common.shadowStrength = 101.0
compare(top.common.shadowStrength, 25.0, "shadowStrength")
top.common.shadowStrength = -1.0
compare(top.common.shadowStrength, 25.0, "shadowStrength")
common.cameraTargetPosition = Qt.vector3d(2.0, 1.0, -2.0)
compare(common.cameraTargetPosition, Qt.vector3d(1.0, 1.0, -1.0),
top.common.cameraTargetPosition = Qt.vector3d(2.0, 1.0, -2.0)
compare(top.common.cameraTargetPosition, Qt.vector3d(1.0, 1.0, -1.0),
"cameraTargetPosition")
common.destroy()
top.common.destroy()
}
function test_4_common_initialized() {
constructCommonInit()
top.constructCommonInit()
compare(common_init.selectionMode, Graphs3D.SelectionFlag.None,
compare(top.common_init.selectionMode, Graphs3D.SelectionFlag.None,
"selectionMode")
tryCompare(common_init, "shadowQuality", Graphs3D.ShadowQuality.Low)
compare(common_init.msaaSamples, 2, "msaaSamples")
compare(common_init.theme.theme,
tryCompare(top.common_init, "shadowQuality", Graphs3D.ShadowQuality.Low)
compare(top.common_init.msaaSamples, 2, "msaaSamples")
compare(top.common_init.theme.theme,
GraphsTheme.Theme.QtGreen, "theme")
compare(common_init.renderingMode, Graphs3D.RenderingMode.Indirect,
compare(top.common_init.renderingMode, Graphs3D.RenderingMode.Indirect,
"renderingMode")
compare(common_init.measureFps, true, "measureFps")
compare(common_init.customItemList.length, 0, "customItemList")
compare(common_init.orthoProjection, false, "orthoProjection")
compare(common_init.aspectRatio, 3.0, "aspectRatio")
compare(common_init.optimizationHint,
compare(top.common_init.measureFps, true, "measureFps")
compare(top.common_init.customItemList.length, 0, "customItemList")
compare(top.common_init.orthoProjection, false, "orthoProjection")
compare(top.common_init.aspectRatio, 3.0, "aspectRatio")
compare(top.common_init.optimizationHint,
Graphs3D.OptimizationHint.Default, "optimizationHint")
compare(common_init.polar, false, "polar")
compare(common_init.radialLabelOffset, 2, "radialLabelOffset")
compare(common_init.horizontalAspectRatio, 0.2,
compare(top.common_init.polar, false, "polar")
compare(top.common_init.radialLabelOffset, 2, "radialLabelOffset")
compare(top.common_init.horizontalAspectRatio, 0.2,
"horizontalAspectRatio")
compare(common_init.locale, Qt.locale("UK"), "locale")
compare(common_init.margin, 0.2, "margin")
compare(common_init.labelMargin, 0.2, "labelMargin")
compare(common_init.lightColor, "#000000", "lightColor")
compare(common_init.ambientLightStrength, 0.5,
compare(top.common_init.locale, Qt.locale("UK"), "locale")
compare(top.common_init.margin, 0.2, "margin")
compare(top.common_init.labelMargin, 0.2, "labelMargin")
compare(top.common_init.lightColor, "#000000", "lightColor")
compare(top.common_init.ambientLightStrength, 0.5,
"ambientLightStrength")
compare(common_init.lightStrength, 10.0, "lightStrength")
compare(common_init.shadowStrength, 50.0, "shadowStrength")
compare(common_init.minCameraXRotation, 0.0, "minCameraXRotation")
compare(common_init.maxCameraXRotation, 90.0, "maxCameraXRotation")
compare(common_init.minCameraYRotation, -90.0, "minCameraYRotation")
compare(common_init.maxCameraYRotation, 0.0, "maxCameraYRotation")
compare(top.common_init.lightStrength, 10.0, "lightStrength")
compare(top.common_init.shadowStrength, 50.0, "shadowStrength")
compare(top.common_init.minCameraXRotation, 0.0, "minCameraXRotation")
compare(top.common_init.maxCameraXRotation, 90.0, "maxCameraXRotation")
compare(top.common_init.minCameraYRotation, -90.0, "minCameraYRotation")
compare(top.common_init.maxCameraYRotation, 0.0, "maxCameraYRotation")
common_init.destroy()
top.common_init.destroy()
}
}
}

View File

@ -16,59 +16,59 @@ Item {
property var common_init: null
function constructEmpty() {
empty = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Scatter3D {
}", top)
empty = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Scatter3D {
}`, top)
}
function constructBasic() {
basic = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Scatter3D {
anchors.fill: parent
}", top)
basic = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Scatter3D {
anchors.fill: parent
}`, top)
basic.anchors.fill = top
}
function constructCommon() {
common = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Scatter3D {
anchors.fill: parent
}", top)
common = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Scatter3D {
anchors.fill: parent
}`, top)
common.anchors.fill = top
}
function constructCommonInit() {
common_init = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Scatter3D {
anchors.fill: parent
selectionMode: Graphs3D.SelectionFlag.None
shadowQuality: Graphs3D.ShadowQuality.Low
msaaSamples: 2
theme: GraphsTheme { }
renderingMode: Graphs3D.RenderingMode.Indirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHint: Graphs3D.OptimizationHint.Default
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
locale: Qt.locale(\"UK\")
margin: 0.2
labelMargin: 0.2
lightColor: \"black\"
ambientLightStrength: 0.5
lightStrength: 10.0
shadowStrength: 50.0
}", top)
common_init = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Scatter3D {
anchors.fill: parent
selectionMode: Graphs3D.SelectionFlag.None
shadowQuality: Graphs3D.ShadowQuality.Low
msaaSamples: 2
theme: GraphsTheme { }
renderingMode: Graphs3D.RenderingMode.Indirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHint: Graphs3D.OptimizationHint.Default
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
locale: Qt.locale("UK")
margin: 0.2
labelMargin: 0.2
lightColor: "black"
ambientLightStrength: 0.5
lightStrength: 10.0
shadowStrength: 50.0
}`, top)
common_init.anchors.fill = top
}
@ -77,19 +77,19 @@ shadowStrength: 50.0
when: windowShown
function test_empty() {
constructEmpty()
compare(empty.width, 0, "width")
compare(empty.height, 0, "height")
compare(empty.seriesList.length, 0, "seriesList")
compare(empty.selectedSeries, null, "selectedSeries")
compare(empty.axisX.orientation, Abstract3DAxis.AxisOrientation.X)
compare(empty.axisZ.orientation, Abstract3DAxis.AxisOrientation.Z)
compare(empty.axisY.orientation, Abstract3DAxis.AxisOrientation.Y)
compare(empty.axisX.type, Abstract3DAxis.AxisType.Value)
compare(empty.axisZ.type, Abstract3DAxis.AxisType.Value)
compare(empty.axisY.type, Abstract3DAxis.AxisType.Value)
top.constructEmpty()
compare(top.empty.width, 0, "width")
compare(top.empty.height, 0, "height")
compare(top.empty.seriesList.length, 0, "seriesList")
compare(top.empty.selectedSeries, null, "selectedSeries")
compare(top.empty.axisX.orientation, Abstract3DAxis.AxisOrientation.X)
compare(top.empty.axisZ.orientation, Abstract3DAxis.AxisOrientation.Z)
compare(top.empty.axisY.orientation, Abstract3DAxis.AxisOrientation.Y)
compare(top.empty.axisX.type, Abstract3DAxis.AxisType.Value)
compare(top.empty.axisZ.type, Abstract3DAxis.AxisType.Value)
compare(top.empty.axisY.type, Abstract3DAxis.AxisType.Value)
waitForRendering(top)
empty.destroy()
top.empty.destroy()
waitForRendering(top)
}
}
@ -99,11 +99,11 @@ shadowStrength: 50.0
when: windowShown
function test_basic() {
constructBasic()
compare(basic.width, 150, "width")
compare(basic.height, 150, "height")
top.constructBasic()
compare(top.basic.width, 150, "width")
compare(top.basic.height, 150, "height")
waitForRendering(top)
basic.destroy()
top.basic.destroy()
waitForRendering(top)
}
}
@ -113,175 +113,172 @@ shadowStrength: 50.0
when: windowShown
function test_1_common() {
constructCommon()
compare(common.selectionMode,
top.constructCommon()
compare(top.common.selectionMode,
Graphs3D.SelectionFlag.Item, "selectionMode")
compare(common.shadowQuality,
compare(top.common.shadowQuality,
Graphs3D.ShadowQuality.Medium,
"shadowQuality")
compare(common.msaaSamples, 4, "msaaSamples")
compare(common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
compare(common.renderingMode,
compare(top.common.msaaSamples, 4, "msaaSamples")
compare(top.common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
compare(top.common.renderingMode,
Graphs3D.RenderingMode.Indirect,
"renderingMode")
compare(common.measureFps, false, "measureFps")
compare(common.customItemList.length, 0, "customItemList")
compare(common.orthoProjection, false, "orthoProjection")
compare(common.selectedElement,
compare(top.common.measureFps, false, "measureFps")
compare(top.common.customItemList.length, 0, "customItemList")
compare(top.common.orthoProjection, false, "orthoProjection")
compare(top.common.selectedElement,
Graphs3D.ElementType.None, "selectedElement")
compare(common.aspectRatio, 2.0, "aspectRatio")
compare(common.optimizationHint,
compare(top.common.aspectRatio, 2.0, "aspectRatio")
compare(top.common.optimizationHint,
Graphs3D.OptimizationHint.Default,
"optimizationHint")
compare(common.polar, false, "polar")
compare(common.radialLabelOffset, 1, "radialLabelOffset")
compare(common.horizontalAspectRatio, 0, "horizontalAspectRatio")
compare(common.locale, Qt.locale("C"), "locale")
compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0),
compare(top.common.polar, false, "polar")
compare(top.common.radialLabelOffset, 1, "radialLabelOffset")
compare(top.common.horizontalAspectRatio, 0, "horizontalAspectRatio")
compare(top.common.locale, Qt.locale("C"), "locale")
compare(top.common.queriedGraphPosition, Qt.vector3d(0, 0, 0),
"queriedGraphPosition")
compare(common.margin, -1, "margin")
compare(common.labelMargin, 0.1, "labelMargin")
compare(common.lightColor, "#ffffff", "lightColor")
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
compare(common.lightStrength, 5.0, "lightStrength")
compare(common.shadowStrength, 25.0, "shadowStrength")
compare(top.common.margin, -1, "margin")
compare(top.common.labelMargin, 0.1, "labelMargin")
compare(top.common.lightColor, "#ffffff", "lightColor")
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
compare(top.common.lightStrength, 5.0, "lightStrength")
compare(top.common.shadowStrength, 25.0, "shadowStrength")
}
function test_2_change_common() {
common.selectionMode = Graphs3D.SelectionFlag.None
common.shadowQuality = Graphs3D.ShadowQuality.SoftHigh
compare(common.shadowQuality,
top.common.selectionMode = Graphs3D.SelectionFlag.None
top.common.shadowQuality = Graphs3D.ShadowQuality.SoftHigh
compare(top.common.shadowQuality,
Graphs3D.ShadowQuality.SoftHigh,
"shadowQuality")
common.msaaSamples = 8
compare(common.msaaSamples, 8, "msaaSamples")
common.theme.theme = GraphsTheme.Theme.QtGreen
top.common.msaaSamples = 8
compare(top.common.msaaSamples, 8, "msaaSamples")
top.common.theme.theme = GraphsTheme.Theme.QtGreen
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// common.renderingMode = Graphs3D.RenderingMode.DirectToBackground
common.measureFps = true
common.orthoProjection = true
common.aspectRatio = 1.0
common.optimizationHint = Graphs3D.OptimizationHint.Default
common.polar = true
common.radialLabelOffset = 2
common.horizontalAspectRatio = 1
common.locale = Qt.locale("FI")
common.margin = 1.0
common.labelMargin = 1.0
common.lightColor = "#ff0000"
common.ambientLightStrength = 0.5
common.lightStrength = 10.0
common.shadowStrength = 50.0
compare(common.selectionMode,
// top.common.renderingMode = Graphs3D.RenderingMode.DirectToBackground
top.common.measureFps = true
top.common.orthoProjection = true
top.common.aspectRatio = 1.0
top.common.optimizationHint = Graphs3D.OptimizationHint.Default
top.common.polar = true
top.common.radialLabelOffset = 2
top.common.horizontalAspectRatio = 1
top.common.locale = Qt.locale("FI")
top.common.margin = 1.0
top.common.labelMargin = 1.0
top.common.lightColor = "#ff0000"
top.common.ambientLightStrength = 0.5
top.common.lightStrength = 10.0
top.common.shadowStrength = 50.0
compare(top.common.selectionMode,
Graphs3D.SelectionFlag.None, "selectionMode")
compare(common.shadowQuality,
compare(top.common.shadowQuality,
Graphs3D.ShadowQuality.None,
"shadowQuality") // Ortho disables shadows
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// compare(common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
compare(common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
// compare(top.common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
compare(top.common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// compare(common.renderingMode, Graphs3D.RenderingMode.DirectToBackground, "renderingMode")
compare(common.measureFps, true, "measureFps")
compare(common.orthoProjection, true, "orthoProjection")
compare(common.aspectRatio, 1.0, "aspectRatio")
compare(common.optimizationHint,
// compare(top.common.renderingMode, Graphs3D.RenderingMode.DirectToBackground, "renderingMode")
compare(top.common.measureFps, true, "measureFps")
compare(top.common.orthoProjection, true, "orthoProjection")
compare(top.common.aspectRatio, 1.0, "aspectRatio")
compare(top.common.optimizationHint,
Graphs3D.OptimizationHint.Default,
"optimizationHint")
compare(common.polar, true, "polar")
compare(common.radialLabelOffset, 2, "radialLabelOffset")
compare(common.horizontalAspectRatio, 1, "horizontalAspectRatio")
compare(common.locale, Qt.locale("FI"), "locale")
compare(common.margin, 1.0, "margin")
compare(common.labelMargin, 1.0, "labelMargin")
compare(common.lightColor, "#ff0000", "lightColor")
compare(common.ambientLightStrength, 0.5, "ambientLightStrength")
compare(common.lightStrength, 10.0, "lightStrength")
compare(common.shadowStrength, 50.0, "shadowStrength")
compare(top.common.polar, true, "polar")
compare(top.common.radialLabelOffset, 2, "radialLabelOffset")
compare(top.common.horizontalAspectRatio, 1, "horizontalAspectRatio")
compare(top.common.locale, Qt.locale("FI"), "locale")
compare(top.common.margin, 1.0, "margin")
compare(top.common.labelMargin, 1.0, "labelMargin")
compare(top.common.lightColor, "#ff0000", "lightColor")
compare(top.common.ambientLightStrength, 0.5, "ambientLightStrength")
compare(top.common.lightStrength, 10.0, "lightStrength")
compare(top.common.shadowStrength, 50.0, "shadowStrength")
}
function test_3_change_invalid_common() {
common.selectionMode = Graphs3D.SelectionFlag.Row
top.common.selectionMode = Graphs3D.SelectionFlag.Row
| Graphs3D.SelectionFlag.Column
| Graphs3D.SelectionFlag.Slice
common.theme.type = -2
common.renderingMode = -1
common.measureFps = false
common.orthoProjection = false
common.aspectRatio = -1.0
common.polar = false
common.horizontalAspectRatio = -2
compare(common.selectionMode,
top.common.theme.type = -2
top.common.renderingMode = -1
top.common.measureFps = false
top.common.orthoProjection = false
top.common.aspectRatio = -1.0
top.common.polar = false
top.common.horizontalAspectRatio = -2
compare(top.common.selectionMode,
Graphs3D.SelectionFlag.None, "selectionMode")
compare(common.theme.type, -2 /*Theme3D.Theme.Retro*/
compare(top.common.theme.type, -2 /*Theme3D.Theme.Retro*/
, "theme") // TODO: Fix once QTRD-3367 is done
compare(common.renderingMode,
compare(top.common.renderingMode,
-1 /*Graphs3D.RenderingMode.DirectToBackground*/
, "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(top.common.aspectRatio, 1.0, "aspectRatio")
compare(top.common.horizontalAspectRatio, 1, "horizontalAspectRatio")
common.destroy()
top.common.destroy()
constructCommon()
top.constructCommon()
common.ambientLightStrength = -1.0
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
common.ambientLightStrength = -1.1
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
common.lightStrength = 11.0
compare(common.lightStrength, 5.0, "lightStrength")
common.lightStrength = -1.0
compare(common.lightStrength, 5.0, "lightStrength")
common.shadowStrength = 101.0
compare(common.shadowStrength, 25.0, "shadowStrength")
common.shadowStrength = -1.0
compare(common.shadowStrength, 25.0, "shadowStrength")
top.common.ambientLightStrength = -1.0
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
top.common.ambientLightStrength = -1.1
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
top.common.lightStrength = 11.0
compare(top.common.lightStrength, 5.0, "lightStrength")
top.common.lightStrength = -1.0
compare(top.common.lightStrength, 5.0, "lightStrength")
top.common.shadowStrength = 101.0
compare(top.common.shadowStrength, 25.0, "shadowStrength")
top.common.shadowStrength = -1.0
compare(top.common.shadowStrength, 25.0, "shadowStrength")
common.cameraTargetPosition = Qt.vector3d(2.0, 2.0, -2.0)
compare(common.cameraTargetPosition, Qt.vector3d(1.0, 1.0, -1.0),
top.common.cameraTargetPosition = Qt.vector3d(2.0, 2.0, -2.0)
compare(top.common.cameraTargetPosition, Qt.vector3d(1.0, 1.0, -1.0),
"cameraTargetPosition")
common.destroy()
top.common.destroy()
}
function test_4_common_initialized() {
constructCommonInit()
top.constructCommonInit()
compare(common_init.selectionMode,
compare(top.common_init.selectionMode,
Graphs3D.SelectionFlag.None, "selectionMode")
tryCompare(common_init, "shadowQuality",
tryCompare(top.common_init, "shadowQuality",
Graphs3D.ShadowQuality.Low)
compare(common_init.msaaSamples, 2, "msaaSamples")
compare(common_init.theme.theme,
compare(top.common_init.msaaSamples, 2, "msaaSamples")
compare(top.common_init.theme.theme,
GraphsTheme.Theme.QtGreen, "theme")
compare(common_init.renderingMode,
compare(top.common_init.renderingMode,
Graphs3D.RenderingMode.Indirect,
"renderingMode")
compare(common_init.measureFps, true, "measureFps")
compare(common_init.customItemList.length, 0, "customItemList")
compare(common_init.orthoProjection, false, "orthoProjection")
compare(common_init.aspectRatio, 3.0, "aspectRatio")
compare(common_init.optimizationHint,
compare(top.common_init.measureFps, true, "measureFps")
compare(top.common_init.customItemList.length, 0, "customItemList")
compare(top.common_init.orthoProjection, false, "orthoProjection")
compare(top.common_init.aspectRatio, 3.0, "aspectRatio")
compare(top.common_init.optimizationHint,
Graphs3D.OptimizationHint.Default,
"optimizationHint")
compare(common_init.polar, false, "polar")
compare(common_init.radialLabelOffset, 2, "radialLabelOffset")
compare(common_init.horizontalAspectRatio, 0.2,
compare(top.common_init.polar, false, "polar")
compare(top.common_init.radialLabelOffset, 2, "radialLabelOffset")
compare(top.common_init.horizontalAspectRatio, 0.2,
"horizontalAspectRatio")
compare(common_init.locale, Qt.locale("UK"), "locale")
compare(common_init.margin, 0.2, "margin")
compare(common_init.labelMargin, 0.2, "labelMargin")
compare(common_init.lightColor, "#000000", "lightColor")
compare(common_init.ambientLightStrength, 0.5,
compare(top.common_init.locale, Qt.locale("UK"), "locale")
compare(top.common_init.margin, 0.2, "margin")
compare(top.common_init.labelMargin, 0.2, "labelMargin")
compare(top.common_init.lightColor, "#000000", "lightColor")
compare(top.common_init.ambientLightStrength, 0.5,
"ambientLightStrength")
compare(common_init.lightStrength, 10.0, "lightStrength")
compare(common_init.shadowStrength, 50.0, "shadowStrength")
compare(top.common_init.lightStrength, 10.0, "lightStrength")
compare(top.common_init.shadowStrength, 50.0, "shadowStrength")
common_init.destroy()
top.common_init.destroy()
}
}
}

View File

@ -15,61 +15,61 @@ Item {
property var common_init: null
function constructEmpty() {
empty = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Surface3D {
}", top)
empty = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Surface3D {
}`, top)
}
function constructBasic() {
basic = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Surface3D {
anchors.fill: parent
flipHorizontalGrid: true
}", top)
basic.anchors.fill = top
basic = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Surface3D {
anchors.fill: parent
flipHorizontalGrid: true
}`, top)
top.basic.anchors.fill = top
}
function constructCommon() {
common = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Surface3D {
anchors.fill: parent
}", top)
common = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Surface3D {
anchors.fill: parent
}`, top)
common.anchors.fill = top
}
function constructCommonInit() {
common_init = Qt.createQmlObject("
import QtQuick 2.2
import QtGraphs
Surface3D {
anchors.fill: parent
selectionMode: Graphs3D.SelectionFlag.None
shadowQuality: Graphs3D.ShadowQuality.Low
msaaSamples: 2
theme: GraphsTheme { }
renderingMode: Graphs3D.RenderingMode.Indirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHint: Graphs3D.OptimizationHint.Default
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
locale: Qt.locale(\"UK\")
margin: 0.2
labelMargin: 0.2
lightColor: \"black\"
ambientLightStrength: 0.5
lightStrength: 10.0
shadowStrength: 50.0
}", top)
common_init.anchors.fill = top
common_init = Qt.createQmlObject(`
import QtQuick 2.2
import QtGraphs
Surface3D {
anchors.fill: parent
selectionMode: Graphs3D.SelectionFlag.None
shadowQuality: Graphs3D.ShadowQuality.Low
msaaSamples: 2
theme: GraphsTheme { }
renderingMode: Graphs3D.RenderingMode.Indirect
measureFps: true
orthoProjection: false
aspectRatio: 3.0
optimizationHint: Graphs3D.OptimizationHint.Default
polar: false
radialLabelOffset: 2
horizontalAspectRatio: 0.2
locale: Qt.locale("UK")
margin: 0.2
labelMargin: 0.2
lightColor: "black"
ambientLightStrength: 0.5
lightStrength: 10.0
shadowStrength: 50.0
}`, top)
top.common_init.anchors.fill = top
}
TestCase {
@ -77,20 +77,20 @@ shadowStrength: 50.0
when: windowShown
function test_empty() {
constructEmpty()
compare(empty.width, 0, "width")
compare(empty.height, 0, "height")
compare(empty.seriesList.length, 0, "seriesList")
compare(empty.selectedSeries, null, "selectedSeries")
compare(empty.flipHorizontalGrid, false, "flipHorizontalGrid")
compare(empty.axisX.orientation, Abstract3DAxis.AxisOrientation.X)
compare(empty.axisZ.orientation, Abstract3DAxis.AxisOrientation.Z)
compare(empty.axisY.orientation, Abstract3DAxis.AxisOrientation.Y)
compare(empty.axisX.type, Abstract3DAxis.AxisType.Value)
compare(empty.axisZ.type, Abstract3DAxis.AxisType.Value)
compare(empty.axisY.type, Abstract3DAxis.AxisType.Value)
top.constructEmpty()
compare(top.empty.width, 0, "width")
compare(top.empty.height, 0, "height")
compare(top.empty.seriesList.length, 0, "seriesList")
compare(top.empty.selectedSeries, null, "selectedSeries")
compare(top.empty.flipHorizontalGrid, false, "flipHorizontalGrid")
compare(top.empty.axisX.orientation, Abstract3DAxis.AxisOrientation.X)
compare(top.empty.axisZ.orientation, Abstract3DAxis.AxisOrientation.Z)
compare(top.empty.axisY.orientation, Abstract3DAxis.AxisOrientation.Y)
compare(top.empty.axisX.type, Abstract3DAxis.AxisType.Value)
compare(top.empty.axisZ.type, Abstract3DAxis.AxisType.Value)
compare(top.empty.axisY.type, Abstract3DAxis.AxisType.Value)
waitForRendering(top)
empty.destroy()
top.empty.destroy()
waitForRendering(top)
}
}
@ -100,17 +100,17 @@ shadowStrength: 50.0
when: windowShown
function test_1_basic() {
constructBasic()
compare(basic.width, 150, "width")
compare(basic.height, 150, "height")
compare(basic.flipHorizontalGrid, true, "flipHorizontalGrid")
top.constructBasic()
compare(top.basic.width, 150, "width")
compare(top.basic.height, 150, "height")
compare(top.basic.flipHorizontalGrid, true, "flipHorizontalGrid")
}
function test_2_change_basic() {
basic.flipHorizontalGrid = false
compare(basic.flipHorizontalGrid, false, "flipHorizontalGrid")
top.basic.flipHorizontalGrid = false
compare(top.basic.flipHorizontalGrid, false, "flipHorizontalGrid")
waitForRendering(top)
basic.destroy()
top.basic.destroy()
waitForRendering(top)
}
}
@ -120,168 +120,165 @@ shadowStrength: 50.0
when: windowShown
function test_1_common() {
constructCommon()
compare(common.selectionMode, Graphs3D.SelectionFlag.Item,
top.constructCommon()
compare(top.common.selectionMode, Graphs3D.SelectionFlag.Item,
"selectionMode")
compare(common.shadowQuality, Graphs3D.ShadowQuality.Medium,
compare(top.common.shadowQuality, Graphs3D.ShadowQuality.Medium,
"shadowQuality")
compare(common.msaaSamples, 4, "msaaSamples")
compare(common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
compare(common.renderingMode, Graphs3D.RenderingMode.Indirect,
compare(top.common.msaaSamples, 4, "msaaSamples")
compare(top.common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
compare(top.common.renderingMode, Graphs3D.RenderingMode.Indirect,
"renderingMode")
compare(common.measureFps, false, "measureFps")
compare(common.customItemList.length, 0, "customItemList")
compare(common.orthoProjection, false, "orthoProjection")
compare(common.selectedElement, Graphs3D.ElementType.None,
compare(top.common.measureFps, false, "measureFps")
compare(top.common.customItemList.length, 0, "customItemList")
compare(top.common.orthoProjection, false, "orthoProjection")
compare(top.common.selectedElement, Graphs3D.ElementType.None,
"selectedElement")
compare(common.aspectRatio, 2.0, "aspectRatio")
compare(common.optimizationHint, Graphs3D.OptimizationHint.Default,
compare(top.common.aspectRatio, 2.0, "aspectRatio")
compare(top.common.optimizationHint, Graphs3D.OptimizationHint.Default,
"optimizationHint")
compare(common.polar, false, "polar")
compare(common.radialLabelOffset, 1, "radialLabelOffset")
compare(common.horizontalAspectRatio, 0, "horizontalAspectRatio")
compare(common.locale, Qt.locale("C"), "locale")
compare(common.queriedGraphPosition, Qt.vector3d(0, 0, 0),
compare(top.common.polar, false, "polar")
compare(top.common.radialLabelOffset, 1, "radialLabelOffset")
compare(top.common.horizontalAspectRatio, 0, "horizontalAspectRatio")
compare(top.common.locale, Qt.locale("C"), "locale")
compare(top.common.queriedGraphPosition, Qt.vector3d(0, 0, 0),
"queriedGraphPosition")
compare(common.margin, -1, "margin")
compare(common.labelMargin, 0.1, "labelMargin")
compare(common.lightColor, "#ffffff", "lightColor")
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
compare(common.lightStrength, 5.0, "lightStrength")
compare(common.shadowStrength, 25.0, "shadowStrength")
compare(top.common.margin, -1, "margin")
compare(top.common.labelMargin, 0.1, "labelMargin")
compare(top.common.lightColor, "#ffffff", "lightColor")
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
compare(top.common.lightStrength, 5.0, "lightStrength")
compare(top.common.shadowStrength, 25.0, "shadowStrength")
common.destroy()
top.common.destroy()
}
function test_2_change_common() {
constructCommon()
common.selectionMode = Graphs3D.SelectionFlag.Item
top.constructCommon()
top.common.selectionMode = Graphs3D.SelectionFlag.Item
| Graphs3D.SelectionFlag.Row | Graphs3D.SelectionFlag.Slice
common.shadowQuality = Graphs3D.ShadowQuality.SoftHigh
compare(common.shadowQuality, Graphs3D.ShadowQuality.SoftHigh,
top.common.shadowQuality = Graphs3D.ShadowQuality.SoftHigh
compare(top.common.shadowQuality, Graphs3D.ShadowQuality.SoftHigh,
"shadowQuality")
common.msaaSamples = 8
compare(common.msaaSamples, 8, "msaaSamples")
common.theme.theme = GraphsTheme.Theme.QtGreen
top.common.msaaSamples = 8
compare(top.common.msaaSamples, 8, "msaaSamples")
top.common.theme.theme = GraphsTheme.Theme.QtGreen
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// common.renderingMode = Graphs3D.RenderingMode.DirectToBackground
common.measureFps = true
common.orthoProjection = true
common.aspectRatio = 1.0
common.optimizationHint = Graphs3D.OptimizationHint.Default
common.polar = true
common.radialLabelOffset = 2
common.horizontalAspectRatio = 1
common.locale = Qt.locale("FI")
common.margin = 1.0
common.labelMargin = 1.0
common.lightColor = "#ff0000"
common.ambientLightStrength = 0.5
common.lightStrength = 10.0
common.shadowStrength = 50.0
compare(common.selectionMode,
// top.common.renderingMode = Graphs3D.RenderingMode.DirectToBackground
top.common.measureFps = true
top.common.orthoProjection = true
top.common.aspectRatio = 1.0
top.common.optimizationHint = Graphs3D.OptimizationHint.Default
top.common.polar = true
top.common.radialLabelOffset = 2
top.common.horizontalAspectRatio = 1
top.common.locale = Qt.locale("FI")
top.common.margin = 1.0
top.common.labelMargin = 1.0
top.common.lightColor = "#ff0000"
top.common.ambientLightStrength = 0.5
top.common.lightStrength = 10.0
top.common.shadowStrength = 50.0
compare(top.common.selectionMode,
Graphs3D.SelectionFlag.Item | Graphs3D.SelectionFlag.Row
| Graphs3D.SelectionFlag.Slice, "selectionMode")
compare(common.shadowQuality, Graphs3D.ShadowQuality.None,
compare(top.common.shadowQuality, Graphs3D.ShadowQuality.None,
"shadowQuality") // Ortho disables shadows
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// compare(common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
compare(common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
// compare(top.common.msaaSamples, 0, "msaaSamples") // Rendering mode changes this to zero
compare(top.common.theme.theme, GraphsTheme.Theme.QtGreen, "theme")
// TODO: Seems to be causing crashes in testing - QTBUG-122089
// compare(common.renderingMode, Graphs3D.RenderingMode.DirectToBackground, "renderingMode")
compare(common.measureFps, true, "measureFps")
compare(common.orthoProjection, true, "orthoProjection")
compare(common.aspectRatio, 1.0, "aspectRatio")
compare(common.optimizationHint, Graphs3D.OptimizationHint.Default,
// compare(top.common.renderingMode, Graphs3D.RenderingMode.DirectToBackground, "renderingMode")
compare(top.common.measureFps, true, "measureFps")
compare(top.common.orthoProjection, true, "orthoProjection")
compare(top.common.aspectRatio, 1.0, "aspectRatio")
compare(top.common.optimizationHint, Graphs3D.OptimizationHint.Default,
"optimizationHint")
compare(common.polar, true, "polar")
compare(common.radialLabelOffset, 2, "radialLabelOffset")
compare(common.horizontalAspectRatio, 1, "horizontalAspectRatio")
compare(common.locale, Qt.locale("FI"), "locale")
compare(common.margin, 1.0, "margin")
compare(common.labelMargin, 1.0, "labelMargin")
compare(common.lightColor, "#ff0000", "lightColor")
compare(common.ambientLightStrength, 0.5, "ambientLightStrength")
compare(common.lightStrength, 10.0, "lightStrength")
compare(common.shadowStrength, 50.0, "shadowStrength")
compare(top.common.polar, true, "polar")
compare(top.common.radialLabelOffset, 2, "radialLabelOffset")
compare(top.common.horizontalAspectRatio, 1, "horizontalAspectRatio")
compare(top.common.locale, Qt.locale("FI"), "locale")
compare(top.common.margin, 1.0, "margin")
compare(top.common.labelMargin, 1.0, "labelMargin")
compare(top.common.lightColor, "#ff0000", "lightColor")
compare(top.common.ambientLightStrength, 0.5, "ambientLightStrength")
compare(top.common.lightStrength, 10.0, "lightStrength")
compare(top.common.shadowStrength, 50.0, "shadowStrength")
common.destroy()
top.common.destroy()
}
function test_3_change_invalid_common() {
constructCommon()
common.selectionMode = Graphs3D.SelectionFlag.Row
top.constructCommon()
top.common.selectionMode = Graphs3D.SelectionFlag.Row
| Graphs3D.SelectionFlag.Column | Graphs3D.SelectionFlag.Slice
common.theme.type = -2
common.renderingMode = -1
common.measureFps = false
common.orthoProjection = false
common.aspectRatio = -1.0
common.polar = false
common.horizontalAspectRatio = -2
compare(common.selectionMode, Graphs3D.SelectionFlag.Item,
top.common.theme.type = -2
top.common.renderingMode = -1
top.common.measureFps = false
top.common.orthoProjection = false
top.common.aspectRatio = -1.0
top.common.polar = false
top.common.horizontalAspectRatio = -2
compare(top.common.selectionMode, Graphs3D.SelectionFlag.Item,
"selectionMode")
compare(common.theme.type, -2 /*Theme3D.Theme.Retro*/
compare(top.common.theme.type, -2 /*Theme3D.Theme.Retro*/
, "theme") // TODO: Fix once QTRD-3367 is done
compare(common.renderingMode,
compare(top.common.renderingMode,
-1 /*Graphs3D.RenderingMode.DirectToBackground*/
, "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(top.common.aspectRatio, 2.0, "aspectRatio")
compare(top.common.horizontalAspectRatio, 0, "horizontalAspectRatio")
common.ambientLightStrength = -1.0
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
common.ambientLightStrength = -1.1
compare(common.ambientLightStrength, 0.25, "ambientLightStrength")
common.lightStrength = 11.0
compare(common.lightStrength, 5.0, "lightStrength")
common.lightStrength = -1.0
compare(common.lightStrength, 5.0, "lightStrength")
common.shadowStrength = 101.0
compare(common.shadowStrength, 25.0, "shadowStrength")
common.shadowStrength = -1.0
compare(common.shadowStrength, 25.0, "shadowStrength")
common.cameraTargetPosition = Qt.vector3d(2.0, 2.0, -2.0)
compare(common.cameraTargetPosition, Qt.vector3d(1.0, 1.0, -1.0),
top.common.ambientLightStrength = -1.0
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
top.common.ambientLightStrength = -1.1
compare(top.common.ambientLightStrength, 0.25, "ambientLightStrength")
top.common.lightStrength = 11.0
compare(top.common.lightStrength, 5.0, "lightStrength")
top.common.lightStrength = -1.0
compare(top.common.lightStrength, 5.0, "lightStrength")
top.common.shadowStrength = 101.0
compare(top.common.shadowStrength, 25.0, "shadowStrength")
top.common.shadowStrength = -1.0
compare(top.common.shadowStrength, 25.0, "shadowStrength")
top.common.cameraTargetPosition = Qt.vector3d(2.0, 2.0, -2.0)
compare(top.common.cameraTargetPosition, Qt.vector3d(1.0, 1.0, -1.0),
"cameraTargetPosition")
common.destroy()
top.common.destroy()
}
function test_4_common_initialized() {
constructCommonInit()
compare(common_init.selectionMode, Graphs3D.SelectionFlag.None,
compare(top.common_init.selectionMode, Graphs3D.SelectionFlag.None,
"selectionMode")
tryCompare(common_init, "shadowQuality", Graphs3D.ShadowQuality.Low)
compare(common_init.msaaSamples, 2, "msaaSamples")
compare(common_init.theme.theme,
compare(top.common_init.msaaSamples, 2, "msaaSamples")
compare(top.common_init.theme.theme,
GraphsTheme.Theme.QtGreen, "theme")
compare(common_init.renderingMode, Graphs3D.RenderingMode.Indirect,
compare(top.common_init.renderingMode, Graphs3D.RenderingMode.Indirect,
"renderingMode")
compare(common_init.measureFps, true, "measureFps")
compare(common_init.customItemList.length, 0, "customItemList")
compare(common_init.orthoProjection, false, "orthoProjection")
compare(common_init.aspectRatio, 3.0, "aspectRatio")
compare(common_init.optimizationHint,
compare(top.common_init.measureFps, true, "measureFps")
compare(top.common_init.customItemList.length, 0, "customItemList")
compare(top.common_init.orthoProjection, false, "orthoProjection")
compare(top.common_init.aspectRatio, 3.0, "aspectRatio")
compare(top.common_init.optimizationHint,
Graphs3D.OptimizationHint.Default, "optimizationHint")
compare(common_init.polar, false, "polar")
compare(common_init.radialLabelOffset, 2, "radialLabelOffset")
compare(common_init.horizontalAspectRatio, 0.2,
compare(top.common_init.polar, false, "polar")
compare(top.common_init.radialLabelOffset, 2, "radialLabelOffset")
compare(top.common_init.horizontalAspectRatio, 0.2,
"horizontalAspectRatio")
compare(common_init.locale, Qt.locale("UK"), "locale")
compare(common_init.margin, 0.2, "margin")
compare(common_init.labelMargin, 0.2, "labelMargin")
compare(common_init.lightColor, "#000000", "lightColor")
compare(common_init.ambientLightStrength, 0.5,
compare(top.common_init.locale, Qt.locale("UK"), "locale")
compare(top.common_init.margin, 0.2, "margin")
compare(top.common_init.labelMargin, 0.2, "labelMargin")
compare(top.common_init.lightColor, "#000000", "lightColor")
compare(top.common_init.ambientLightStrength, 0.5,
"ambientLightStrength")
compare(common_init.lightStrength, 10.0, "lightStrength")
compare(common_init.shadowStrength, 50.0, "shadowStrength")
compare(top.common_init.lightStrength, 10.0, "lightStrength")
compare(top.common_init.shadowStrength, 50.0, "shadowStrength")
common_init.destroy()
top.common_init.destroy()
}
}
}