1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the QtDataVisualization module.
**
** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
**
****************************************************************************/
import QtQuick 2.0
import QtDataVisualization 1.2
import QtTest 1.0
Item {
id: top
width: 150
height: 150
Camera3D {
id: initial
}
Camera3D {
id: initialized
maxZoomLevel: 1000.0
minZoomLevel: 100.0
target: Qt.vector3d(1.0, -1.0, 1.0)
wrapXRotation: false
wrapYRotation: true
xRotation: 30.0
yRotation: 30.0
zoomLevel: 500.0
}
Camera3D {
id: change
}
TestCase {
name: "Camera3D Initial"
function test_initial() {
compare(initial.cameraPreset, Camera3D.CameraPresetNone)
compare(initial.maxZoomLevel, 500.0)
compare(initial.minZoomLevel, 10.0)
compare(initial.target, Qt.vector3d(0.0, 0.0, 0.0))
compare(initial.wrapXRotation, true)
compare(initial.wrapYRotation, false)
compare(initial.xRotation, 0.0)
compare(initial.yRotation, 0.0)
compare(initial.zoomLevel, 100.0)
}
}
TestCase {
name: "Camera3D Initialized"
function test_initialized() {
compare(initialized.maxZoomLevel, 1000.0)
compare(initialized.minZoomLevel, 100.0)
compare(initialized.target, Qt.vector3d(1.0, -1.0, 1.0))
compare(initialized.wrapXRotation, false)
compare(initialized.wrapYRotation, true)
compare(initialized.xRotation, 30.0)
compare(initialized.yRotation, 30.0)
compare(initialized.zoomLevel, 500.0)
}
}
TestCase {
name: "Camera3D Change"
function test_1_change() {
change.cameraPreset = Camera3D.CameraPresetBehind // Will be overridden by the the following sets
change.maxZoomLevel = 1000.0
change.minZoomLevel = 100.0
change.target = Qt.vector3d(1.0, -1.0, 1.0)
change.wrapXRotation = false
change.wrapYRotation = true
change.xRotation = 30.0
change.yRotation = 30.0
change.zoomLevel = 500.0
compare(change.cameraPreset, Camera3D.CameraPresetNone)
compare(change.maxZoomLevel, 1000.0)
compare(change.minZoomLevel, 100.0)
compare(change.target, Qt.vector3d(1.0, -1.0, 1.0))
compare(change.wrapXRotation, false)
compare(change.wrapYRotation, true)
compare(change.xRotation, 30.0)
compare(change.yRotation, 30.0)
compare(change.zoomLevel, 500.0)
}
function test_2_change_preset() {
change.cameraPreset = Camera3D.CameraPresetBehind // Sets target and rotations
compare(change.cameraPreset, Camera3D.CameraPresetBehind)
compare(change.maxZoomLevel, 1000.0)
compare(change.minZoomLevel, 100.0)
compare(change.target, Qt.vector3d(0.0, 0.0, 0.0))
compare(change.wrapXRotation, false)
compare(change.wrapYRotation, true)
compare(change.xRotation, 180.0)
compare(change.yRotation, 22.5)
compare(change.zoomLevel, 500.0)
}
}
}
|