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) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Data Visualization module.
**
** $QT_BEGIN_LICENSE:COMM$
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
**
******************************************************************************/
import QtQuick 2.0
import QtDataVisualization 1.2
import QtTest 1.0
Item {
id: top
height: 150
width: 150
HeightMapSurfaceDataProxy {
id: initial
}
HeightMapSurfaceDataProxy {
id: initialized
heightMapFile: ":/customtexture.jpg"
maxXValue: 10.0
maxZValue: 10.0
minXValue: -10.0
minZValue: -10.0
}
HeightMapSurfaceDataProxy {
id: change
}
HeightMapSurfaceDataProxy {
id: invalid
}
TestCase {
name: "HeightMapSurfaceDataProxy Initial"
function test_initial() {
compare(initial.heightMapFile, "")
compare(initial.maxXValue, 10.0)
compare(initial.maxZValue, 10.0)
compare(initial.minXValue, 0)
compare(initial.minZValue, 0)
compare(initial.columnCount, 0)
compare(initial.rowCount, 0)
verify(!initial.series)
compare(initial.type, AbstractDataProxy.DataTypeSurface)
}
}
TestCase {
name: "HeightMapSurfaceDataProxy Initialized"
function test_initialized() {
compare(initialized.heightMapFile, ":/customtexture.jpg")
compare(initialized.maxXValue, 10.0)
compare(initialized.maxZValue, 10.0)
compare(initialized.minXValue, -10.0)
compare(initialized.minZValue, -10.0)
compare(initialized.columnCount, 24)
compare(initialized.rowCount, 24)
}
}
TestCase {
name: "HeightMapSurfaceDataProxy Change"
function test_1_change() {
change.heightMapFile = ":/customtexture.jpg"
change.maxXValue = 10.0
change.maxZValue = 10.0
change.minXValue = -10.0
change.minZValue = -10.0
}
function test_2_test_change() {
// This test has a dependency to the previous one due to asynchronous item model resolving
compare(change.heightMapFile, ":/customtexture.jpg")
compare(change.maxXValue, 10.0)
compare(change.maxZValue, 10.0)
compare(change.minXValue, -10.0)
compare(change.minZValue, -10.0)
compare(change.columnCount, 24)
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)
}
}
}
|