summaryrefslogtreecommitdiff
path: root/test/style
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2015-11-13 17:47:22 +0200
committerThiago Marcos P. Santos <thiago@mapbox.com>2015-12-01 11:49:02 +0200
commitcb06526b10d9ef44b3606c36aec498822884251e (patch)
tree822be48cb08a3cb51074689fbef4f92578a556ed /test/style
parentae3f1c79faa34337628d671d071a82ac97a66081 (diff)
downloadqtlocation-mapboxgl-cb06526b10d9ef44b3606c36aec498822884251e.tar.gz
[tests] Remove libuv dependency from the tests
Diffstat (limited to 'test/style')
-rw-r--r--test/style/glyph_store.cpp9
-rw-r--r--test/style/pending_resources.cpp8
-rw-r--r--test/style/resource_loading.cpp4
3 files changed, 11 insertions, 10 deletions
diff --git a/test/style/glyph_store.cpp b/test/style/glyph_store.cpp
index fe614e8c60..8d7c2aeefa 100644
--- a/test/style/glyph_store.cpp
+++ b/test/style/glyph_store.cpp
@@ -4,6 +4,7 @@
#include <mbgl/text/font_stack.hpp>
#include <mbgl/text/glyph_store.hpp>
+#include <mbgl/util/async_task.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/thread.hpp>
@@ -53,9 +54,9 @@ private:
class GlyphStoreTest : public testing::Test {
protected:
void runTest(const GlyphStoreParams& params, FileSource* fileSource, GlyphStoreTestCallback callback) {
- util::RunLoop loop(uv_default_loop());
+ util::RunLoop loop;
- async_ = std::make_unique<uv::async>(loop.get(), [&]{ loop.stop(); });
+ async_ = std::make_unique<util::AsyncTask>([&]{ loop.stop(); });
async_->unref();
const util::ThreadContext context = {"Map", util::ThreadType::Map, util::ThreadPriority::Regular};
@@ -63,7 +64,7 @@ protected:
util::Thread<GlyphStoreThread> tester(context, fileSource, callback);
tester.invoke(&GlyphStoreThread::loadGlyphStore, params);
- uv_run(loop.get(), UV_RUN_DEFAULT);
+ loop.run();
tester.invoke(&GlyphStoreThread::unloadGlyphStore);
}
@@ -80,7 +81,7 @@ protected:
private:
bool testDone = false;
- std::unique_ptr<uv::async> async_;
+ std::unique_ptr<util::AsyncTask> async_;
};
TEST_F(GlyphStoreTest, LoadingSuccess) {
diff --git a/test/style/pending_resources.cpp b/test/style/pending_resources.cpp
index 81452ffc7e..7f665e85e2 100644
--- a/test/style/pending_resources.cpp
+++ b/test/style/pending_resources.cpp
@@ -5,9 +5,9 @@
#include <mbgl/map/map.hpp>
#include <mbgl/platform/default/headless_display.hpp>
#include <mbgl/platform/default/headless_view.hpp>
+#include <mbgl/util/async_task.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/uv_detail.hpp>
using namespace mbgl;
@@ -20,7 +20,7 @@ class PendingResources : public ::testing::TestWithParam<std::string> {
// the Map object after that. The idea here is to test if these pending requests
// are getting canceled correctly if on shutdown.
TEST_P(PendingResources, DeleteMapObjectWithPendingRequest) {
- util::RunLoop loop(uv_default_loop());
+ util::RunLoop loop;
auto display = std::make_shared<mbgl::HeadlessDisplay>();
HeadlessView view(display, 1, 1000, 1000);
@@ -28,7 +28,7 @@ TEST_P(PendingResources, DeleteMapObjectWithPendingRequest) {
std::unique_ptr<Map> map = std::make_unique<Map>(view, fileSource, MapMode::Still);
- uv::async endTest(loop.get(), [&map, &loop] {
+ util::AsyncTask endTest([&map, &loop] {
map.reset();
loop.stop();
});
@@ -43,7 +43,7 @@ TEST_P(PendingResources, DeleteMapObjectWithPendingRequest) {
EXPECT_TRUE(false) << "Should never happen.";
});
- uv_run(loop.get(), UV_RUN_DEFAULT);
+ loop.run();
}
// In the test data below, "sprite" will match both "sprite.json" and "sprite.png" and cause two
diff --git a/test/style/resource_loading.cpp b/test/style/resource_loading.cpp
index cdc84e96b2..f5019cfd82 100644
--- a/test/style/resource_loading.cpp
+++ b/test/style/resource_loading.cpp
@@ -80,7 +80,7 @@ private:
void runTestCase(MockFileSource::Type type,
const std::string& param,
const std::string& message) {
- util::RunLoop loop(uv_default_loop());
+ util::RunLoop loop;
MockView view;
MockFileSource fileSource(type, param);
@@ -118,7 +118,7 @@ void runTestCase(MockFileSource::Type type,
std::make_unique<util::Thread<MockMapContext>>(
util::ThreadContext{"Map", util::ThreadType::Map, util::ThreadPriority::Regular}, view, fileSource, callback));
- uv_run(loop.get(), UV_RUN_DEFAULT);
+ loop.run();
// Needed because it will make the Map thread
// join and cease logging after this point.