Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Do not call update() asynchronously on the test case
Browse files Browse the repository at this point in the history
We need to call it before checking if the tiles are loaded
to give the Source a chance to request for more tiles if
it is needed.
  • Loading branch information
tmpsantos committed Jun 2, 2015
1 parent 5c4c664 commit d746506
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/style/resource_loading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class MockMapContext : public Style::Observer {
: env_(fileSource),
envScope_(env_, ThreadType::Map, "Map"),
data_(view, MapMode::Still),
asyncUpdate(std::make_unique<uv::async>(loop, [this] { update(); })),
callback_(callback) {
asyncUpdate->unref();

data_.transform.resize(1000, 1000, 1.0, 1000, 1000);
data_.transform.setLatLngZoom({0, 0}, 16);
Expand All @@ -55,11 +53,11 @@ class MockMapContext : public Style::Observer {

// Style::Observer implementation.
void onTileDataChanged() override {
update();

if (style_->isLoaded()) {
callback_(nullptr);
}

asyncUpdate->send();
};

void onResourceLoadingFailed(std::exception_ptr error) override {
Expand All @@ -76,8 +74,6 @@ class MockMapContext : public Style::Observer {

std::unique_ptr<Style> style_;

std::unique_ptr<uv::async> asyncUpdate;

std::function<void(std::exception_ptr error)> callback_;
};

Expand Down

0 comments on commit d746506

Please sign in to comment.