diff options
author | Aaron McCarthy <aaron.mccarthy@jollamobile.com> | 2015-01-16 10:20:34 +1000 |
---|---|---|
committer | Aaron McCarthy <mccarthy.aaron@gmail.com> | 2015-01-20 02:46:21 +0100 |
commit | c549b13656fe7bde5536961f168f0f1a68ea3490 (patch) | |
tree | e779d64e3cab36d7edcd4ae82387f4881d92b5ff /tests | |
parent | 9ef638cd502ccf0caa536b4627497767bece0670 (diff) | |
download | qtlocation-c549b13656fe7bde5536961f168f0f1a68ea3490.tar.gz |
Better names for incorrectly named Map functions.
The functions to transform between coordinates and position on screen
were incorrect. Documentation and function names did not match
implementation.
New functions with better names have been added and documentation
updated to match implementation. Old invalid functions have been
deprecated.
Related private symbols have been renamed to match their purpose.
[ChangeLog][QtLocation][Important Behavior Changes] Functions in Map
item which are used transform between coordinates and screen position
have been deprecated due to confusing naming.
Change-Id: Ic501cd81220414800bc2247eae9f510954ee469f
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative_ui/tst_map.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative_ui/tst_map_item.qml | 36 | ||||
-rw-r--r-- | tests/auto/declarative_ui/tst_map_item_details.qml | 96 | ||||
-rw-r--r-- | tests/auto/declarative_ui/tst_map_item_fit_viewport.qml | 10 | ||||
-rw-r--r-- | tests/auto/qgeomapscene/tst_qgeomapscene.cpp | 4 |
5 files changed, 78 insertions, 78 deletions
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 02fd6360..a225a5f4 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -256,22 +256,22 @@ Item { compare(coordinateMap.center.latitude, 50) compare(coordinateMap.center.longitude, 50) // valid to screen position - var point = coordinateMap.toScreenPosition(coordinateMap.center) + var point = coordinateMap.fromCoordinate(coordinateMap.center) verify (point.x > 495 && point.x < 505) verify (point.y > 495 && point.y < 505) // valid coordinate without altitude - point = coordinateMap.toScreenPosition(altitudelessCoordinate) + point = coordinateMap.fromCoordinate(altitudelessCoordinate) verify (point.x > 495 && point.x < 505) verify (point.y > 495 && point.y < 505) // out of map area - point = coordinateMap.toScreenPosition(coordinate4) + point = coordinateMap.fromCoordinate(coordinate4) verify(isNaN(point.x)) verify(isNaN(point.y)) // invalid coordinates - point = coordinateMap.toScreenPosition(invalidCoordinate) + point = coordinateMap.fromCoordinate(invalidCoordinate) verify(isNaN(point.x)) verify(isNaN(point.y)) - point = coordinateMap.toScreenPosition(null) + point = coordinateMap.fromCoordinate(null) verify(isNaN(point.x)) verify(isNaN(point.y)) // valid point to coordinate diff --git a/tests/auto/declarative_ui/tst_map_item.qml b/tests/auto/declarative_ui/tst_map_item.qml index 1076b6cc..a0103a02 100644 --- a/tests/auto/declarative_ui/tst_map_item.qml +++ b/tests/auto/declarative_ui/tst_map_item.qml @@ -246,7 +246,7 @@ Item { // 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) + var mapcenter = map.fromCoordinate(map.center) verify (fuzzy_compare(mapcenter.x, 100, 2)) verify (fuzzy_compare(mapcenter.y, 100, 2)) @@ -256,7 +256,7 @@ Item { // click rect map.center = preMapRect.topLeft - var point = map.toScreenPosition(preMapRect.topLeft) + var point = map.fromCoordinate(preMapRect.topLeft) mouseClick(map, point.x + 5, point.y + 5) compare(preMapRectClicked.count, 1) mouseClick(map, 1, 1) // no item hit @@ -265,7 +265,7 @@ Item { // click circle, overlaps and is above rect map.center = preMapCircle.center - point = map.toScreenPosition(preMapCircle.center) + point = map.fromCoordinate(preMapCircle.center) mouseClick(map, point.x - 5, point.y - 5) compare(preMapRectClicked.count, 1) compare(preMapCircleClicked.count, 1) @@ -279,14 +279,14 @@ Item { // click quick item compare(preMapQuickItemClicked.count, 0) map.center = preMapQuickItem.coordinate - point = map.toScreenPosition(preMapQuickItem.coordinate) + point = map.fromCoordinate(preMapQuickItem.coordinate) mouseClick(map, point.x + 5, point.y + 5) compare(preMapQuickItemClicked.count, 1) // click polygon compare (preMapPolygonClicked.count, 0) map.center = preMapPolygon.path[1] - point = map.toScreenPosition(preMapPolygon.path[1]) + point = map.fromCoordinate(preMapPolygon.path[1]) mouseClick(map, point.x - 5, point.y) compare(preMapPolygonClicked.count, 1) @@ -295,12 +295,12 @@ Item { clear_data() compare (map.mapItems.length, 0) map.center = preMapRect.topLeft - point = map.toScreenPosition(preMapRect.topLeft) + point = map.fromCoordinate(preMapRect.topLeft) mouseClick(map, point.x + 5, point.y + 5) compare(preMapRectClicked.count, 0) visualInspectionPoint() map.center = preMapCircle.center - point = map.toScreenPosition(preMapCircle.center) + point = map.fromCoordinate(preMapCircle.center) mouseClick(map, point.x - 5, point.y - 5) compare(preMapRectClicked.count, 0) compare(preMapCircleClicked.count, 0) @@ -310,11 +310,11 @@ Item { compare(preMapCircleClicked.count, 0) compare(preMapQuickItemClicked.count, 0) map.center = preMapQuickItem.coordinate - point = map.toScreenPosition(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.toScreenPosition(preMapPolygon.path[1]) + point = map.fromCoordinate(preMapPolygon.path[1]) mouseClick(map, point.x - 5, point.y) compare(preMapPolygonClicked.count, 0) @@ -329,11 +329,11 @@ Item { compare (map.mapItems.length, 6) visualInspectionPoint() map.center = preMapRect.topLeft - point = map.toScreenPosition(preMapRect.topLeft) + point = map.fromCoordinate(preMapRect.topLeft) mouseClick(map, point.x + 5, point.y + 5) compare(preMapRectClicked.count, 1) map.center = preMapCircle.center - point = map.toScreenPosition(preMapCircle.center) + point = map.fromCoordinate(preMapCircle.center) mouseClick(map, point.x - 5, point.y - 5) compare(preMapRectClicked.count, 1) compare(preMapCircleClicked.count, 1) @@ -343,11 +343,11 @@ Item { compare(preMapCircleClicked.count, 1) compare(preMapQuickItemClicked.count, 0) map.center = preMapQuickItem.coordinate - point = map.toScreenPosition(preMapQuickItem.coordinate) + point = map.fromCoordinate(preMapQuickItem.coordinate) mouseClick(map, point.x + 5, point.y + 5) compare(preMapQuickItemClicked.count, 1) map.center = preMapPolygon.path[1] - point = map.toScreenPosition(preMapPolygon.path[1]) + point = map.fromCoordinate(preMapPolygon.path[1]) mouseClick(map, point.x - 5, point.y) compare(preMapPolygonClicked.count, 1) @@ -356,7 +356,7 @@ Item { map.addMapItem(extMapCircle) map.center = extMapCircle.center visualInspectionPoint(); - point = map.toScreenPosition(extMapCircle.center) + point = map.fromCoordinate(extMapCircle.center) mouseClick(map, point.x, point.y) compare(extMapCircleClicked.count, 1) mouseClick(map, point.x, -5) @@ -366,7 +366,7 @@ Item { map.addMapItem(extMapQuickItem) map.center = extMapQuickItem.coordinate visualInspectionPoint(); - point = map.toScreenPosition(extMapQuickItem.coordinate) + point = map.fromCoordinate(extMapQuickItem.coordinate) mouseClick(map, point.x + 5, point.y + 5) compare(extMapQuickItemClicked.count, 1) mouseClick(map, map.width + 5, point.y + 5) @@ -380,7 +380,7 @@ Item { compare (preMapRectActiveChanged.count, 0) map.center = preMapRect.topLeft var i - var point = map.toScreenPosition(preMapRect.topLeft) + 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) { @@ -401,7 +401,7 @@ Item { // drag circle compare (preMapCircleActiveChanged.count, 0) map.center = preMapCircle.center - point = map.toScreenPosition(preMapCircle.center) + point = map.fromCoordinate(preMapCircle.center) targetCoordinate = map.toCoordinate(51, 51) mousePress(map, point.x, point.y) for (i = 0; i < 50; i += 1) { @@ -419,7 +419,7 @@ Item { // drag quick item compare (preMapQuickItemActiveChanged.count, 0) map.center = preMapQuickItem.coordinate - point = map.toScreenPosition(preMapQuickItem.coordinate) + 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) { diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml index 2455d34c..f633e14c 100644 --- a/tests/auto/declarative_ui/tst_map_item_details.qml +++ b/tests/auto/declarative_ui/tst_map_item_details.qml @@ -308,7 +308,7 @@ Item { function test_aa_precondition() { wait(10) // sanity check that the coordinate conversion works - var mapcenter = map.toScreenPosition(map.center) + var mapcenter = map.fromCoordinate(map.center) verify (fuzzy_compare(mapcenter.x, 100, 2)) verify (fuzzy_compare(mapcenter.y, 100, 2)) } @@ -319,7 +319,7 @@ Item { compare (extMapPolygon.border.width, 1.0) compare (extMapPolygonClicked.count, 0) map.center = extMapPolygon.path[1] - var point = map.toScreenPosition(extMapPolygon.path[1]) + var point = map.fromCoordinate(extMapPolygon.path[1]) map.addMapItem(extMapPolygon) verify(extMapPolygon.path.length == 2) mouseClick(map, point.x - 5, point.y) @@ -352,7 +352,7 @@ Item { map.clearMapItems() clear_data() compare (extMapPolyline.line.width, 1.0) - var point = map.toScreenPosition(extMapPolyline.path[1]) + var point = map.fromCoordinate(extMapPolyline.path[1]) map.addMapItem(extMapPolyline0) // mustn't crash or ill-behave verify(extMapPolyline0.path.length == 0) map.addMapItem(extMapPolyline) @@ -418,17 +418,17 @@ Item { map.addMapItem(extMapRectDateline) verify(extMapRectDateline.topLeft.longitude == 175) verify(extMapRectDateline.bottomRight.longitude == -175) - var point = map.toScreenPosition(extMapRectDateline.topLeft) + var point = map.fromCoordinate(extMapRectDateline.topLeft) verify(point.x < map.width / 2.0) - point = map.toScreenPosition(extMapRectDateline.bottomRight) + point = map.fromCoordinate(extMapRectDateline.bottomRight) verify(point.x > map.width / 2.0) // move item away from dataline by directly setting its coords extMapRectDateline.bottomRight.longitude = datelineCoordinateRight.longitude - point = map.toScreenPosition(extMapRectDateline.bottomRight) + point = map.fromCoordinate(extMapRectDateline.bottomRight) verify(point.x > map.width / 2.0) // move item edge onto dateline extMapRectDateline.topLeft.longitude = datelineCoordinate.longitude - point = map.toScreenPosition(extMapRectDateline.topLeft) + point = map.fromCoordinate(extMapRectDateline.topLeft) verify(point.x == map.width / 2.0) // drag item back onto dateline mousePress(map, point.x + 5, point.y + 5) @@ -438,9 +438,9 @@ Item { mouseMove(map, point.x + 5 - i, point.y + 5 ) } mouseRelease(map, point.x + 5 - i, point.y + 5) - point = map.toScreenPosition(extMapRectDateline.topLeft) + point = map.fromCoordinate(extMapRectDateline.topLeft) verify(point.x < map.width / 2.0) - point = map.toScreenPosition(extMapRectDateline.bottomRight) + point = map.fromCoordinate(extMapRectDateline.bottomRight) verify(point.x > map.width / 2.0) map.removeMapItem(extMapRectDateline) @@ -448,10 +448,10 @@ Item { map.addMapItem(extMapCircleDateline) verify(extMapCircleDateline.center.longitude === 180) map.center = datelineCoordinate - point = map.toScreenPosition(extMapCircleDateline.center) + point = map.fromCoordinate(extMapCircleDateline.center) verify(point.x == map.width / 2.0) extMapCircleDateline.center.longitude = datelineCoordinateRight.longitude - point = map.toScreenPosition(extMapCircleDateline.center) + point = map.fromCoordinate(extMapCircleDateline.center) verify(point.x > map.width / 2.0) mousePress(map, point.x, point.y) for (i=0; i < 40; i += 4) { @@ -459,7 +459,7 @@ Item { mouseMove(map, point.x - i, point.y) } mouseRelease(map, point.x - i, point.y) - point = map.toScreenPosition(extMapCircleDateline.center) + point = map.fromCoordinate(extMapCircleDateline.center) verify(point.x < map.width / 2.0) map.removeMapItem(extMapCircleDateline) @@ -467,10 +467,10 @@ Item { map.addMapItem(extMapQuickItemDateline) map.center = datelineCoordinate verify(extMapQuickItemDateline.coordinate.longitude === 175) - point = map.toScreenPosition(extMapQuickItemDateline.coordinate) + point = map.fromCoordinate(extMapQuickItemDateline.coordinate) verify(point.x < map.width / 2.0) extMapQuickItemDateline.coordinate.longitude = datelineCoordinateRight.longitude - point = map.toScreenPosition(extMapQuickItemDateline.coordinate) + point = map.fromCoordinate(extMapQuickItemDateline.coordinate) verify(point.x > map.width / 2.0) mousePress(map, point.x + 5, point.y + 5) for (i=0; i < 50; i += 5) { @@ -478,7 +478,7 @@ Item { mouseMove(map, point.x + 5 - i, point.y + 5 ) } mouseRelease(map, point.x + 5 - i, point.y + 5) - point = map.toScreenPosition(extMapQuickItemDateline.coordinate) + point = map.fromCoordinate(extMapQuickItemDateline.coordinate) verify(point.x < map.width / 2.0) map.removeMapItem(extMapQuickItemDateline) @@ -489,29 +489,29 @@ Item { verify(extMapPolygonDateline.path[1].longitude == -175) verify(extMapPolygonDateline.path[2].longitude == -175) verify(extMapPolygonDateline.path[3].longitude == 175) - point = map.toScreenPosition(extMapPolygonDateline.path[0]) + point = map.fromCoordinate(extMapPolygonDateline.path[0]) verify(point.x < map.width / 2.0) - point = map.toScreenPosition(extMapPolygonDateline.path[1]) + point = map.fromCoordinate(extMapPolygonDateline.path[1]) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonDateline.path[2]) + point = map.fromCoordinate(extMapPolygonDateline.path[2]) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonDateline.path[3]) + point = map.fromCoordinate(extMapPolygonDateline.path[3]) verify(point.x < map.width / 2.0) extMapPolygonDateline.path[1].longitude = datelineCoordinateRight.longitude - point = map.toScreenPosition(extMapPolygonDateline.path[1]) + point = map.fromCoordinate(extMapPolygonDateline.path[1]) verify(point.x > map.width / 2.0) extMapPolygonDateline.path[2].longitude = datelineCoordinateRight.longitude - point = map.toScreenPosition(extMapPolygonDateline.path[2]) + point = map.fromCoordinate(extMapPolygonDateline.path[2]) verify(point.x > map.width / 2.0) var path = extMapPolygonDateline.path; path[0].longitude = datelineCoordinate.longitude; extMapPolygonDateline.path = path; - point = map.toScreenPosition(extMapPolygonDateline.path[0]) + point = map.fromCoordinate(extMapPolygonDateline.path[0]) verify(point.x == map.width / 2.0) path = extMapPolygonDateline.path; path[3].longitude = datelineCoordinate.longitude; extMapPolygonDateline.path = path; - point = map.toScreenPosition(extMapPolygonDateline.path[3]) + point = map.fromCoordinate(extMapPolygonDateline.path[3]) verify(point.x == map.width / 2.0) mousePress(map, point.x + 5, point.y - 5) for (i=0; i < 16; i += 2) { @@ -519,13 +519,13 @@ Item { mouseMove(map, point.x + 5 - i, point.y - 5 ) } mouseRelease(map, point.x + 5 - i, point.y - 5) - point = map.toScreenPosition(extMapPolygonDateline.path[0]) + point = map.fromCoordinate(extMapPolygonDateline.path[0]) verify(point.x < map.width / 2.0) - point = map.toScreenPosition(extMapPolygonDateline.path[1]) + point = map.fromCoordinate(extMapPolygonDateline.path[1]) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonDateline.path[2]) + point = map.fromCoordinate(extMapPolygonDateline.path[2]) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonDateline.path[3]) + point = map.fromCoordinate(extMapPolygonDateline.path[3]) verify(point.x < map.width / 2.0) map.removeMapItem(extMapPolygonDateline) @@ -534,17 +534,17 @@ Item { map.center = datelineCoordinate verify(extMapPolylineDateline.path[0].longitude == 175) verify(extMapPolylineDateline.path[1].longitude == -175) - point = map.toScreenPosition(extMapPolylineDateline.path[0]) + point = map.fromCoordinate(extMapPolylineDateline.path[0]) verify(point.x < map.width / 2.0) - point = map.toScreenPosition(extMapPolylineDateline.path[1]) + point = map.fromCoordinate(extMapPolylineDateline.path[1]) verify(point.x > map.width / 2.0) extMapPolylineDateline.path[1].longitude = datelineCoordinateRight.longitude - point = map.toScreenPosition(extMapPolylineDateline.path[1]) + point = map.fromCoordinate(extMapPolylineDateline.path[1]) verify(point.x > map.width / 2.0) var path = extMapPolygonDateline.path; path[0].longitude = datelineCoordinate.longitude; extMapPolylineDateline.path = path; - point = map.toScreenPosition(extMapPolylineDateline.path[0]) + point = map.fromCoordinate(extMapPolylineDateline.path[0]) verify(point.x == map.width / 2.0) map.removeMapItem(extMapPolylineDateline) @@ -553,9 +553,9 @@ Item { map.addMapItem(extMapRouteDateline) verify(extMapRouteDateline.route.path[0].longitude == 175) verify(extMapRouteDateline.route.path[1].longitude == -175) - point = map.toScreenPosition(extMapRouteDateline.route.path[0]) + point = map.fromCoordinate(extMapRouteDateline.route.path[0]) verify(point.x < map.width / 2.0) - point = map.toScreenPosition(extMapRouteDateline.route.path[1]) + point = map.fromCoordinate(extMapRouteDateline.route.path[1]) verify(point.x > map.width / 2.0) map.removeMapItem(extMapRouteDateline) } @@ -599,16 +599,16 @@ Item { map.addMapItem(extMapRectEdge) verify(extMapRectEdge.topLeft.longitude == -15) verify(extMapRectEdge.bottomRight.longitude == -5) - var point = map.toScreenPosition(extMapRectEdge.topLeft) + var point = map.fromCoordinate(extMapRectEdge.topLeft) verify(point.x < map.width) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapRectEdge.bottomRight) + 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.toScreenPosition(extMapRectEdge.topLeft) + point = map.fromCoordinate(extMapRectEdge.topLeft) mousePress(map, point.x + 5, point.y + 5) var i for (i=0; i < 20; i += 2) { @@ -620,7 +620,7 @@ Item { // 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.toScreenPosition(extMapRectEdge.topLeft) + point = map.fromCoordinate(extMapRectEdge.topLeft) verify(point.x < map.width) verify(point.x > map.width / 2.0) compare(extMapRectEdge.width, originalWidth) @@ -630,19 +630,19 @@ Item { map.addMapItem(extMapCircleEdge) map.center = datelineCoordinate verify(extMapCircleEdge.center.longitude == -15) - var point = map.toScreenPosition(extMapCircleEdge.center) + 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.toScreenPosition(extMapCircleEdge.center) + 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.toScreenPosition(extMapCircleEdge.center) + point = map.fromCoordinate(extMapCircleEdge.center) verify(point.x < map.width) verify(point.x > map.width / 2.0) fuzzy_compare(extMapCircleEdge.width, originalWidth) @@ -652,7 +652,7 @@ Item { map.addMapItem(extMapQuickItemEdge) map.center = datelineCoordinate verify(extMapQuickItemEdge.coordinate.longitude == -15) - point = map.toScreenPosition(extMapQuickItemEdge.coordinate) + point = map.fromCoordinate(extMapQuickItemEdge.coordinate) verify(point.x < map.width) verify(point.x > map.width / 2.0) originalWidth = extMapQuickItemEdge.width; @@ -663,7 +663,7 @@ Item { mouseMove(map, point.x + 5 + i, point.y + 5) } mouseRelease(map, point.x + 5 + i, point.y + 5) - point = map.toScreenPosition(extMapQuickItemEdge.coordinate) + point = map.fromCoordinate(extMapQuickItemEdge.coordinate) verify(point.x < map.width) verify(point.x > map.width / 2.0) compare(extMapQuickItemEdge.width, originalWidth) @@ -676,16 +676,16 @@ Item { verify(extMapPolygonEdge.path[1].longitude == -5) verify(extMapPolygonEdge.path[2].longitude == -5) verify(extMapPolygonEdge.path[3].longitude == -15) - point = map.toScreenPosition(extMapPolygonEdge.path[0]) + point = map.fromCoordinate(extMapPolygonEdge.path[0]) verify(point.x < map.width) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonEdge.path[1]) + point = map.fromCoordinate(extMapPolygonEdge.path[1]) verify(point.x < map.width) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonEdge.path[2]) + point = map.fromCoordinate(extMapPolygonEdge.path[2]) verify(point.x < map.width) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonEdge.path[3]) + point = map.fromCoordinate(extMapPolygonEdge.path[3]) verify(point.x < map.width) verify(point.x > map.width / 2.0) originalWidth = extMapPolygonEdge.width; @@ -696,10 +696,10 @@ Item { mouseMove(map, point.x + 5 + i, point.y - 5) } mouseRelease(map, point.x + 5 + i, point.y - 5) - point = map.toScreenPosition(extMapPolygonEdge.path[0]) + point = map.fromCoordinate(extMapPolygonEdge.path[0]) verify(point.x < map.width) verify(point.x > map.width / 2.0) - point = map.toScreenPosition(extMapPolygonEdge.path[3]) + point = map.fromCoordinate(extMapPolygonEdge.path[3]) verify(point.x < map.width) verify(point.x > map.width / 2.0) compare(extMapPolygonEdge.width, originalWidth) diff --git a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml index 5d2145e8..b135a49a 100644 --- a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml +++ b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml @@ -232,7 +232,7 @@ Item { // 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) + var mapcenter = map.fromCoordinate(map.center) verify (fuzzy_compare(mapcenter.x, 100, 2)) verify (fuzzy_compare(mapcenter.y, 100, 2)) @@ -474,7 +474,7 @@ Item { mapCircleBottomRight = itemBottomRight; itemTopLeft = preMapQuickItem.coordinate - var preMapQuickItemScreenPosition = map.toScreenPosition(preMapQuickItem.coordinate) + var preMapQuickItemScreenPosition = map.fromCoordinate(preMapQuickItem.coordinate) preMapQuickItemScreenPosition.x += preMapQuickItem.sourceItem.width preMapQuickItemScreenPosition.y += preMapQuickItem.sourceItem.height itemBottomRight = map.toCoordinate(preMapQuickItemScreenPosition) @@ -497,14 +497,14 @@ Item { function min_max_bounds_from_list(coorindates){ var i = 0 - var point = map.toScreenPosition(coorindates[0]) + var point = map.fromCoordinate(coorindates[0]) var minX = point.x var minY = point.y var maxX = point.x var maxY = point.y for (i=1; i < coorindates.length; ++i) { - point = map.toScreenPosition(coorindates[i]) + point = map.fromCoordinate(coorindates[i]) if (point.x < minX) minX = point.x if (point.x > maxX) @@ -582,7 +582,7 @@ Item { } function is_coord_on_screen(coord) { - return is_point_on_screen(map.toScreenPosition(coord)) + return is_point_on_screen(map.fromCoordinate(coord)) } function is_point_on_screen(point) { diff --git a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp index 36e7b146..3c8a5f2c 100644 --- a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp +++ b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp @@ -336,7 +336,7 @@ class tst_QGeoMapScene : public QObject mapGeometry.setVisibleTiles(ct.tiles()); QDoubleVector2D point(screenX,screenY); - QDoubleVector2D mecartorPos = mapGeometry.screenPositionToMercator(point); + QDoubleVector2D mecartorPos = mapGeometry.itemPositionToMercator(point); QCOMPARE(mecartorPos.x(),mercatorX); QCOMPARE(mecartorPos.y(),mercatorY); @@ -376,7 +376,7 @@ class tst_QGeoMapScene : public QObject mapGeometry.setVisibleTiles(ct.tiles()); QDoubleVector2D mercatorPos(mercatorX, mercatorY); - QPointF point = mapGeometry.mercatorToScreenPosition(mercatorPos).toPointF(); + QPointF point = mapGeometry.mercatorToItemPosition(mercatorPos).toPointF(); QCOMPARE(point.x(), screenX); QCOMPARE(point.y(), screenY); |