summaryrefslogtreecommitdiff
path: root/tests/auto/declarative_ui/tst_map.qml
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-02-01 10:45:24 +0100
committerPaolo Angelelli <paolo.angelelli@theqtcompany.com>2016-03-02 14:41:22 +0000
commit820f79284248e5fcc9910282055e67f07c918559 (patch)
tree8bdfb0b283f463b13453c04c5a28f6734cf568f5 /tests/auto/declarative_ui/tst_map.qml
parent3a079a1e6761f3a26223e360d22530f22b5aeade (diff)
downloadqtlocation-820f79284248e5fcc9910282055e67f07c918559.tar.gz
Adjustment for the minimum zoom level to prevent gray bands
This patch introduces a lower bound for the minimum zoom level of a map element so that it becomes canvas size dependent, and it will also prevent the map from being smaller than the canvas size in either dimension, avoiding gray bands. It also bounds the center of the map so that the map cannot be panned or flicked out of bounds. The documentation for QDeclarativeGeoMap::minimumZoomLevel has been modified to reflect the new behavior. A few testcases have been modified to reflect this new behavior and its implications. Change-Id: I3c8160d0295e8dda2f7001e8fec68a5200ea2172 Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Diffstat (limited to 'tests/auto/declarative_ui/tst_map.qml')
-rw-r--r--tests/auto/declarative_ui/tst_map.qml34
1 files changed, 25 insertions, 9 deletions
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml
index 202fc958..c6620635 100644
--- a/tests/auto/declarative_ui/tst_map.qml
+++ b/tests/auto/declarative_ui/tst_map.qml
@@ -60,16 +60,30 @@ Item {
Map { id: mapZoomOnCompleted; width: 200; height: 200;
zoomLevel: 3; center: coordinate1; plugin: testPlugin;
- Component.onCompleted: { zoomLevel = 7 } }
+ Component.onCompleted: {
+ zoomLevel = 7
+ }
+ }
+ SignalSpy {id: mapZoomSpy; target: mapZoomOnCompleted; signalName: 'zoomLevelChanged'}
+
Map { id: mapZoomDefault; width: 200; height: 200;
center: coordinate1; plugin: testPlugin; }
- Map { id: mapZoomUserInit; width: 200; height: 200;
- zoomLevel: 4; center: coordinate1; plugin: testPlugin; }
- Map {id: map; plugin: testPlugin; center: coordinate1; width: 100; height: 100}
- Map {id: coordinateMap; plugin: herePlugin; center: coordinate3; width: 1000; height: 1000; zoomLevel: 15}
+ Map { id: mapZoomUserInit; width: 210; height: 210;
+ zoomLevel: 4; center: coordinate1; plugin: testPlugin;
+ Component.onCompleted: {
+ console.log("mapZoomUserInit completed")
+ }
+ }
+
+ Map {id: map; plugin: testPlugin; center: coordinate1; width: 100; height: 100}
SignalSpy {id: mapCenterSpy; target: map; signalName: 'centerChanged'}
- SignalSpy {id: mapZoomSpy; target: mapZoomOnCompleted; signalName: 'zoomLevelChanged'}
+
+ Map {id: coordinateMap; plugin: herePlugin; center: coordinate3;
+ width: 1000; height: 1000; zoomLevel: 15 }
+
+
+
TestCase {
when: windowShown
@@ -156,7 +170,7 @@ Item {
function test_zoom()
{
- wait(100)
+ wait(1000)
compare(mapZoomOnCompleted.zoomLevel, 7)
compare(mapZoomDefault.zoomLevel, 8)
compare(mapZoomUserInit.zoomLevel, 4)
@@ -164,7 +178,6 @@ Item {
mapZoomSpy.clear()
mapZoomOnCompleted.zoomLevel = 6
tryCompare(mapZoomSpy, "count", 1)
-
}
function test_pan()
@@ -264,10 +277,13 @@ Item {
point = coordinateMap.fromCoordinate(altitudelessCoordinate)
verify (point.x > 495 && point.x < 505)
verify (point.y > 495 && point.y < 505)
- // out of map area
+ // out of map area in view
+ //var oldZoomLevel = coordinateMap.zoomLevel
+ //coordinateMap.zoomLevel = 8
point = coordinateMap.fromCoordinate(coordinate4)
verify(isNaN(point.x))
verify(isNaN(point.y))
+ //coordinateMap.zoomLevel = oldZoomLevel
// invalid coordinates
point = coordinateMap.fromCoordinate(invalidCoordinate)
verify(isNaN(point.x))