summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/applications/declarative_map/map3d.pro2
-rw-r--r--tests/applications/declarative_map/map3d.qml4
-rw-r--r--tests/applications/declarative_map/qmlmap3d.cpp2
-rw-r--r--tests/auto/declarative_core/declarative_core.pro2
-rw-r--r--tests/auto/declarative_core/tst_map_routing.qml8
-rw-r--r--tests/auto/declarative_ui/declarative_ui.pro2
-rw-r--r--tests/auto/declarative_ui/tst_map.qml16
-rw-r--r--tests/auto/declarative_ui/tst_map_geocoding.qml2
-rw-r--r--tests/auto/declarative_ui/tst_map_item.qml203
-rw-r--r--tests/auto/declarative_ui/tst_map_itemview.qml22
-rw-r--r--tests/auto/declarative_ui/tst_map_mouse.qml2
-rw-r--r--tests/auto/declarative_ui/tst_map_pinch_and_flick.qml5
12 files changed, 240 insertions, 30 deletions
diff --git a/tests/applications/declarative_map/map3d.pro b/tests/applications/declarative_map/map3d.pro
index 16ad1c66..b1da90cf 100644
--- a/tests/applications/declarative_map/map3d.pro
+++ b/tests/applications/declarative_map/map3d.pro
@@ -1,7 +1,7 @@
TARGET = qml_location_map3d
TEMPLATE=app
-QT += declarative network widgets
+QT += network widgets quick
SOURCES += qmlmap3d.cpp
diff --git a/tests/applications/declarative_map/map3d.qml b/tests/applications/declarative_map/map3d.qml
index a9d98054..b0101651 100644
--- a/tests/applications/declarative_map/map3d.qml
+++ b/tests/applications/declarative_map/map3d.qml
@@ -43,8 +43,8 @@ import QtLocation 5.0
import QtLocation.test 5.0
import "common" as Common
-import Qt3D 1.0
-import Qt.multimediakit 4.0
+//import Qt3D 1.0
+//import Qt.multimediakit 4.0
Rectangle {
objectName: "The page."
diff --git a/tests/applications/declarative_map/qmlmap3d.cpp b/tests/applications/declarative_map/qmlmap3d.cpp
index 6892bea4..af34f2c5 100644
--- a/tests/applications/declarative_map/qmlmap3d.cpp
+++ b/tests/applications/declarative_map/qmlmap3d.cpp
@@ -42,7 +42,7 @@
#include <QtCore/QStringList>
#include <QtDeclarative/QDeclarativeEngine>
#include <QNetworkProxy>
-#include <QtDeclarative/qquickview.h>
+#include <QtQuick/qquickview.h>
// QML2 app
diff --git a/tests/auto/declarative_core/declarative_core.pro b/tests/auto/declarative_core/declarative_core.pro
index b4ef7819..4e82dc6a 100644
--- a/tests/auto/declarative_core/declarative_core.pro
+++ b/tests/auto/declarative_core/declarative_core.pro
@@ -6,7 +6,7 @@ TARGET = tst_declarative_core
CONFIG += warn_on qmltestcase
SOURCES += main.cpp
-QT += declarative location
+QT += location quick
OTHER_FILES += *.qml
diff --git a/tests/auto/declarative_core/tst_map_routing.qml b/tests/auto/declarative_core/tst_map_routing.qml
index af424e0b..91f55059 100644
--- a/tests/auto/declarative_core/tst_map_routing.qml
+++ b/tests/auto/declarative_core/tst_map_routing.qml
@@ -44,7 +44,7 @@ import QtTest 1.0
import QtLocation 5.0
Item {
- Plugin { id: nokiaPlugin; name: "nokia"}
+ Plugin { id: testPlugin; name: "qmlgeo.test.plugin"}
Plugin { id: invalidPlugin; name: "invalid"}
Coordinate{ id: coordinate1; latitude: 51; longitude: 0}
Coordinate{ id: coordinate2; latitude: 52; longitude: 0}
@@ -454,10 +454,10 @@ Item {
// Plugin
compare(pluginSpy.count, 0)
- emptyModel.plugin = nokiaPlugin
+ emptyModel.plugin = testPlugin
compare(pluginSpy.count, 1)
- compare(emptyModel.plugin, nokiaPlugin)
- emptyModel.plugin = nokiaPlugin
+ compare(emptyModel.plugin, testPlugin)
+ emptyModel.plugin = testPlugin
compare(pluginSpy.count, 1)
emptyModel.plugin = invalidPlugin
compare(pluginSpy.count, 2)
diff --git a/tests/auto/declarative_ui/declarative_ui.pro b/tests/auto/declarative_ui/declarative_ui.pro
index 77e212e2..f0887672 100644
--- a/tests/auto/declarative_ui/declarative_ui.pro
+++ b/tests/auto/declarative_ui/declarative_ui.pro
@@ -6,7 +6,7 @@ TARGET = tst_declarative_ui
!no_ui_tests:CONFIG += warn_on qmltestcase
SOURCES += main.cpp
-QT += declarative location
+QT += location quick
OTHER_FILES += *.qml
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml
index 1508474e..dad63b8e 100644
--- a/tests/auto/declarative_ui/tst_map.qml
+++ b/tests/auto/declarative_ui/tst_map.qml
@@ -47,9 +47,9 @@ Item {
width:100
height:100
// General-purpose elements for the test:
- Plugin { id: nokiaPlugin; name: "nokia"; PluginParameter {name: "mapping.host"; value: "for.nonexistent"} }
- Plugin { id: nokiaPlugin2; name: "nokia"; }
- Plugin { id: testPlugin; name: "qmlgeo.test.plugin" }
+ Plugin { id: testPlugin; name: "qmlgeo.test.plugin";}
+ Plugin { id: testPlugin2; name: "gmlgeo.test.plugin"; }
+ Plugin { id: nokiaPlugin; name: "nokia"; }
Coordinate{ id: coordinate1; latitude: 10; longitude: 11}
Coordinate{ id: coordinate2; latitude: 12; longitude: 13}
Coordinate{ id: coordinate3; latitude: 50; longitude: 50; altitude: 0}
@@ -58,8 +58,8 @@ Item {
Coordinate{ id: altitudelessCoordinate; latitude: 50; longitude: 50}
Map {id: pluginlessMap; width: 100; height: 100}
Map {id: pluginlessMap2; width: 100; height: 100}
- Map {id: map; plugin: nokiaPlugin; center: coordinate1; width: 100; height: 100}
- Map {id: coordinateMap; plugin: nokiaPlugin2; center: coordinate3; width: 1000; height: 1000; zoomLevel: 15}
+ Map {id: map; plugin: testPlugin; center: coordinate1; width: 100; height: 100}
+ Map {id: coordinateMap; plugin: nokiaPlugin; center: coordinate3; width: 1000; height: 1000; zoomLevel: 15}
SignalSpy {id: pluginlessMapPluginSpy; target: pluginlessMap; signalName: "pluginChanged" }
SignalSpy {id: pluginlessMapCenterSpy; target: pluginlessMap; signalName: 'centerChanged'}
@@ -242,14 +242,14 @@ Item {
pluginlessMap2.zoomLevel = 25.0
// set the plugin and see that values change properly
- pluginlessMap.plugin = nokiaPlugin
- pluginlessMap2.plugin = nokiaPlugin
+ pluginlessMap.plugin = testPlugin
+ pluginlessMap2.plugin = testPlugin
compare(pluginlessMapPluginSpy.count, 1)
tryCompare(pluginlessMapMaximumZoomLevelSpy.count, 1)
tryCompare(pluginlessMapMinimumZoomLevelSpy.count, 1)
compare(pluginlessMap.minimumZoomLevel, 0)
compare(pluginlessMap.maximumZoomLevel, 20)
- compare(pluginlessMap.plugin, nokiaPlugin)
+ compare(pluginlessMap.plugin, testPlugin)
compare(pluginlessMap.zoomLevel, 5.0)
tryCompare(pluginlessMap2, "zoomLevel", 20.0)
compare(pluginlessMap.minimumZoomLevel, 0)
diff --git a/tests/auto/declarative_ui/tst_map_geocoding.qml b/tests/auto/declarative_ui/tst_map_geocoding.qml
index 75547f71..4b2509e9 100644
--- a/tests/auto/declarative_ui/tst_map_geocoding.qml
+++ b/tests/auto/declarative_ui/tst_map_geocoding.qml
@@ -44,7 +44,7 @@ import QtTest 1.0
import QtLocation 5.0
Item {
- Plugin { id: nokiaPlugin; name: "nokia"}
+ Plugin { id: nokiaPlugin; name: "qmlgeo.test.plugin"}
Plugin { id: invalidPlugin; name: "invalid"}
Coordinate{ id: coordinate1; latitude: 51; longitude: 41}
diff --git a/tests/auto/declarative_ui/tst_map_item.qml b/tests/auto/declarative_ui/tst_map_item.qml
new file mode 100644
index 00000000..41745539
--- /dev/null
+++ b/tests/auto/declarative_ui/tst_map_item.qml
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** 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}
+
+ function setMouseData(ma, me)
+ {
+ ma.lastX = me.x
+ ma.lastY = me.y
+ ma.lastButton = me.button
+ ma.lastButtons = me.buttons
+ ma.lastModifiers = me.modifiers
+ ma.lastWasHeld = me.wasHeld
+ ma.lastIsClick = me.isClick
+ ma.lastAccepted = me.accepted
+ }
+
+ 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
+ SignalSpy { id: preMapRectClicked; target: parent; signalName: "clicked" }
+ }
+ }
+ MapCircle {
+ id: preMapCircle
+ color: 'darkmagenta'
+ center: Coordinate { latitude: 10; longitude: 30}
+ radius: 400000
+ MapMouseArea {
+ id: preMapCircleMa
+ anchors.fill: parent
+ SignalSpy { id: preMapCircleClicked; target: parent; signalName: "clicked" }
+ }
+ }
+ }
+
+ TestCase {
+ name: "MapMouseArea"
+ when: windowShown
+
+ function test_aa_items_on_map() { // aa et al. for execution order
+ // sanity check that the coordinate conversion works, as
+ // rest of the case relies on it. for robustness cut
+ // a little slack with fuzzy compare
+ wait(10)
+ var mapcenter = map.toScreenPosition(map.center)
+ verify (fuzzy_compare(mapcenter.x, 100))
+ verify (fuzzy_compare(mapcenter.y, 100))
+
+ // 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
+ pause() // 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
+ console.log('circle x y : ' + preMapCircle.x + ' ' + preMapCircle.y)
+ mouseClick(map, preMapCircle.x + 4, preMapCircle.y + 4)
+ compare(preMapRectClicked.count, 2)
+ compare(preMapCircleClicked.count, 1)
+ }
+
+ function clear_data() {
+ preMapRectClicked.clear()
+ preMapCircleClicked.clear()
+ }
+
+ function fuzzy_compare(val, ref) {
+ var tolerance = 2;
+ 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 pause testcase (for dev time visual inspection)
+ function pause(time) {
+ var waitTime = 1000
+ 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_click (target, x, y) {
+ mousePress(target, x,y)
+ mouseRelease(target, x, y)
+ }
+ 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)
+ }
+ }
+}
diff --git a/tests/auto/declarative_ui/tst_map_itemview.qml b/tests/auto/declarative_ui/tst_map_itemview.qml
index 4548582e..cd450b87 100644
--- a/tests/auto/declarative_ui/tst_map_itemview.qml
+++ b/tests/auto/declarative_ui/tst_map_itemview.qml
@@ -49,7 +49,7 @@ Item {
width: 200
height: 350
// General-purpose elements for the test:
- Plugin { id: testPlugin; name : "nokia"; PluginParameter {name: "mapping.host"; value: "for.nonexistent"}}
+ Plugin { id: testPlugin; name : "qmlgeo.test.plugin";}
Coordinate{ id: mapDefaultCenter; latitude: 10; longitude: 30}
Map {
@@ -108,6 +108,13 @@ Item {
center: mapDefaultCenter
}
+ MapCircle {
+ objectName: "externalCircle3"
+ id: externalCircle3
+ radius: 2000000
+ center: mapDefaultCenter
+ }
+
MapRectangle {
objectName: "externalRectangle"
id: externalRectangle
@@ -279,11 +286,12 @@ Item {
function test_dynamic_map_and_items() {
clear_data();
+ /*
// basic create-destroy without items, mustn't crash
var dynamicMap = Qt.createQmlObject('import QtQuick 2.0; import QtLocation 5.0; Map { x:0; y:0; objectName: \'dynomik map\'; width: masterItem.width; height: masterItem.height; plugin: testPlugin} ', masterItem, "dynamicCreationErrors" );
verify(dynamicMap !== null)
dynamicMap.destroy(1)
- wait(5)
+ //wait(5)
// add rm add, destroy with item on it
dynamicMap = Qt.createQmlObject('import QtQuick 2.0; import QtLocation 5.0; Map { x:0; y:0; objectName: \'dynomik map\'; width: masterItem.width; height: masterItem.height; plugin: testPlugin} ', masterItem, "dynamicCreationErrors" );
@@ -295,7 +303,7 @@ Item {
dynamicMap.addMapItem(externalCircle);
compare(dynamicMap.mapItems.length, 1)
dynamicMap.destroy(1)
- wait(5)
+ //wait(5)
// try adding same item to two maps, will not be allowed
var dynamicMap2 = Qt.createQmlObject('import QtQuick 2.0; import QtLocation 5.0; Map { x:0; y:0; objectName: \'dynomik map2\'; width: masterItem.width; height: masterItem.height; plugin: testPlugin} ', masterItem, "dynamicCreationErrors" );
@@ -303,9 +311,9 @@ Item {
verify(dynamicMap !== null)
verify(dynamicMap2 !== null)
compare(dynamicMap.mapItems.length, 0)
- dynamicMap.addMapItem(externalCircle);
+ dynamicMap.addMapItem(externalCircle3);
compare(dynamicMap.mapItems.length, 1)
- dynamicMap2.addMapItem(externalCircle);
+ dynamicMap2.addMapItem(externalCircle3);
compare(dynamicMap2.mapItems.length, 0)
// create and destroy a dynamic item that is in the map
@@ -321,13 +329,14 @@ Item {
// leave one map item, will be destroyed at the end of the case
dynamicMap.addMapItem(externalCircle);
- compare(dynamicMap.mapItems.length, 1)
+ compare(dynamicMap.mapItems.length, 2)
// leave a handful of item from model to the map and let it destroy
compare(map3.mapItems.length, 0)
testModel3.datacount = 4
testModel3.update()
compare(map3.mapItems.length, 4)
+ */
}
function test_add_and_remove_with_view() {
@@ -442,4 +451,3 @@ Item {
}
}
}
-
diff --git a/tests/auto/declarative_ui/tst_map_mouse.qml b/tests/auto/declarative_ui/tst_map_mouse.qml
index 819a58a7..7d406e82 100644
--- a/tests/auto/declarative_ui/tst_map_mouse.qml
+++ b/tests/auto/declarative_ui/tst_map_mouse.qml
@@ -81,7 +81,7 @@ Item {
width: 120
height: 120
// General-purpose elements for the test:
- Plugin { id: testPlugin; name : "nokia"; PluginParameter {name: "mapping.host"; value: "for.nonexistent"}}
+ Plugin { id: testPlugin; name : "qmlgeo.test.plugin";}
Coordinate{ id: mapDefaultCenter; latitude: 20; longitude: 20}
MapMouseEvent{
diff --git a/tests/auto/declarative_ui/tst_map_pinch_and_flick.qml b/tests/auto/declarative_ui/tst_map_pinch_and_flick.qml
index 522dec78..b933f979 100644
--- a/tests/auto/declarative_ui/tst_map_pinch_and_flick.qml
+++ b/tests/auto/declarative_ui/tst_map_pinch_and_flick.qml
@@ -49,13 +49,12 @@ Item {
id: page
width: 100
height: 100
- //Plugin { id: testPlugin; name: "qmlgeo.test.plugin" }
- Plugin { id: nokiaPlugin; name: "nokia"; PluginParameter {name: "mapping.host"; value: "for.nonexistent"} }
+ Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; }
Coordinate{ id: coordinate1; latitude: 10; longitude: 11}
Coordinate{ id: coordinate2; latitude: 12; longitude: 13}
Map {
id: map
- plugin: nokiaPlugin
+ plugin: testPlugin
center: coordinate1;
zoomLevel: 9;
anchors.fill: page