diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-06-10 11:07:50 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-06-15 13:19:30 +0000 |
commit | 2b101cabae9a00519e8d048e5add2abb6e8524cc (patch) | |
tree | 74c46b84ee134253091bca1376fb22de1aa5ae6f /tests | |
parent | 6a39138e0ad7ce2d679fcfc82c6267e08b0465ef (diff) | |
download | qtlocation-2b101cabae9a00519e8d048e5add2abb6e8524cc.tar.gz |
Small cleanup of _ui qml unit tests
Fix version numbers across test files, fix formating and
remove useless debug
Change-Id: Ib7721716a5e270a32c7620d087d9c2982a61fa59
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
9 files changed, 61 insertions, 55 deletions
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 7b485256..7794cac4 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -33,8 +33,8 @@ import QtQuick 2.0 import QtTest 1.0 -import QtLocation 5.3 -import QtPositioning 5.2 +import QtLocation 5.5 +import QtPositioning 5.5 Item { width:100 @@ -44,15 +44,15 @@ Item { Plugin { id: testPlugin2; name: "gmlgeo.test.plugin"; allowExperimental: true } Plugin { id: herePlugin; name: "here"; parameters: [ - PluginParameter { - name: "here.app_id" - value: "stub" - }, - PluginParameter { - name: "here.token" - value: "stub" - } - ] + PluginParameter { + name: "here.app_id" + value: "stub" + }, + PluginParameter { + name: "here.token" + value: "stub" + } + ] } property variant coordinate1: QtPositioning.coordinate(10, 11) @@ -64,12 +64,12 @@ Item { property variant altitudelessCoordinate: QtPositioning.coordinate(50, 50) Map { id: mapZoomOnCompleted; width: 200; height: 200; - zoomLevel: 3; center: coordinate1; plugin: testPlugin; - Component.onCompleted: { zoomLevel = 7 } } + zoomLevel: 3; center: coordinate1; plugin: testPlugin; + Component.onCompleted: { zoomLevel = 7 } } Map { id: mapZoomDefault; width: 200; height: 200; - center: coordinate1; plugin: testPlugin; } + center: coordinate1; plugin: testPlugin; } Map { id: mapZoomUserInit; width: 200; height: 200; - zoomLevel: 4; center: coordinate1; plugin: testPlugin; } + 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} @@ -78,7 +78,7 @@ Item { TestCase { when: windowShown - name: "Basic Map properties" + name: "MapProperties" function fuzzy_compare(val, ref) { var tolerance = 0.01; @@ -88,9 +88,11 @@ Item { return false; } - function test_map_center() { + function init() { mapCenterSpy.clear(); + } + function test_map_center() { // coordinate is set at map element declaration compare(map.center.latitude, 10) compare(map.center.longitude, 11) @@ -117,7 +119,8 @@ Item { compare(map.center.latitude, 12) } - function test_zoom_limits() { + function test_zoom_limits() + { map.center.latitude = 30 map.center.longitude = 60 map.zoomLevel = 4 @@ -156,7 +159,8 @@ Item { compare(map.maximumZoomLevel, 20) } - function test_zoom() { + function test_zoom() + { wait(100) compare(mapZoomOnCompleted.zoomLevel, 7) compare(mapZoomDefault.zoomLevel, 8) @@ -168,7 +172,8 @@ Item { } - function test_pan() { + function test_pan() + { map.center.latitude = 30 map.center.longitude = 60 map.zoomLevel = 4 @@ -250,7 +255,8 @@ Item { mapCenterSpy.clear() } - function test_coordinate_conversion() { + function test_coordinate_conversion() + { wait(1000) mapCenterSpy.clear(); compare(coordinateMap.center.latitude, 50) diff --git a/tests/auto/declarative_ui/tst_map_coordinateanimation.qml b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml index e9614f6b..b297e619 100644 --- a/tests/auto/declarative_ui/tst_map_coordinateanimation.qml +++ b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml @@ -33,8 +33,8 @@ import QtQuick 2.0 import QtTest 1.0 -import QtLocation 5.3 -import QtPositioning 5.3 +import QtLocation 5.5 +import QtPositioning 5.5 Item { width:100 @@ -54,7 +54,6 @@ Item { Behavior on center { id: centerBehavior - enabled: false CoordinateAnimation { duration: animationDuration } } @@ -83,7 +82,7 @@ Item { TestCase { when: windowShown - name: "Coordinate animation" + name: "CoordinateAnimation" function test_coordinate_animation() { diff --git a/tests/auto/declarative_ui/tst_map_error.qml b/tests/auto/declarative_ui/tst_map_error.qml index 1c5f4342..6a70cade 100644 --- a/tests/auto/declarative_ui/tst_map_error.qml +++ b/tests/auto/declarative_ui/tst_map_error.qml @@ -35,20 +35,16 @@ import QtQuick 2.0 import QtTest 1.0 import QtLocation 5.5 import QtPositioning 5.5 -import QtLocation.test 5.0 - Item { id: page x: 0; y: 0; width: 200 height: 100 - property variant coordinate: QtPositioning.coordinate(20, 20) - Plugin { id: errorPlugin; - name: "qmlgeo.test.plugin" - allowExperimental: true + Plugin { + id: errorPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true parameters: [ PluginParameter { name: "error"; value: "1"}, PluginParameter { name: "errorString"; value: "This error was expected. No worries !"} @@ -98,7 +94,8 @@ Item { map_no_plugin.mouseClickedSpy.clear() } - function map_clicked(map) { + function map_clicked(map) + { mouseClick(map, 5, 5) mouseClick(map, 50, 50) mouseClick(map, 50, 50) @@ -106,15 +103,18 @@ Item { compare(map.mouseClickedSpy.count, 3) } - function test_map_clicked_wiht_no_plugin() { + function test_map_clicked_wiht_no_plugin() + { map_clicked(map_no_plugin) } - function test_map_clicked_with_error_plugin() { + function test_map_clicked_with_error_plugin() + { map_clicked(map_error_plugin) } - function test_map_no_supportedMapTypes() { + function test_map_no_supportedMapTypes() + { compare(map_no_plugin.supportedMapTypes.length , 0) compare(map_error_plugin.supportedMapTypes.length , 0) } @@ -210,5 +210,13 @@ Item { verify(map_error_plugin.center != coordinate) verify(map_no_plugin.visibleRegion == QtPositioning.circle(coordinate,1000)) } + + function test_map_activeMapType() + { + compare(map_no_plugin.supportedMapTypes.length, 0) + compare(map_no_plugin.activeMapType.style, MapType.NoMap) + compare(map_error_plugin.supportedMapTypes.length, 0) + compare(map_error_plugin.activeMapType.style, MapType.NoMap) + } } } diff --git a/tests/auto/declarative_ui/tst_map_flick.qml b/tests/auto/declarative_ui/tst_map_flick.qml index 27623b57..04814566 100644 --- a/tests/auto/declarative_ui/tst_map_flick.qml +++ b/tests/auto/declarative_ui/tst_map_flick.qml @@ -35,7 +35,6 @@ import QtQuick 2.5 import QtTest 1.0 import QtLocation 5.5 import QtPositioning 5.5 -import QtLocation.test 5.0 Item { // General-purpose elements for the test: diff --git a/tests/auto/declarative_ui/tst_map_item.qml b/tests/auto/declarative_ui/tst_map_item.qml index 8aeb8108..b0615f4f 100644 --- a/tests/auto/declarative_ui/tst_map_item.qml +++ b/tests/auto/declarative_ui/tst_map_item.qml @@ -33,9 +33,8 @@ import QtQuick 2.0 import QtTest 1.0 -import QtLocation 5.3 -import QtLocation.test 5.0 -import QtPositioning 5.0 +import QtLocation 5.5 +import QtPositioning 5.5 /* @@ -238,7 +237,7 @@ Item { } } TestCase { - name: "Map Items" + name: "MapItems" when: windowShown function test_aa_items_on_map() { // aa et al. for execution order diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml index baa31a77..f6fcca4b 100644 --- a/tests/auto/declarative_ui/tst_map_item_details.qml +++ b/tests/auto/declarative_ui/tst_map_item_details.qml @@ -33,9 +33,8 @@ import QtQuick 2.0 import QtTest 1.0 -import QtPositioning 5.0 -import QtLocation 5.3 -import QtLocation.test 5.0 +import QtPositioning 5.5 +import QtLocation 5.5 Item { id: page @@ -279,7 +278,7 @@ Item { Text {id: progressText} TestCase { - name: "Map Item 2" + name: "MapItemDeatils" when: windowShown /* 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 5a992fe7..edeee734 100644 --- a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml +++ b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml @@ -224,7 +224,7 @@ Item { } TestCase { - name: "Map Items Fit Viewport" + name: "MapItemsFitViewport" when: windowShown function test_aa_visible_basic() { // aa et al. for execution order diff --git a/tests/auto/declarative_ui/tst_map_mouse.qml b/tests/auto/declarative_ui/tst_map_mouse.qml index 9db57c1e..aa595a28 100644 --- a/tests/auto/declarative_ui/tst_map_mouse.qml +++ b/tests/auto/declarative_ui/tst_map_mouse.qml @@ -33,9 +33,8 @@ import QtQuick 2.0 import QtTest 1.0 -import QtLocation 5.3 -import QtPositioning 5.2 -import QtLocation.test 5.0 +import QtLocation 5.5 +import QtPositioning 5.5 /* MouseArea setup for this test case. @@ -554,10 +553,10 @@ Item { compare(mouseLowerClickedSpy.count, 0) compare(mouseOverlapperClickedSpy.count, 0) mouseUpper.acceptedButtons = Qt.LeftButton | Qt.RightButton - console.log('TC sending click event to upper mouse area 5,25') + // TC sending click event to upper mouse area 5,25 mouseClick(map, 5, 25, Qt.RightButton, Qt.AltModifier) tryCompare(mouseUpperClickedSpy, "count", 1) - console.log('TC done and clicked was received') + // TC done and clicked was received //compare(mouseUpperClickedSpy.count, 1) compare(mouseLowerClickedSpy.count, 0) compare(mouseOverlapperClickedSpy.count, 0) diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp index 9e1757bc..f0b03746 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp +++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp @@ -169,8 +169,6 @@ void QDeclarativeLocationTestModel::repopulate() if (crazyMode_) datacount = (qAbs(qrand()) % datacount_); - qDebug() << "generating random content: " << datacount; - for (int i = 0; i < datacount; ++i) { DataObject* dataobject = new DataObject; dataobject->coordinate_ = QGeoCoordinate(latitude, longitude); @@ -202,10 +200,9 @@ void QDeclarativeLocationTestModel::scheduleRepopulation() { if (!componentCompleted_) return; - if (datacount_ <= 0) { - qDebug() << __FUNCTION__ << "won't schedule model, invalid datacount: " << datacount_; + + if (datacount_ <= 0) return; - } if (timer_.isActive()) timer_.stop(); |