summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2014-10-17 08:50:12 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2014-10-17 09:06:43 +0300
commitb25f6926ded030959d1931ec0a834b1a9e5f27e3 (patch)
tree8b602b289e3e331c4d9e759dfab125879c318f05 /tests
parent425ece960c378f8486d0c5e544cc7d0b95c9f728 (diff)
Added invalid value tests for QML autotests
Plus fixed a QML documentation bug, and added a missing inheritance to docs. Task-number: QTRD-3383 Change-Id: I1f7c56c49b829fee2cfd0731bbcc7e248a06a0c0 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmltest/axis3d/tst_category.qml19
-rw-r--r--tests/auto/qmltest/axis3d/tst_logvalue.qml15
-rw-r--r--tests/auto/qmltest/axis3d/tst_value.qml24
-rw-r--r--tests/auto/qmltest/custom3d/tst_customvolume.qml19
-rw-r--r--tests/auto/qmltest/scatter3d/tst_scatterseries.qml14
-rw-r--r--tests/auto/qmltest/scene3d/tst_camera.qml16
-rw-r--r--tests/auto/qmltest/scene3d/tst_scene.qml13
-rw-r--r--tests/auto/qmltest/surface3d/tst_heightproxy.qml15
-rw-r--r--tests/auto/qmltest/theme3d/tst_theme.qml24
9 files changed, 159 insertions, 0 deletions
diff --git a/tests/auto/qmltest/axis3d/tst_category.qml b/tests/auto/qmltest/axis3d/tst_category.qml
index 7f0be845..318fa011 100644
--- a/tests/auto/qmltest/axis3d/tst_category.qml
+++ b/tests/auto/qmltest/axis3d/tst_category.qml
@@ -46,6 +46,10 @@ Item {
id: change
}
+ CategoryAxis3D {
+ id: invalid
+ }
+
TestCase {
name: "CategoryAxis3D Initial"
@@ -113,4 +117,19 @@ Item {
compare(change.titleVisible, true)
}
}
+
+ TestCase {
+ name: "CategoryAxis3D Invalid"
+
+ function test_invalid() {
+ invalid.labelAutoRotation = -10
+ compare(invalid.labelAutoRotation, 0.0)
+ invalid.labelAutoRotation = 100
+ compare(invalid.labelAutoRotation, 90.0)
+ invalid.max = -10
+ compare(invalid.min, 0)
+ invalid.min = 10
+ compare(invalid.max, 11)
+ }
+ }
}
diff --git a/tests/auto/qmltest/axis3d/tst_logvalue.qml b/tests/auto/qmltest/axis3d/tst_logvalue.qml
index fad93611..89228ad1 100644
--- a/tests/auto/qmltest/axis3d/tst_logvalue.qml
+++ b/tests/auto/qmltest/axis3d/tst_logvalue.qml
@@ -40,6 +40,10 @@ Item {
id: change
}
+ LogValueAxis3DFormatter {
+ id: invalid
+ }
+
TestCase {
name: "LogValueAxis3DFormatter Initial"
@@ -73,4 +77,15 @@ Item {
compare(change.showEdgeLabels, false)
}
}
+
+ TestCase {
+ name: "LogValueAxis3DFormatter Invalid"
+
+ function test_invalid() {
+ invalid.base = 1
+ compare(invalid.base, 10)
+ invalid.base = -1
+ compare(invalid.base, 10)
+ }
+ }
}
diff --git a/tests/auto/qmltest/axis3d/tst_value.qml b/tests/auto/qmltest/axis3d/tst_value.qml
index 6a8f7849..54189c8b 100644
--- a/tests/auto/qmltest/axis3d/tst_value.qml
+++ b/tests/auto/qmltest/axis3d/tst_value.qml
@@ -50,6 +50,10 @@ Item {
id: change
}
+ ValueAxis3D {
+ id: invalid
+ }
+
TestCase {
name: "ValueAxis3D Initial"
@@ -127,4 +131,24 @@ Item {
compare(change.titleVisible, true)
}
}
+
+ TestCase {
+ name: "ValueAxis3D Invalid"
+
+ function test_invalid() {
+ invalid.segmentCount = -1
+ compare(invalid.segmentCount, 1)
+ invalid.subSegmentCount = -1
+ compare(invalid.subSegmentCount, 1)
+
+ invalid.labelAutoRotation = -10
+ compare(invalid.labelAutoRotation, 0.0)
+ invalid.labelAutoRotation = 100
+ compare(invalid.labelAutoRotation, 90.0)
+ invalid.max = -10
+ compare(invalid.min, -11)
+ invalid.min = 10
+ compare(invalid.max, 11)
+ }
+ }
}
diff --git a/tests/auto/qmltest/custom3d/tst_customvolume.qml b/tests/auto/qmltest/custom3d/tst_customvolume.qml
index 89717d5d..08c15013 100644
--- a/tests/auto/qmltest/custom3d/tst_customvolume.qml
+++ b/tests/auto/qmltest/custom3d/tst_customvolume.qml
@@ -57,6 +57,10 @@ Item {
id: change
}
+ Custom3DVolume {
+ id: invalid
+ }
+
TestCase {
name: "Custom3DVolume Initial"
@@ -160,4 +164,19 @@ Item {
compare(change.visible, false)
}
}
+
+ TestCase {
+ name: "Custom3DVolume Invalid"
+
+ function test_invalid() {
+ invalid.alphaMultiplier = -1.0
+ compare(invalid.alphaMultiplier, 1.0)
+ invalid.sliceFrameGaps = Qt.vector3d(-0.1, -0.1, -0.1)
+ compare(invalid.sliceFrameGaps, Qt.vector3d(0.01, 0.01, 0.01))
+ invalid.sliceFrameThicknesses = Qt.vector3d(-0.1, -0.1, -0.1)
+ compare(invalid.sliceFrameThicknesses, Qt.vector3d(0.01, 0.01, 0.01))
+ invalid.sliceFrameWidths = Qt.vector3d(-0.1, -0.1, -0.1)
+ compare(invalid.sliceFrameWidths, Qt.vector3d(0.01, 0.01, 0.01))
+ }
+ }
}
diff --git a/tests/auto/qmltest/scatter3d/tst_scatterseries.qml b/tests/auto/qmltest/scatter3d/tst_scatterseries.qml
index e42443ad..4df58303 100644
--- a/tests/auto/qmltest/scatter3d/tst_scatterseries.qml
+++ b/tests/auto/qmltest/scatter3d/tst_scatterseries.qml
@@ -100,6 +100,10 @@ Item {
id: change
}
+ Scatter3DSeries {
+ id: invalid
+ }
+
TestCase {
name: "Scatter3DSeries Initial"
@@ -216,4 +220,14 @@ Item {
compare(change.baseGradient.stops[0].color, "#ffff00")
}
}
+ TestCase {
+ name: "Scatter3DSeries Invalid"
+
+ function test_invalid() {
+ invalid.itemSize = -1.0
+ compare(invalid.itemSize, 0.0)
+ invalid.itemSize = 1.1
+ compare(invalid.itemSize, 0.0)
+ }
+ }
}
diff --git a/tests/auto/qmltest/scene3d/tst_camera.qml b/tests/auto/qmltest/scene3d/tst_camera.qml
index c29de0c7..07adf633 100644
--- a/tests/auto/qmltest/scene3d/tst_camera.qml
+++ b/tests/auto/qmltest/scene3d/tst_camera.qml
@@ -45,6 +45,10 @@ Item {
id: change
}
+ Camera3D {
+ id: invalid
+ }
+
TestCase {
name: "Camera3D Initial"
@@ -114,6 +118,18 @@ Item {
compare(change.yRotation, 22.5)
compare(change.zoomLevel, 500.0)
}
+ }
+ TestCase {
+ name: "Camera3D Invalid"
+
+ function test_invalid() {
+ invalid.target = Qt.vector3d(-1.5, -1.5, -1.5)
+ compare(invalid.target, Qt.vector3d(-1.0, -1.0, -1.0))
+ invalid.target = Qt.vector3d(1.5, 1.5, 1.5)
+ compare(invalid.target, Qt.vector3d(1.0, 1.0, 1.0))
+ invalid.minZoomLevel = 0.1
+ compare(invalid.minZoomLevel, 1.0)
+ }
}
}
diff --git a/tests/auto/qmltest/scene3d/tst_scene.qml b/tests/auto/qmltest/scene3d/tst_scene.qml
index 8d497b5c..d53042ca 100644
--- a/tests/auto/qmltest/scene3d/tst_scene.qml
+++ b/tests/auto/qmltest/scene3d/tst_scene.qml
@@ -46,6 +46,10 @@ Item {
id: change
}
+ Bars3D {
+ id: invalid
+ }
+
TestCase {
name: "Scene3D Initial"
@@ -109,4 +113,13 @@ Item {
compare(change.scene.viewport, Qt.rect(0, 0, 100, 100))
}
}
+
+ TestCase {
+ name: "Scene3D Invalid"
+
+ function test_invalid() {
+ invalid.scene.primarySubViewport = Qt.rect(0, 0, -50, -50)
+ compare(invalid.scene.primarySubViewport, Qt.rect(0, 0, 0, 0))
+ }
+ }
}
diff --git a/tests/auto/qmltest/surface3d/tst_heightproxy.qml b/tests/auto/qmltest/surface3d/tst_heightproxy.qml
index dc6938f8..29772451 100644
--- a/tests/auto/qmltest/surface3d/tst_heightproxy.qml
+++ b/tests/auto/qmltest/surface3d/tst_heightproxy.qml
@@ -42,6 +42,10 @@ Item {
id: change
}
+ HeightMapSurfaceDataProxy {
+ id: invalid
+ }
+
TestCase {
name: "HeightMapSurfaceDataProxy Initial"
@@ -98,4 +102,15 @@ Item {
compare(change.rowCount, 24)
}
}
+
+ TestCase {
+ name: "HeightMapSurfaceDataProxy Invalid"
+
+ function test_invalid() {
+ invalid.maxXValue = -10
+ compare(invalid.minXValue, -11)
+ invalid.minZValue = 20
+ compare(invalid.maxZValue, 21)
+ }
+ }
}
diff --git a/tests/auto/qmltest/theme3d/tst_theme.qml b/tests/auto/qmltest/theme3d/tst_theme.qml
index 9c1a22f1..3e42b300 100644
--- a/tests/auto/qmltest/theme3d/tst_theme.qml
+++ b/tests/auto/qmltest/theme3d/tst_theme.qml
@@ -93,6 +93,10 @@ Item {
id: change
}
+ Theme3D {
+ id: invalid
+ }
+
TestCase {
name: "Theme3D Initial"
@@ -239,4 +243,24 @@ Item {
compare(change.baseGradients[0].stops[0].color, "#000000")
}
}
+
+
+ TestCase {
+ name: "Theme3D Invalid"
+
+ function test_invalid() {
+ invalid.ambientLightStrength = -1.0
+ compare(invalid.ambientLightStrength, 0.25)
+ invalid.ambientLightStrength = 1.1
+ compare(invalid.ambientLightStrength, 0.25)
+ invalid.highlightLightStrength = -1.0
+ compare(invalid.highlightLightStrength, 7.5)
+ invalid.highlightLightStrength = 10.1
+ compare(invalid.highlightLightStrength, 7.5)
+ invalid.lightStrength = -1.0
+ compare(invalid.lightStrength, 5.0)
+ invalid.lightStrength = 10.1
+ compare(invalid.lightStrength, 5.0)
+ }
+ }
}