summaryrefslogtreecommitdiff
path: root/tests/auto/declarative_ui/tst_map_item.qml
blob: 8ede357fafda7da802f23ced2eabd3338060f2c9 (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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

import QtQuick 2.0
import QtTest 1.0
import QtLocation 5.6
import QtPositioning 5.5
import QtLocation.Test 5.6

    /*

     (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"; allowExperimental: true }

    property variant someCoordinate1: QtPositioning.coordinate(15, 15)
    property variant someCoordinate2: QtPositioning.coordinate(16, 16)

    Route { id: someRoute;
        path: [
            { latitude: 22, longitude: 15 },
            { latitude: 21, longitude: 16 },
            { latitude: 23, longitude: 17 }
        ]
    }
    Item { id: someItem }

    MapCircle {
        id: extMapCircle
        center {
            latitude: 35
            longitude: 15
        }
        color: 'firebrick'
        radius: 600000
        MouseArea {
            anchors.fill: parent
            SignalSpy { id: extMapCircleClicked; target: parent; signalName: "clicked" }
        }
    }

    MapQuickItem {
        id: extMapQuickItem
        MouseArea {
            anchors.fill: parent
            SignalSpy { id: extMapQuickItemClicked; target: parent; signalName: "clicked" }
        }
        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: 9
        plugin: testPlugin;

        MapRectangle {
            id: preMapRect
            MouseArea {
                id: preMapRectMa
                anchors.fill: parent
                drag.target: parent
                preventStealing: true
                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
            MouseArea {
                id: preMapCircleMa
                anchors.fill: parent
                drag.target: parent
                preventStealing: true
                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
            MouseArea {
                id: preMapQuickItemMa
                anchors.fill: parent
                drag.target: parent
                preventStealing: true
                SignalSpy { id: preMapQuickItemClicked; target: parent; signalName: "clicked" }
                SignalSpy { id: preMapQuickItemActiveChanged; target: parent.drag; signalName: "activeChanged" }
            }
            sourceItem: Rectangle {
                id: preMapQuickItemSource
                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'
            border.width: 0
            path: [
                { latitude: 25, longitude: 5 },
                { latitude: 20, longitude: 10 },
                { latitude: 15, longitude: 6 }
            ]
            MouseArea {
                anchors.fill: parent
                drag.target: parent
                SignalSpy { id: preMapPolygonClicked; target: parent; signalName: "clicked" }
            }
            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: [
                { latitude: 25, longitude: 15 },
                { latitude: 20, longitude: 19 },
                { 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: [
                    { latitude: 25, longitude: 14 },
                    { latitude: 20, longitude: 18 },
                    { 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: "MapItems"
        when: windowShown

        function initTestCase()
        {
            // 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.fromCoordinate(map.center)
            verify (fuzzy_compare(mapcenter.x, 100, 2))
            verify (fuzzy_compare(mapcenter.y, 100, 2))
        }

        function init()
        {
            map.center = QtPositioning.coordinate(20, 20)
            preMapCircle.center = QtPositioning.coordinate(10,30)
            preMapCircle.border.width = 0
            preMapCircle.color = 'red'
            preMapCircle.radius = 10000
            preMapCircleClicked.clear()
            preMapCircleCenterChanged.clear()
            preMapCircleColorChanged.clear()
            preMapCircleRadiusChanged.clear()
            preMapCircleBorderColorChanged.clear()
            preMapCircleBorderWidthChanged.clear()

            preMapRect.color = 'red'
            preMapRect.border.width = 0
            preMapRect.topLeft = QtPositioning.coordinate(20, 20)
            preMapRect.bottomRight = QtPositioning.coordinate(10, 30)
            preMapRectTopLeftChanged.clear()
            preMapRectBottomRightChanged.clear()
            preMapRectColorChanged.clear()
            preMapRectClicked.clear()
            preMapRectActiveChanged.clear()

            preMapQuickItem.sourceItem = preMapQuickItemSource
            preMapQuickItem.zoomLevel = 0
            preMapQuickItem.coordinate =  QtPositioning.coordinate(35, 3)
            preMapQuickItemClicked.clear()
            preMapQuickItem.anchorPoint = Qt.point(0,0)
            preMapQuickItemCoordinateChanged.clear()
            preMapQuickItemAnchorPointChanged.clear()
            preMapQuickItemZoomLevelChanged.clear()
            preMapQuickItemSourceItemChanged.clear()

            preMapPolygonClicked.clear()
            preMapPolylineColorChanged.clear()
            preMapPolylineWidthChanged.clear()
            preMapPolylinePathChanged.clear()
            preMapPolygonPathChanged.clear()
            preMapPolygonColorChanged.clear()
            preMapPolygonBorderColorChanged.clear()
            preMapPolygonBorderWidthChanged.clear()
            preMapRouteRouteChanged.clear()
            preMapRouteLineColorChanged.clear()
            preMapRouteLineWidthChanged.clear()
            verify(LocationTestHelper.waitForPolished(map))
        }

        function test_items_on_map()
        {
            // click rect
            map.center = preMapRect.topLeft
            verify(LocationTestHelper.waitForPolished(map))
            var point = map.fromCoordinate(preMapRect.topLeft)
            mouseClick(map, point.x + 5, point.y + 5)
            tryCompare(preMapRectClicked, "count", 1)
            mouseClick(map, 1, 1) // no item hit
            tryCompare(preMapRectClicked, "count", 1)
            compare(preMapCircleClicked.count, 0)

            // click circle, overlaps and is above rect
            map.center = preMapCircle.center
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapCircle.center)
            mouseClick(map, point.x - 5, point.y - 5)
            tryCompare(preMapCircleClicked, "count", 1)
            compare(preMapRectClicked.count, 1)

            // click within circle bounding rect but not inside the circle geometry
            map.center = preMapCircle.center.atDistanceAndAzimuth(preMapCircle.radius, -45)
            mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4)
            tryCompare(preMapRectClicked, "count", 2)
            compare(preMapCircleClicked.count, 1)

            // click quick item
            compare(preMapQuickItemClicked.count, 0)
            map.center = preMapQuickItem.coordinate
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            tryCompare(preMapQuickItemClicked, "count", 1)

            // click polygon
            compare (preMapPolygonClicked.count, 0)
            map.center = preMapPolygon.path[1]
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapPolygon.path[1])
            mouseClick(map, point.x - 5, point.y)
            tryCompare(preMapPolygonClicked, "count", 1)
        }

        function test_no_items_on_map()
        {
            // remove items and repeat clicks to verify they are gone
            map.clearMapItems()
            compare (map.mapItems.length, 0)
            map.center = preMapRect.topLeft
            var point = map.fromCoordinate(preMapRect.topLeft)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapRectClicked.count, 0)
            verify(LocationTestHelper.waitForPolished(map))
            map.center = preMapCircle.center
            point = map.fromCoordinate(preMapCircle.center)
            mouseClick(map, point.x - 5, point.y - 5)
            compare(preMapRectClicked.count, 0)
            compare(preMapCircleClicked.count, 0)
            map.center = preMapCircle.center.atDistanceAndAzimuth(preMapCircle.radius, -45)
            mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4)
            compare(preMapRectClicked.count, 0)
            compare(preMapCircleClicked.count, 0)
            compare(preMapQuickItemClicked.count, 0)
            map.center = preMapQuickItem.coordinate
            point = map.fromCoordinate(preMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            compare(preMapQuickItemClicked.count, 0)
            map.center = preMapPolygon.path[1]
            point = map.fromCoordinate(preMapPolygon.path[1])
            mouseClick(map, point.x - 5, point.y)
            compare(preMapPolygonClicked.count, 0)

            // re-add items and verify they are back
            // 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)

            map.center = preMapRect.topLeft
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapRect.topLeft)
            mouseClick(map, point.x + 5, point.y + 5)
            tryCompare(preMapRectClicked, "count", 1)
            map.center = preMapCircle.center
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapCircle.center)
            mouseClick(map, point.x - 5, point.y - 5)
            tryCompare(preMapRectClicked, "count", 1)
            compare(preMapCircleClicked.count, 1)
            map.center = preMapCircle.center.atDistanceAndAzimuth(preMapCircle.radius, -45)
            verify(LocationTestHelper.waitForPolished(map))
            mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4)
            tryCompare(preMapRectClicked, "count", 2)
            compare(preMapCircleClicked.count, 1)
            compare(preMapQuickItemClicked.count, 0)
            map.center = preMapQuickItem.coordinate
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            tryCompare(preMapQuickItemClicked, "count", 1)
            map.center = preMapPolygon.path[1]
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapPolygon.path[1])
            mouseClick(map, point.x - 5, point.y)
            tryCompare(preMapPolygonClicked, "count", 1)


            // item clips to map. not sure if this is sensible test
            map.addMapItem(extMapCircle)
            map.center = extMapCircle.center
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(extMapCircle.center)
            mouseClick(map, point.x, point.y)
            tryCompare(extMapCircleClicked, "count", 1)
            mouseClick(map, point.x, -5)
            tryCompare(extMapCircleClicked, "count", 1)
            map.removeMapItem(extMapCircle)

            map.addMapItem(extMapQuickItem)
            map.center = extMapQuickItem.coordinate
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(extMapQuickItem.coordinate)
            mouseClick(map, point.x + 5, point.y + 5)
            tryCompare(extMapQuickItemClicked, "count", 1)
            mouseClick(map, map.width + 5, point.y + 5)
            tryCompare(extMapQuickItemClicked, "count", 1)
            map.removeMapItem(extMapQuickItem)
        }

        function test_drag()
        {
            // basic drags, drag rectangle
            compare (preMapRectActiveChanged.count, 0)
            map.center = preMapRect.topLeft
            verify(LocationTestHelper.waitForPolished(map))
            var i
            var point = map.fromCoordinate(preMapRect.topLeft)
            var targetCoordinate = map.toCoordinate(51, 51)
            mousePress(map, point.x + 5, point.y + 5)
            for (i = 0; i < 50; i += 1) {
                wait(1)
                mouseMove(map, point.x + 5 - i, point.y + 5 - i)
            }
            mouseRelease(map, point.x + 5 - i, point.y + 5 - i)
            compare (preMapRectActiveChanged.count, 2)
            verify(preMapRectTopLeftChanged.count > 1)
            verify(preMapRectBottomRightChanged.count === preMapRectTopLeftChanged.count)
            verify(fuzzy_compare(preMapRect.topLeft.latitude, targetCoordinate.latitude, 0.2))
            verify(fuzzy_compare(preMapRect.topLeft.longitude, targetCoordinate.longitude, 0.2))
            var latH = preMapRect.bottomRight.latitude - preMapRect.topLeft.latitude
            var lonW = preMapRect.bottomRight.longitude - preMapRect.topLeft.longitude
            verify(fuzzy_compare(preMapRect.bottomRight.latitude, preMapRect.topLeft.latitude + latH, 0.1))
            verify(fuzzy_compare(preMapRect.bottomRight.longitude, preMapRect.topLeft.longitude + lonW, 0.1))

            // drag circle
            compare (preMapCircleActiveChanged.count, 0)
            map.center = preMapCircle.center
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapCircle.center)
            targetCoordinate = map.toCoordinate(51, 51)
            mousePress(map, point.x, point.y)
            for (i = 0; i < 50; i += 1) {
                wait(1)
                mouseMove(map, point.x - i, point.y - i)
            }
            mouseRelease(map, point.x - i, point.y - i)
            verify(LocationTestHelper.waitForPolished(map))
            compare(preMapRectActiveChanged.count, 2)
            compare(preMapCircleActiveChanged.count, 2)
            verify(preMapCircleCenterChanged.count > 1)
            verify(fuzzy_compare(preMapCircle.center.latitude, targetCoordinate.latitude, 0.2))
            verify(fuzzy_compare(preMapCircle.center.longitude, targetCoordinate.longitude, 0.2))

            // drag quick item
            compare (preMapQuickItemActiveChanged.count, 0)
            map.center = preMapQuickItem.coordinate
            verify(LocationTestHelper.waitForPolished(map))
            point = map.fromCoordinate(preMapQuickItem.coordinate)
            targetCoordinate = map.toCoordinate(51, 51)
            mousePress(map, point.x + 5, point.y + 5)
            for (i = 0; i < 50; i += 1) {
                wait(1)
                mouseMove(map, point.x - i, point.y - i)
            }
            mouseRelease(map, point.x - i, point.y - i)
            verify(LocationTestHelper.waitForPolished(map))
            compare(preMapQuickItemActiveChanged.count, 2)
            verify(preMapQuickItemCoordinateChanged.count > 1)
            verify(fuzzy_compare(preMapQuickItem.coordinate.latitude, targetCoordinate.latitude, 0.2))
            verify(fuzzy_compare(preMapQuickItem.coordinate.longitude, targetCoordinate.longitude, 0.2))
        }

        function test_basic_items_properties()
        {
            // 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 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;
        }

        // 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)
        }
    }
}