summaryrefslogtreecommitdiff
path: root/tests/auto/declarative_ui/tst_map_item_details.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative_ui/tst_map_item_details.qml')
-rw-r--r--tests/auto/declarative_ui/tst_map_item_details.qml219
1 files changed, 32 insertions, 187 deletions
diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml
index 586d7018..ef11ba6c 100644
--- a/tests/auto/declarative_ui/tst_map_item_details.qml
+++ b/tests/auto/declarative_ui/tst_map_item_details.qml
@@ -30,6 +30,7 @@ import QtQuick 2.0
import QtTest 1.0
import QtPositioning 5.5
import QtLocation 5.6
+import QtLocation.Test 5.6
Item {
id: page
@@ -269,7 +270,6 @@ Item {
Map {
id: map;
x: 20; y: 20; width: 200; height: 200
- zoomLevel: 3
center: mapDefaultCenter
plugin: testPlugin;
}
@@ -303,22 +303,35 @@ Item {
(0,240) ---------------------------------------------------- (240,240)
*/
- function test_aa_precondition() {
- wait(10)
+ function initTestCase()
+ {
// sanity check that the coordinate conversion works
var mapcenter = map.fromCoordinate(map.center)
verify (fuzzy_compare(mapcenter.x, 100, 2))
verify (fuzzy_compare(mapcenter.y, 100, 2))
}
- function test_polygon() {
+ function init()
+ {
map.clearMapItems()
- clear_data()
- compare (extMapPolygon.border.width, 1.0)
- compare (extMapPolygonClicked.count, 0)
+ map.zoomLevel = 3
+ extMapPolygon.border.width = 1.0
+ extMapPolygonClicked.clear()
+ extMapPolylineColorChanged.clear()
+ extMapPolylineWidthChanged.clear()
+ extMapPolylinePathChanged.clear()
+ extMapPolygonPathChanged.clear()
+ extMapPolygonColorChanged.clear()
+ extMapPolygonBorderColorChanged.clear()
+ extMapPolygonBorderWidthChanged.clear()
+ }
+
+ function test_polygon()
+ {
map.center = extMapPolygon.path[1]
var point = map.fromCoordinate(extMapPolygon.path[1])
map.addMapItem(extMapPolygon)
+ verify(LocationTestHelper.waitForPolished(map))
verify(extMapPolygon.path.length == 2)
mouseClick(map, point.x - 5, point.y)
compare(extMapPolygonClicked.count, 0)
@@ -326,7 +339,7 @@ Item {
verify(extMapPolygon0.path.length == 0)
extMapPolygon.addCoordinate(polyCoordinate)
verify(extMapPolygon.path.length == 3)
- verify(waitForRendering(map))
+ verify(LocationTestHelper.waitForPolished(map))
mouseClick(map, point.x - 5, point.y)
tryCompare(extMapPolygonClicked, "count", 1)
@@ -347,9 +360,8 @@ Item {
verify(extMapPolygon.path.length == 0)
}
- function test_polyline() {
- map.clearMapItems()
- clear_data()
+ function test_polyline()
+ {
compare (extMapPolyline.line.width, 1.0)
var point = map.fromCoordinate(extMapPolyline.path[1])
map.addMapItem(extMapPolyline0) // mustn't crash or ill-behave
@@ -406,12 +418,9 @@ Item {
(0,240) ---------------------------------------------------- (600,240)
*/
- function test_yz_dateline() {
- map.clearMapItems()
- clear_data()
+ function test_dateline() {
map.center = datelineCoordinate
map.zoomLevel = 2.2
-
// rectangle
// item spanning across dateline
map.addMapItem(extMapRectDateline)
@@ -427,10 +436,10 @@ Item {
verify(point.x > map.width / 2.0)
// move item edge onto dateline
extMapRectDateline.topLeft.longitude = datelineCoordinate.longitude
- verify(waitForRendering(map))
point = map.fromCoordinate(extMapRectDateline.topLeft)
verify(point.x == map.width / 2.0)
// drag item back onto dateline
+ verify(LocationTestHelper.waitForPolished(map))
mousePress(map, point.x + 5, point.y + 5)
var i
for (i=0; i < 20; i += 2) {
@@ -438,6 +447,7 @@ Item {
mouseMove(map, point.x + 5 - i, point.y + 5 )
}
mouseRelease(map, point.x + 5 - i, point.y + 5)
+ verify(LocationTestHelper.waitForPolished(map))
point = map.fromCoordinate(extMapRectDateline.topLeft)
verify(point.x < map.width / 2.0)
point = map.fromCoordinate(extMapRectDateline.bottomRight)
@@ -451,15 +461,16 @@ Item {
point = map.fromCoordinate(extMapCircleDateline.center)
verify(point.x == map.width / 2.0)
extMapCircleDateline.center.longitude = datelineCoordinateRight.longitude
- verify(waitForRendering(map))
point = map.fromCoordinate(extMapCircleDateline.center)
verify(point.x > map.width / 2.0)
+ verify(LocationTestHelper.waitForPolished(map))
mousePress(map, point.x, point.y)
for (i=0; i < 40; i += 4) {
wait(1)
mouseMove(map, point.x - i, point.y)
}
mouseRelease(map, point.x - i, point.y)
+ verify(LocationTestHelper.waitForPolished(map))
point = map.fromCoordinate(extMapCircleDateline.center)
verify(point.x < map.width / 2.0)
map.removeMapItem(extMapCircleDateline)
@@ -471,15 +482,16 @@ Item {
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
verify(point.x < map.width / 2.0)
extMapQuickItemDateline.coordinate.longitude = datelineCoordinateRight.longitude
- verify(waitForRendering(map))
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
verify(point.x > map.width / 2.0)
+ verify(LocationTestHelper.waitForPolished(map))
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 )
}
mouseRelease(map, point.x + 5 - i, point.y + 5)
+ verify(LocationTestHelper.waitForPolished(map))
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
verify(point.x < map.width / 2.0)
map.removeMapItem(extMapQuickItemDateline)
@@ -513,16 +525,16 @@ Item {
path = extMapPolygonDateline.path;
path[3].longitude = datelineCoordinate.longitude;
extMapPolygonDateline.path = path;
- verify(waitForRendering(map))
point = map.fromCoordinate(extMapPolygonDateline.path[3])
verify(point.x == map.width / 2.0)
+ verify(LocationTestHelper.waitForPolished(map))
mousePress(map, point.x + 5, point.y - 5)
for (i=0; i < 16; i += 2) {
wait(1)
mouseMove(map, point.x + 5 - i, point.y - 5 )
}
mouseRelease(map, point.x + 5 - i, point.y - 5)
- verify(waitForRendering(map,10000))
+ verify(LocationTestHelper.waitForPolished(map))
point = map.fromCoordinate(extMapPolygonDateline.path[0])
verify(point.x < map.width / 2.0)
point = map.fromCoordinate(extMapPolygonDateline.path[1])
@@ -564,167 +576,6 @@ Item {
map.removeMapItem(extMapRouteDateline)
}
- /*
-
- (0,0) ---------------------------------------------------- (600,0)
- | no map |
- | (20,20) |
- (0,20) | ------------------------------------------ | (600,20)
- | | | |
- | | map | |
- | | | |
- | | | |
- | | | |
- | | (lat 20, lon 180) | |
- | | x | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | ------------------------------------------ |
- | |
- (0,240) ---------------------------------------------------- (600,240)
-
- */
- function test_zz_border_drag() {
- map.clearMapItems()
- clear_data()
- map.center = datelineCoordinate
-
- // lower zoom level and change widths to reveal map border.
- // Note: items are not visible at zoom level < 2.0,
- // but for testing it's ok
- map.zoomLevel = 1
- page.width = 600
- map.width = 560
-
- // rectangle
- map.addMapItem(extMapRectEdge)
- verify(waitForRendering(map))
- verify(extMapRectEdge.topLeft.longitude == -15)
- verify(extMapRectEdge.bottomRight.longitude == -5)
- var point = map.fromCoordinate(extMapRectEdge.topLeft)
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- point = map.fromCoordinate(extMapRectEdge.bottomRight)
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- var originalWidth = extMapRectEdge.width;
- verify(originalWidth < map.width / 2.0)
- // drag item onto map border
- point = map.fromCoordinate(extMapRectEdge.topLeft)
- mousePress(map, point.x + 5, point.y + 5)
- var i
- for (i=0; i < 20; i += 2) {
- wait(1)
- mouseMove(map, point.x + 5 + i, point.y + 5)
- }
- mouseRelease(map, point.x + 5 + i, point.y + 5)
- // currently the bottom right screen point is unwrapped and drawn
- // out of the map border, but in the future culling may take place
- // so tests for points outside the map border are ignored,
- // instead we check the item width
- point = map.fromCoordinate(extMapRectEdge.topLeft)
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- compare(extMapRectEdge.width, originalWidth)
- map.removeMapItem(extMapRectEdge)
-
- // circle
- map.addMapItem(extMapCircleEdge)
- map.center = datelineCoordinate
- verify(extMapCircleEdge.center.longitude == -15)
- var point = map.fromCoordinate(extMapCircleEdge.center)
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- originalWidth = extMapCircleEdge.width;
- verify(originalWidth < map.width / 2.0)
- point = map.fromCoordinate(extMapCircleEdge.center)
- mousePress(map, point.x, point.y)
- for (i=0; i < 20; i += 2) {
- wait(1)
- mouseMove(map, point.x + i, point.y)
- }
- mouseRelease(map, point.x + i, point.y)
- point = map.fromCoordinate(extMapCircleEdge.center)
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- fuzzy_compare(extMapCircleEdge.width, originalWidth)
- map.removeMapItem(extMapCircleEdge)
-
- // quickitem
- map.addMapItem(extMapQuickItemEdge)
- map.center = datelineCoordinate
- verify(waitForRendering(map))
- verify(extMapQuickItemEdge.coordinate.longitude == -15)
- point = map.fromCoordinate(extMapQuickItemEdge.coordinate)
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- originalWidth = extMapQuickItemEdge.width;
- verify(originalWidth < map.width / 2.0)
- mousePress(map, point.x + 5, point.y + 5)
- for (i=0; i < 20; i += 2) {
- wait(1)
- mouseMove(map, point.x + 5 + i, point.y + 5)
- }
- mouseRelease(map, point.x + 5 + i, point.y + 5)
- point = map.fromCoordinate(extMapQuickItemEdge.coordinate)
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- compare(extMapQuickItemEdge.width, originalWidth)
- map.removeMapItem(extMapQuickItemEdge)
-
- // polygon
- map.center = datelineCoordinate
- map.addMapItem(extMapPolygonEdge)
- verify(waitForRendering(map))
- verify(extMapPolygonEdge.path[0].longitude == -15)
- verify(extMapPolygonEdge.path[1].longitude == -5)
- verify(extMapPolygonEdge.path[2].longitude == -5)
- verify(extMapPolygonEdge.path[3].longitude == -15)
- point = map.fromCoordinate(extMapPolygonEdge.path[0])
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- point = map.fromCoordinate(extMapPolygonEdge.path[1])
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- point = map.fromCoordinate(extMapPolygonEdge.path[2])
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- point = map.fromCoordinate(extMapPolygonEdge.path[3])
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- originalWidth = extMapPolygonEdge.width;
- verify(originalWidth < map.width / 2.0)
- mousePress(map, point.x + 5, point.y - 5)
- for (i=0; i < 20; i += 2) {
- wait(1)
- mouseMove(map, point.x + 5 + i, point.y - 5)
- }
- mouseRelease(map, point.x + 5 + i, point.y - 5)
- point = map.fromCoordinate(extMapPolygonEdge.path[0])
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- point = map.fromCoordinate(extMapPolygonEdge.path[3])
- verify(point.x < map.width)
- verify(point.x > map.width / 2.0)
- compare(extMapPolygonEdge.width, originalWidth)
- map.removeMapItem(extMapPolygonEdge)
- }
-
-
- function clear_data() {
- extMapPolygonClicked.clear()
- extMapPolylineColorChanged.clear()
- extMapPolylineWidthChanged.clear()
- extMapPolylinePathChanged.clear()
- extMapPolygonPathChanged.clear()
- extMapPolygonColorChanged.clear()
- extMapPolygonBorderColorChanged.clear()
- extMapPolygonBorderWidthChanged.clear()
- }
-
function fuzzy_compare(val, ref, tol) {
var tolerance = 2
if (tol !== undefined)
@@ -734,11 +585,5 @@ Item {
console.log('map fuzzy cmp returns false for value, ref, tolerance: ' + val + ', ' + ref + ', ' + tolerance)
return false;
}
-
- // call to visualInspectionPoint testcase (only for development time visual inspection)
- function visualInspectionPoint(text) {
- progressText.text = text
- //wait (500)
- }
}
}