diff options
author | Liang Qi <liang.qi@qt.io> | 2017-11-20 13:17:15 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-11-20 13:17:15 +0100 |
commit | f59d205a670836cc989ab7f50567bcbb47d56c6f (patch) | |
tree | baf03e4eb316c8b34ecdac50774771414a479427 /tests | |
parent | 9920be68b52fa08ee961a312e947dcb924deeaf5 (diff) | |
parent | afc51951769ac7320a98a973bcb95a12bc970019 (diff) | |
download | qtlocation-f59d205a670836cc989ab7f50567bcbb47d56c6f.tar.gz |
Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: I9adfdf056dd04f33e9fbd01bcb2ca2ad75e95007
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative_ui/tst_map.qml | 22 | ||||
-rw-r--r-- | tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp | 6 |
2 files changed, 25 insertions, 3 deletions
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 8b101bf1..f05b2c72 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -72,6 +72,7 @@ Item { && coordinateMap.mapReady && mapTiltBearing.mapReady && mapTiltBearingHere.mapReady + && mapTestProjection.mapReady Map { id: mapZoomOnCompleted; width: 200; height: 200; zoomLevel: 3; center: coordinate1; plugin: testPlugin; @@ -113,6 +114,13 @@ Item { plugin: testPluginLazyParameter } + Map { + id: mapTestProjection + plugin: testPlugin + width: 200 + height: 200 + } + MapParameter { id: testParameter type: "cameraCenter_test" @@ -661,6 +669,20 @@ Item { coord = coordinateMap.toCoordinate(Qt.point(-5, -6)) verify(isNaN(coord.latitude)) verify(isNaN(coord.longitde)) + + // test with tilting + coord = QtPositioning.coordinate(45.6, 17.67) + var pos = mapTestProjection.fromCoordinate(coord, false) + compare(Math.floor(pos.x), 3339) + compare(Math.floor(pos.y), 1727) + mapTestProjection.tilt = 6 + pos = mapTestProjection.fromCoordinate(coord, false) + compare(Math.floor(pos.x), 11066) + compare(Math.floor(pos.y), 5577) + mapTestProjection.tilt = 12 + pos = mapTestProjection.fromCoordinate(coord, false) + verify(isNaN(pos.latitude)) + verify(isNaN(pos.longitde)) } } } diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp index e4bb755d..939225a7 100644 --- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp +++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp @@ -61,7 +61,7 @@ void QDeclarativeLocationTestModel::timerFired() repopulate(); if (crazyMode_) { //qDebug() << "raw randomw value: " << qrand(); - int delay = (QRandomGenerator::bounded(uint(INT_MAX) + 1) % crazyLevel_); // writing software is exact science + int delay = (QRandomGenerator::global()->bounded(uint(INT_MAX) + 1) % crazyLevel_); // writing software is exact science delay = qMax(1000, delay); // 3 ms at minimum qDebug() << "starting timer with : " << delay; timer_.start(delay); @@ -162,7 +162,7 @@ void QDeclarativeLocationTestModel::repopulate() } int datacount = datacount_; if (crazyMode_) - datacount = QRandomGenerator::bounded(datacount_); + datacount = QRandomGenerator::global()->bounded(datacount_); for (int i = 0; i < datacount; ++i) { DataObject* dataobject = new DataObject; @@ -204,7 +204,7 @@ void QDeclarativeLocationTestModel::scheduleRepopulation() if (crazyMode_) { // start generating arbitrary amount of data at arbitrary intervals - int delay = QRandomGenerator::bounded(crazyLevel_); // writing software is exact science + int delay = QRandomGenerator::global()->bounded(crazyLevel_); // writing software is exact science delay = qMax(3, delay); // 3 ms at minimum qDebug() << "starting timer with : " << delay; timer_.start(delay); |