summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-03-09 10:44:30 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-03-09 13:40:00 -0800
commit7cceca4b4576c21c315b445889bad770e7dc4e53 (patch)
treeb0e749be86ed3e56081d44e05f0516574bb0ebdd /test
parentbe00dfd3679902870ada89d606e2eed88ce586b1 (diff)
downloadqtlocation-mapboxgl-7cceca4b4576c21c315b445889bad770e7dc4e53.tar.gz
[core] Deactivate OfflineDownload when the tile count limit is hit
This is a better behavior than sending hundreds or thousands of tileCountLimitExceeded notifications.
Diffstat (limited to 'test')
-rw-r--r--test/storage/offline_download.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/storage/offline_download.cpp b/test/storage/offline_download.cpp
index da0b1ac0ee..1b35d561be 100644
--- a/test/storage/offline_download.cpp
+++ b/test/storage/offline_download.cpp
@@ -371,10 +371,22 @@ TEST(OfflineDownload, TileCountLimitExceeded) {
};
auto observer = std::make_unique<MockObserver>();
+ bool mapboxTileCountLimitExceededCalled = false;
observer->mapboxTileCountLimitExceededFn = [&] (uint64_t limit) {
+ EXPECT_FALSE(mapboxTileCountLimitExceededCalled);
EXPECT_EQ(0, limit);
- test.loop.stop();
+ mapboxTileCountLimitExceededCalled = true;
+ };
+
+ observer->statusChangedFn = [&] (OfflineRegionStatus status) {
+ EXPECT_FALSE(status.complete());
+ if (!mapboxTileCountLimitExceededCalled) {
+ EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState);
+ } else {
+ EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState);
+ test.loop.stop();
+ }
};
download.setObserver(std::move(observer));