summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-06-15 11:49:46 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-06-15 11:50:04 +0200
commit6a39138e0ad7ce2d679fcfc82c6267e08b0465ef (patch)
tree56ffda5f391cf6a5bbded7234192003ea47aef4a /tests
parente6d3af5d1c39925b3028542fddb062b333375045 (diff)
parentc4cfee65f4f2132ef28ace089837149b64b38e52 (diff)
downloadqtlocation-6a39138e0ad7ce2d679fcfc82c6267e08b0465ef.tar.gz
Merge branch '5.5' into dev
Change-Id: Id8b1ea1c9dc774aa6f0169c410be2c141e384da6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative_ui/tst_map_maptype.qml111
-rw-r--r--tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h6
2 files changed, 55 insertions, 62 deletions
diff --git a/tests/auto/declarative_ui/tst_map_maptype.qml b/tests/auto/declarative_ui/tst_map_maptype.qml
index 26290399..a20241fc 100644
--- a/tests/auto/declarative_ui/tst_map_maptype.qml
+++ b/tests/auto/declarative_ui/tst_map_maptype.qml
@@ -33,78 +33,65 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
+import QtLocation 5.5
-TestCase {
- id: testCase
+Item{
+ id: page
+ x: 0; y: 0;
+ width: 100
+ height: 100
- name: "MapType"
+ Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true }
+ Map { id: map; anchors.fill: parent }
+ SignalSpy { id: supportedMapTypesSpy; target: map; signalName: "supportedMapTypesChanged" }
+ SignalSpy { id: activeMapTypeChangedSpy; target: map; signalName: "activeMapTypeChanged" }
- Plugin {
- id: herePlugin
- name: "here"
- parameters: [
- PluginParameter {
- name: "here.app_id"
- value: "stub"
- },
- PluginParameter {
- name: "here.token"
- value: "stub"
- }
- ]
- }
+ TestCase {
+ id: testCase
+ name: "MapType"
+ when: windowShown
- Map {
- id: map;
- plugin: herePlugin
- center {
- latitude: 62.240501
- longitude: 25.757014
+ function initTestCase()
+ {
+ compare(map.supportedMapTypes.length, 0)
+ compare(map.activeMapType.style, MapType.NoMap)
+ map.plugin = testPlugin
+ tryCompare(supportedMapTypesSpy, "count", 1)
+ compare(map.supportedMapTypes.length,3)
+ compare(map.supportedMapTypes[0].style, MapType.StreetMap)
+ compare(map.supportedMapTypes[0].name, "StreetMap")
+ compare(map.supportedMapTypes[0].description, "StreetMap")
+ compare(map.supportedMapTypes[1].style, MapType.SatelliteMapDay)
+ compare(map.supportedMapTypes[1].name, "SatelliteMapDay")
+ compare(map.supportedMapTypes[1].description, "SatelliteMapDay")
+ compare(map.supportedMapTypes[2].style, MapType.CycleMap)
+ compare(map.supportedMapTypes[2].name, "CycleMap")
+ compare(map.supportedMapTypes[2].description, "CycleMap")
+ //default
+ compare(map.activeMapType.style, MapType.StreetMap)
}
- width: 100
- height: 100
- }
- SignalSpy {id: supportedSetSpy; target: map; signalName: "supportedMapTypesChanged"}
- SignalSpy {id: activeMapTypeChangedSpy; target: map; signalName: "activeMapTypeChanged"}
-
- function initTestCase() {
- if (map.supportedMapTypes.length == 0 && supportedSetSpy.count == 0) {
- wait(1000)
- if (supportedSetSpy.count == 0)
- wait(2000)
- compare(supportedSetSpy.count, 1,
- "supportedMapTypesChanged signal didn't arrive")
+ function init()
+ {
+ supportedMapTypesSpy.clear()
+ activeMapTypeChangedSpy.clear()
+ map.activeMapType = map.supportedMapTypes[0]
}
- }
- function test_supported_types() {
- var count = map.supportedMapTypes.length
- console.log('Number of supported map types: ' + count)
-
- console.log('Supported map types:')
- for (var i = 0; i < count; i++) {
- console.log('style: ' + map.supportedMapTypes[i].style
- + ', name: ' + map.supportedMapTypes[i].name
- + ', desc: ' + map.supportedMapTypes[i].description
- + ', mobile: ' + map.supportedMapTypes[i].mobile)
- }
- }
+ function test_setting_types()
+ {
+ map.activeMapType = map.supportedMapTypes[0]
+ tryCompare(activeMapTypeChangedSpy, "count", 0)
- function test_setting_types() {
- var count = map.supportedMapTypes.length
- console.log('Number of supported map types: '
- + map.supportedMapTypes.length)
+ map.activeMapType = map.supportedMapTypes[1]
+ tryCompare(activeMapTypeChangedSpy, "count", 1)
+ compare(map.supportedMapTypes[1].name, map.activeMapType.name)
+ compare(map.supportedMapTypes[1].style, map.activeMapType.style)
- activeMapTypeChangedSpy.clear();
- for (var i = 0; i < count; i++) {
- console.log('setting ' + map.supportedMapTypes[i].name)
- map.activeMapType = map.supportedMapTypes[i]
- compare(map.supportedMapTypes[i].name, map.activeMapType.name,
- "Error setting the active maptype (or getting it after)")
+ map.activeMapType = map.supportedMapTypes[2]
+ tryCompare(activeMapTypeChangedSpy, "count", 2)
+ compare(map.supportedMapTypes[2].name, map.activeMapType.name)
+ compare(map.supportedMapTypes[2].style, map.activeMapType.style)
}
- console.log('change count: ' + activeMapTypeChangedSpy.count)
- compare(activeMapTypeChangedSpy.count, count)
}
}
diff --git a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h
index 3751a845..2750dfea 100644
--- a/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeotiledmappingmanagerengine_test.h
@@ -66,6 +66,12 @@ public:
setTileSize(QSize(256, 256));
+ QList<QGeoMapType> mapTypes;
+ mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("StreetMap"), tr("StreetMap"), false, false, 1);
+ mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("SatelliteMapDay"), tr("SatelliteMapDay"), false, false, 2);
+ mapTypes << QGeoMapType(QGeoMapType::CycleMap, tr("CycleMap"), tr("CycleMap"), false, false, 3);
+ setSupportedMapTypes(mapTypes);
+
QGeoTileFetcherTest *fetcher = new QGeoTileFetcherTest(this);
fetcher->setParams(parameters);
fetcher->setTileSize(QSize(256, 255));