summaryrefslogtreecommitdiff
path: root/tests/auto/declarative_ui/tst_map_item.qml
blob: f5e16da7fa843367f8dc82c1ed01bb70bdc4b7e1 (plain)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

import QtQuick 2.0
import QtTest 1.0
import QtLocation 5.0
import QtLocation.test 5.0

    /*

     (0,0)   ---------------------------------------------------- (240,0)
             | no map                                           |
             |    (20,20)                                       |
     (0,20)  |    ------------------------------------------    | (240,20)
             |    |                                        |    |
             |    |  map                                   |    |
             |    |                                        |    |
             |    |                                        |    |
             |    |                                        |    |
             |    |                   (lat 20, lon 20)     |    |
             |    |                     x                  |    |
             |    |                                        |    |
             |    |                                        |    |
             |    |                                        |    |
             |    |                                        |    |
             |    |                                        |    |
             |    ------------------------------------------    |
             |                                                  |
     (0,240) ---------------------------------------------------- (240,240)

     */

Item {
    id: page
    x: 0; y: 0;
    width: 240
    height: 240
    Plugin { id: testPlugin; name : "qmlgeo.test.plugin";}
    Coordinate{ id: mapDefaultCenter; latitude: 20; longitude: 20}
    Coordinate{ id: someCoordinate1; latitude: 15; longitude: 15}
    Coordinate{ id: someCoordinate2; latitude: 16; longitude: 16}
    Route { id: someRoute;
        path: [
            Coordinate { latitude: 22; longitude: 15},
            Coordinate { latitude: 21; longitude: 16},
            Coordinate { latitude: 23; longitude: 17}
        ]
    }
    Item { id: someItem }

    MapCircle {
        id: extMapCircle
        center: Coordinate { latitude: 35; longitude: 15}
        color: 'firebrick'
        radius: 600000
        MapMouseArea {
            anchors.fill: parent
            onClicked: console.log('ext circle clicked')
            SignalSpy { id: extMapCircleClicked; target: parent; signalName: "clicked" }
        }
    }

    MapQuickItem {
        id: extMapQuickItem
        MapMouseArea {
            anchors.fill: parent
            SignalSpy { id: extMapQuickItemClicked; target: parent; signalName: "clicked" }
        }
        coordinate: Coordinate { latitude: 35; longitude: 33}
        sourceItem: Rectangle {
            color: 'darkblue'
            width: 40
            height: 20
        }
    }

    Map {
        id: map;
        x: 20; y: 20; width: 200; height: 200
        zoomLevel: 3
        center: mapDefaultCenter
        plugin: testPlugin;

        MapRectangle {
            id: preMapRect
            color: 'darkcyan'
            topLeft: Coordinate { latitude: 20; longitude: 20}
            bottomRight: Coordinate { latitude: 10; longitude: 30}
            MapMouseArea {
                id: preMapRectMa
                anchors.fill: parent
                drag.target: parent
                SignalSpy { id: preMapRectClicked; target: parent; signalName: "clicked" }
                SignalSpy { id: preMapRectActiveChanged; target: parent.drag; signalName: "activeChanged" }
            }
            SignalSpy {id: preMapRectTopLeftChanged; target: parent; signalName: "topLeftChanged" }
            SignalSpy {id: preMapRectBottomRightChanged; target: parent; signalName: "bottomRightChanged" }
            SignalSpy {id: preMapRectColorChanged; target: parent; signalName: "colorChanged"}
        }
        MapCircle {
            id: preMapCircle
            color: 'darkmagenta'
            center: Coordinate { latitude: 10; longitude: 30}
            radius: 400000
            MapMouseArea {
                id: preMapCircleMa
                anchors.fill: parent
                drag.target: parent
                SignalSpy { id: preMapCircleClicked; target: parent; signalName: "clicked" }
                SignalSpy { id: preMapCircleActiveChanged; target: parent.drag; signalName: "activeChanged" }
            }
            SignalSpy {id: preMapCircleCenterChanged; target: parent; signalName: "centerChanged"}
            SignalSpy {id: preMapCircleColorChanged; target: parent; signalName: "colorChanged"}
            SignalSpy {id: preMapCircleRadiusChanged; target: parent; signalName: "radiusChanged"}
            SignalSpy {id: preMapCircleBorderColorChanged; target: parent.border; signalName: "colorChanged"}
            SignalSpy {id: preMapCircleBorderWidthChanged; target: parent.border; signalName: "widthChanged"}
        }
        MapQuickItem {
            id: preMapQuickItem
            MapMouseArea {
                anchors.fill: parent
                drag.target: parent
                SignalSpy { id: preMapQuickItemClicked; target: parent; signalName: "clicked" }
                SignalSpy { id: preMapQuickItemActiveChanged; target: parent.drag; signalName: "activeChanged" }
            }
            coordinate: Coordinate { latitude: 35; longitude: 3}
            sourceItem: Rectangle {
                color: 'darkgreen'
                width: 20
                height: 20
            }
            SignalSpy { id: preMapQuickItemCoordinateChanged; target: parent; signalName: "coordinateChanged"}
            SignalSpy { id: preMapQuickItemAnchorPointChanged; target: parent; signalName: "anchorPointChanged"}
            SignalSpy { id: preMapQuickItemZoomLevelChanged; target: parent; signalName: "zoomLevelChanged"}
            SignalSpy { id: preMapQuickItemSourceItemChanged; target: parent; signalName: "sourceItemChanged"}
        }
        MapPolygon {
            id: preMapPolygon
            color: 'darkgrey'
            path: [
                Coordinate { latitude: 25; longitude: 5},
                Coordinate { latitude: 20; longitude: 10},
                Coordinate { latitude: 15; longitude: 6}
            ]
            SignalSpy {id: preMapPolygonPathChanged; target: parent; signalName: "pathChanged"}
            SignalSpy {id: preMapPolygonColorChanged; target: parent; signalName: "colorChanged"}
            SignalSpy {id: preMapPolygonBorderWidthChanged; target: parent.border; signalName: "widthChanged"}
            SignalSpy {id: preMapPolygonBorderColorChanged; target: parent.border; signalName: "colorChanged"}
        }
        MapPolyline {
            id: preMapPolyline
            line.color: 'darkred'
            path: [
                Coordinate { latitude: 25; longitude: 15},
                Coordinate { latitude: 20; longitude: 19},
                Coordinate { latitude: 15; longitude: 16}
            ]
            SignalSpy {id: preMapPolylineColorChanged; target: parent.line; signalName: "colorChanged"}
            SignalSpy {id: preMapPolylineWidthChanged; target: parent.line; signalName: "widthChanged"}
            SignalSpy {id: preMapPolylinePathChanged; target: parent; signalName: "pathChanged"}
        }
        MapRoute {
            id: preMapRoute
            line.color: 'yellow'
            // don't try this at home - route is not user instantiable
            route: Route {
                path: [
                    Coordinate { latitude: 25; longitude: 14},
                    Coordinate { latitude: 20; longitude: 18},
                    Coordinate { latitude: 15; longitude: 15}
                ]
            }
            SignalSpy {id: preMapRouteRouteChanged; target: parent; signalName: "routeChanged"}
            SignalSpy {id: preMapRouteLineWidthChanged; target: parent.line; signalName: "widthChanged"}
            SignalSpy {id: preMapRouteLineColorChanged; target: parent.line; signalName: "colorChanged"}
        }
    }

    TestCase {
        name: "MapMouseArea"
        when: windowShown

        function test_aa_items_on_map() { // aa et al. for execution order
            wait(10)
            // sanity check that the coordinate conversion works, as
            // rest of the case relies on it. for robustness cut
            // a little slack with fuzzy compare
            var mapcenter = map.toScreenPosition(map.center)
            verify (fuzzy_compare(mapcenter.x, 100, 2))
            verify (fuzzy_compare(mapcenter.y, 100, 2))

            // precondition
            compare(preMapRectClicked.count, 0)
            compare(preMapCircleClicked.count, 0)
            // click rect
            var point = map.toScreenPosition(preMapRect.topLeft)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapRectClicked.count, 1)
            mouseClick(map, 1, 1) // no item hit
            compare(preMapRectClicked.count, 1)
            compare(preMapCircleClicked.count, 0)
            // click circle, overlaps and is above rect
            visualInspectionPoint() // marks good visual inspection point
            point = map.toScreenPosition(preMapCircle.center)
            mouseClick(map, point.x - 5, point.y - 5)
            compare(preMapRectClicked.count, 1)
            compare(preMapCircleClicked.count, 1)
            // click within circle bounding rect but not inside the circle geometry
            mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4)
            compare(preMapRectClicked.count, 2)
            compare(preMapCircleClicked.count, 1)
            // click quick item
            compare(preMapQuickItemClicked.count, 0)
            point = map.toScreenPosition(preMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapQuickItemClicked.count, 1)

            // remove items and repeat clicks to verify they are gone
            map.clearMapItems()
            clear_data()
            compare (map.mapItems.length, 0)
            point = map.toScreenPosition(preMapRect.topLeft)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapRectClicked.count, 0)
            visualInspectionPoint()
            point = map.toScreenPosition(preMapCircle.center)
            mouseClick(map, point.x - 5, point.y - 5)
            compare(preMapRectClicked.count, 0)
            compare(preMapCircleClicked.count, 0)
            mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4)
            compare(preMapRectClicked.count, 0)
            compare(preMapCircleClicked.count, 0)
            compare(preMapQuickItemClicked.count, 0)
            point = map.toScreenPosition(preMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapQuickItemClicked.count, 0)

            // re-add items and verify they are back (without needing to pan map etc.)
            // note: addition order is significant
            map.addMapItem(preMapRect)
            map.addMapItem(preMapCircle)
            map.addMapItem(preMapQuickItem)
            map.addMapItem(preMapPolygon)
            map.addMapItem(preMapPolyline)
            map.addMapItem(preMapRoute)
            compare (map.mapItems.length, 6)
            visualInspectionPoint()
            point = map.toScreenPosition(preMapRect.topLeft)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapRectClicked.count, 1)
            point = map.toScreenPosition(preMapCircle.center)
            mouseClick(map, point.x - 5, point.y - 5)
            compare(preMapRectClicked.count, 1)
            compare(preMapCircleClicked.count, 1)
            mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4)
            compare(preMapRectClicked.count, 2)
            compare(preMapCircleClicked.count, 1)
            compare(preMapQuickItemClicked.count, 0)
            point = map.toScreenPosition(preMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapQuickItemClicked.count, 1)

            // item clips to map. not sure if this is sensible test
            map.addMapItem(extMapCircle)
            visualInspectionPoint();
            point = map.toScreenPosition(extMapCircle.center)
            mouseClick(map, point.x, point.y)
            compare(extMapCircleClicked.count, 1)
            mouseClick(map, point.x, -5)
            compare(extMapCircleClicked.count, 1)

            map.addMapItem(extMapQuickItem)
            visualInspectionPoint();
            point = map.toScreenPosition(extMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(extMapQuickItemClicked.count, 1)
            mouseClick(map, map.width + 5, point.y + 5)
            compare(extMapQuickItemClicked.count, 1)
        }

        function test_ab_drag() {
            clear_data()
            // basic drags, drag rectangle
            compare (preMapRectActiveChanged.count, 0)
            var i = 0
            var point = map.toScreenPosition(preMapRect.topLeft)
            mousePress(map, point.x + 5, point.y + 5)
            for (i=0; i < 50; i += 5) {
                wait(1)
                mouseMove(map, point.x + 5 - i, point.y + 5 - i)
            }
            mouseRelease(map, point.x + 5 - i, point.y + 5 - i)
            visualInspectionPoint()
            compare (preMapRectActiveChanged.count, 2)
            // coordinates update only (once) after drag has finished
            compare (preMapRectTopLeftChanged.count, 1)
            compare (preMapRectBottomRightChanged.count, 1)
            verify(fuzzy_compare(preMapRect.topLeft.latitude, 27.2, 0.1))
            verify(fuzzy_compare(preMapRect.topLeft.longitude, 12.1, 0.1))
            verify(fuzzy_compare(preMapRect.bottomRight.latitude, 17.7, 0.1))
            verify(fuzzy_compare(preMapRect.bottomRight.longitude, 22.1, 0.1))

            // drag circle
            compare (preMapCircleActiveChanged.count, 0)
            point = map.toScreenPosition(preMapCircle.center)
            mousePress(map, point.x, point.y)
            for (i=0; i < 50; i += 5) {
                wait(1)
                mouseMove(map, point.x - i, point.y - i)
            }
            mouseRelease(map, point.x - i, point.y - i)
            visualInspectionPoint()
            compare (preMapRectActiveChanged.count, 2)
            compare (preMapCircleCenterChanged.count, 1)
            verify(fuzzy_compare(preMapCircle.center.latitude, 17.7, 0.1))
            verify(fuzzy_compare(preMapCircle.center.longitude, 22.1, 0.1))

            // drag quick item
            compare (preMapQuickItemActiveChanged.count, 0)
            i = 0
            point = map.toScreenPosition(preMapQuickItem.coordinate)
            mousePress(map, point.x + 5, point.y + 5)
            for (i=0; i < 50; i += 5) {
                wait(1)
                mouseMove(map, point.x + i, point.y + i)
            }
            mouseRelease(map, point.x + i, point.y + i)
            visualInspectionPoint()
            compare (preMapQuickItemActiveChanged.count, 2)
            compare (preMapQuickItemCoordinateChanged.count, 1)
            verify(fuzzy_compare(preMapQuickItem.coordinate.latitude, 29, 0.1))
            verify(fuzzy_compare(preMapQuickItem.coordinate.longitude, 10, 0.1))
        }

        function test_ac_basic_properties() {
            clear_data()
            // circle
            preMapCircle.center = someCoordinate1
            compare (preMapCircleCenterChanged.count, 1)
            preMapCircle.center = someCoordinate1
            compare (preMapCircleCenterChanged.count, 1)
            preMapCircle.color = 'blue'
            compare (preMapCircleColorChanged.count, 1)
            preMapCircle.color = 'blue'
            compare (preMapCircleColorChanged.count, 1)
            preMapCircle.radius  = 50
            compare (preMapCircleRadiusChanged.count, 1)
            preMapCircle.radius  = 50
            compare (preMapCircleRadiusChanged.count, 1)
            preMapCircle.border.color = 'blue'
            compare(preMapCircleBorderColorChanged.count, 1)
            preMapCircle.border.color = 'blue'
            compare(preMapCircleBorderColorChanged.count, 1)
            preMapCircle.border.width = 5
            compare(preMapCircleBorderWidthChanged.count, 1)
            preMapCircle.border.width = 5
            compare(preMapCircleBorderWidthChanged.count, 1)

            // rectangle
            preMapRect.topLeft = someCoordinate1
            compare (preMapRectTopLeftChanged.count, 1)
            compare (preMapRectBottomRightChanged.count, 0)
            preMapRect.bottomRight = someCoordinate2
            compare (preMapRectTopLeftChanged.count, 1)
            compare (preMapRectBottomRightChanged.count, 1)
            preMapRect.bottomRight = someCoordinate2
            preMapRect.topLeft = someCoordinate1
            compare (preMapRectTopLeftChanged.count, 1)
            compare (preMapRectBottomRightChanged.count, 1)
            preMapRect.color = 'blue'
            compare (preMapRectColorChanged.count, 1)
            preMapRect.color = 'blue'
            compare (preMapRectColorChanged.count, 1)

            // polyline
            preMapPolyline.line.width = 5
            compare (preMapPolylineWidthChanged.count, 1)
            preMapPolyline.line.width = 5
            compare (preMapPolylineWidthChanged.count, 1)
            preMapPolyline.line.color = 'blue'
            compare(preMapPolylineColorChanged.count, 1)
            preMapPolyline.line.color = 'blue'
            compare(preMapPolylineColorChanged.count, 1)
            preMapPolyline.addCoordinate(someCoordinate1)
            compare (preMapPolylinePathChanged.count, 1)
            preMapPolyline.addCoordinate(someCoordinate1)
            compare (preMapPolylinePathChanged.count, 2)
            preMapPolyline.removeCoordinate(someCoordinate1)
            compare (preMapPolylinePathChanged.count, 3)
            preMapPolyline.removeCoordinate(someCoordinate1)
            compare (preMapPolylinePathChanged.count, 4)
            preMapPolyline.removeCoordinate(someCoordinate1)
            compare (preMapPolylinePathChanged.count, 4)

            // polygon
            preMapPolygon.border.width = 5
            compare (preMapPolylineWidthChanged.count, 1)
            preMapPolygon.border.width = 5
            compare (preMapPolylineWidthChanged.count, 1)
            preMapPolygon.border.color = 'blue'
            compare(preMapPolylineColorChanged.count, 1)
            preMapPolygon.border.color = 'blue'
            preMapPolygon.color = 'blue'
            compare (preMapPolygonColorChanged.count, 1)
            preMapPolygon.color = 'blue'
            compare (preMapPolygonColorChanged.count, 1)
            preMapPolygon.addCoordinate(someCoordinate1)
            compare (preMapPolygonPathChanged.count, 1)
            preMapPolygon.addCoordinate(someCoordinate1)
            compare (preMapPolygonPathChanged.count, 2)
            preMapPolygon.removeCoordinate(someCoordinate1)
            compare (preMapPolygonPathChanged.count, 3)
            preMapPolygon.removeCoordinate(someCoordinate1)
            compare (preMapPolygonPathChanged.count, 4)
            preMapPolygon.removeCoordinate(someCoordinate1)
            compare (preMapPolygonPathChanged.count, 4)

            // route
            preMapRoute.line.width = 5
            compare (preMapRouteLineWidthChanged.count, 1)
            preMapRoute.line.width = 5
            compare (preMapRouteLineWidthChanged.count, 1)
            preMapRoute.line.color = 'blue'
            compare (preMapRouteLineColorChanged.count, 1)
            preMapRoute.line.color = 'blue'
            compare (preMapRouteLineColorChanged.count, 1)
            preMapRoute.route = someRoute
            compare (preMapRouteRouteChanged.count, 1)
            preMapRoute.route = someRoute
            compare (preMapRouteRouteChanged.count, 1)

            // quick
            compare (preMapQuickItemCoordinateChanged.count, 0)
            preMapQuickItem.coordinate = someCoordinate1
            compare (preMapQuickItemCoordinateChanged.count, 1)
            preMapQuickItem.coordinate = someCoordinate1
            compare (preMapQuickItemCoordinateChanged.count, 1)
            preMapQuickItem.anchorPoint = Qt.point(39, 3)
            compare (preMapQuickItemAnchorPointChanged.count, 1)
            preMapQuickItem.anchorPoint = Qt.point(39, 3)
            compare (preMapQuickItemAnchorPointChanged.count, 1)
            preMapQuickItem.zoomLevel = 6
            compare (preMapQuickItemZoomLevelChanged.count, 1)
            preMapQuickItem.zoomLevel = 6
            compare (preMapQuickItemZoomLevelChanged.count, 1)
            preMapQuickItem.sourceItem = someItem
            compare (preMapQuickItemSourceItemChanged.count, 1)
            preMapQuickItem.sourceItem = someItem
            compare (preMapQuickItemSourceItemChanged.count, 1)
        }

        function clear_data() {
            preMapRectClicked.clear()
            preMapCircleClicked.clear()
            preMapQuickItemClicked.clear()
            preMapCircleCenterChanged.clear()
            preMapCircleColorChanged.clear()
            preMapCircleRadiusChanged.clear()
            preMapCircleBorderColorChanged.clear()
            preMapCircleBorderWidthChanged.clear()
            preMapRectTopLeftChanged.clear()
            preMapRectBottomRightChanged.clear()
            preMapRectColorChanged.clear()
            preMapPolylineColorChanged.clear()
            preMapPolylineWidthChanged.clear()
            preMapPolylinePathChanged.clear()
            preMapPolygonPathChanged.clear()
            preMapPolygonColorChanged.clear()
            preMapPolygonBorderColorChanged.clear()
            preMapPolygonBorderWidthChanged.clear()
            preMapRouteRouteChanged.clear()
            preMapRouteLineColorChanged.clear()
            preMapRouteLineWidthChanged.clear()
            preMapQuickItemCoordinateChanged.clear()
            preMapQuickItemAnchorPointChanged.clear()
            preMapQuickItemZoomLevelChanged.clear()
            preMapQuickItemSourceItemChanged.clear()
        }

        function fuzzy_compare(val, ref, tol) {
            var tolerance = 2
            if (tol !== undefined)
                tolerance = tol
            if ((val >= ref - tolerance) && (val <= ref + tolerance))
                return true;
            console.log('map fuzzy cmp returns false for value, ref, tolerance: ' + val + ', ' + ref + ', ' + tolerance)
            return false;
        }

        // call to visualInspectionPoint testcase (for dev time visual inspection)
        function visualInspectionPoint(time) {
            var waitTime = 0 // 300
            if (time !== undefined)
                waitTime = time
            if (waitTime > 0) {
                console.log('halting for ' + waitTime + ' milliseconds')
                wait (waitTime)
            }
        }
        // these 'real_' prefixed functions do sequences as
        // it would occur on real app (e.g. doubleclick is in fact
        // a sequence of press, release, doubleclick, release).
        // (they were recorded as seen on test app). mouseClick() works ok
        // because testlib internally converts it to mousePress + mouseRelease events
        function real_double_click (target, x, y) {
            mousePress(target, x,y)
            mouseRelease(target, x, y)
            mouseDoubleClick(target, x, y)
            mouseRelease(target, x, y)
        }
        function real_press_and_hold(target, x,y) {
            mousePress(target,x,y)
            wait(850) // threshold is 800 ms
            mouseRelease(target,x, y)
        }
    }
}