summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-10-24 16:41:04 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-10-24 16:41:04 +0200
commitd299e580886353e0813d30f9dee74639f899924a (patch)
treee73137e3258538cb5bbc634d1aff24c22e0f7a0f /test
parentcd9a89257a0004ca18460befc4b141bc07ed5c22 (diff)
parentcd44abcc588c9fc988589c148e76e4590c2197b8 (diff)
downloadqtlocation-mapboxgl-d299e580886353e0813d30f9dee74639f899924a.tar.gz
Merge remote-tracking branch 'origin/headless-display' into gyp-restructuring
Conflicts: Makefile ios/mapbox-gl-cocoa
Diffstat (limited to 'test')
-rw-r--r--test/comparisons.cpp2
-rw-r--r--test/enums.cpp2
-rw-r--r--test/fixtures/fixture_log.cpp12
-rw-r--r--test/fixtures/fixture_log.hpp27
-rw-r--r--test/fixtures/fixture_request.cpp1
-rw-r--r--test/headless.cpp10
-rw-r--r--test/test.gyp2
-rw-r--r--test/variant.cpp7
8 files changed, 28 insertions, 35 deletions
diff --git a/test/comparisons.cpp b/test/comparisons.cpp
index e1e991d41c..4ffcf2e2ec 100644
--- a/test/comparisons.cpp
+++ b/test/comparisons.cpp
@@ -10,7 +10,7 @@
class MockExtractor {
public:
- inline MockExtractor(const std::multimap<std::string, mbgl::Value> &values) : values(values) {}
+ inline MockExtractor(const std::multimap<std::string, mbgl::Value> &values_) : values(values_) {}
inline MockExtractor() {}
inline std::vector<mbgl::Value> getValues(const std::string &key) const {
diff --git a/test/enums.cpp b/test/enums.cpp
index 67ff0aa7e8..b45fc0ed0d 100644
--- a/test/enums.cpp
+++ b/test/enums.cpp
@@ -8,8 +8,6 @@
using namespace mbgl;
TEST(Enums, StyleLayerType) {
- std::cerr << StyleLayerType::Raster;
-
ASSERT_EQ(StyleLayerType::Unknown, StyleLayerTypeClass("unknown"));
ASSERT_EQ(StyleLayerType::Fill, StyleLayerTypeClass("fill"));
ASSERT_EQ(StyleLayerType::Line, StyleLayerTypeClass("line"));
diff --git a/test/fixtures/fixture_log.cpp b/test/fixtures/fixture_log.cpp
index c2c10fc9eb..1b1646e665 100644
--- a/test/fixtures/fixture_log.cpp
+++ b/test/fixtures/fixture_log.cpp
@@ -9,25 +9,25 @@ FixtureLogBackend::~FixtureLogBackend() {
}
size_t FixtureLogBackend::count(const LogMessage &message) const {
- size_t count = 0;
+ size_t message_count = 0;
for (const LogMessage &msg : messages) {
if (msg == message) {
- count++;
+ message_count++;
msg.checked = true;
}
}
- return count;
+ return message_count;
}
std::vector<FixtureLogBackend::LogMessage> FixtureLogBackend::unchecked() const {
- std::vector<LogMessage> unchecked;
+ std::vector<LogMessage> unchecked_messages;
for (const LogMessage &msg : messages) {
if (!msg.checked) {
- unchecked.push_back(msg);
+ unchecked_messages.push_back(msg);
msg.checked = true;
}
}
- return unchecked;
+ return unchecked_messages;
}
::std::ostream& operator<<(::std::ostream& os, const std::vector<FixtureLogBackend::LogMessage>& messages) {
diff --git a/test/fixtures/fixture_log.hpp b/test/fixtures/fixture_log.hpp
index 263871575b..99097a2c47 100644
--- a/test/fixtures/fixture_log.hpp
+++ b/test/fixtures/fixture_log.hpp
@@ -3,8 +3,7 @@
#include <mbgl/platform/log.hpp>
#include <mbgl/util/noncopyable.hpp>
-
-#include <boost/optional.hpp>
+#include <mbgl/util/optional.hpp>
#include <vector>
#include <cstdarg>
@@ -14,14 +13,14 @@ namespace mbgl {
class FixtureLogBackend : public LogBackend, private util::noncopyable {
public:
struct LogMessage {
- inline LogMessage(EventSeverity severity, Event event, int64_t code, const std::string &msg)
- : severity(severity), event(event), code(code), msg(msg) {}
- inline LogMessage(EventSeverity severity, Event event, int64_t code)
- : severity(severity), event(event), code(code) {}
- inline LogMessage(EventSeverity severity, Event event, const std::string &msg)
- : severity(severity), event(event), msg(msg) {}
- inline LogMessage(EventSeverity severity, Event event)
- : severity(severity), event(event) {}
+ inline LogMessage(EventSeverity severity_, Event event_, int64_t code_, const std::string &msg_)
+ : severity(severity_), event(event_), code(code_), msg(msg_) {}
+ inline LogMessage(EventSeverity severity_, Event event_, int64_t code_)
+ : severity(severity_), event(event_), code(code_), msg() {}
+ inline LogMessage(EventSeverity severity_, Event event_, const std::string &msg_)
+ : severity(severity_), event(event_), code(), msg(msg_) {}
+ inline LogMessage(EventSeverity severity_, Event event_)
+ : severity(severity_), event(event_), code(), msg() {}
inline bool operator==(const LogMessage &rhs) const {
return (!severity || !rhs.severity || severity.get() == rhs.severity.get()) &&
@@ -30,10 +29,10 @@ public:
(!msg || !rhs.msg || msg.get() == rhs.msg.get());
}
- const boost::optional<EventSeverity> severity;
- const boost::optional<Event> event;
- const boost::optional<int64_t> code;
- const boost::optional<std::string> msg;
+ const mapbox::util::optional<EventSeverity> severity;
+ const mapbox::util::optional<Event> event;
+ const mapbox::util::optional<int64_t> code;
+ const mapbox::util::optional<std::string> msg;
mutable bool checked = false;
};
diff --git a/test/fixtures/fixture_request.cpp b/test/fixtures/fixture_request.cpp
index d1687bbf57..f3b41681a6 100644
--- a/test/fixtures/fixture_request.cpp
+++ b/test/fixtures/fixture_request.cpp
@@ -4,6 +4,7 @@
#include <mbgl/util/url.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/platform/log.hpp>
+#include <iostream>
#include <uv.h>
diff --git a/test/headless.cpp b/test/headless.cpp
index 3255cff062..02dd0165ec 100644
--- a/test/headless.cpp
+++ b/test/headless.cpp
@@ -10,6 +10,7 @@
#include <rapidjson/stringbuffer.h>
#include "../common/headless_view.hpp"
+#include "../common/headless_display.hpp"
#include "./fixtures/fixture_log.hpp"
@@ -22,6 +23,8 @@ const std::string base_directory = []{
return fn + "/node_modules/mapbox-gl-test-suite/";
}();
+auto display_ = std::make_shared<mbgl::HeadlessDisplay>();
+
class HeadlessTest : public ::testing::TestWithParam<std::string> {};
TEST_P(HeadlessTest, render) {
@@ -78,7 +81,7 @@ TEST_P(HeadlessTest, render) {
}
}
- HeadlessView view;
+ HeadlessView view(display_);
Map map(view);
map.setStyleJSON(style, base_directory);
@@ -95,10 +98,7 @@ TEST_P(HeadlessTest, render) {
const unsigned int w = width * pixelRatio;
const unsigned int h = height * pixelRatio;
- const std::unique_ptr<uint32_t[]> pixels(new uint32_t[w * h]);
- glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
-
- const std::string image = util::compress_png(w, h, pixels.get(), true);
+ const std::string image = util::compress_png(w, h, view.readPixels().get(), true);
util::write_file(actual_image, image);
}
}
diff --git a/test/test.gyp b/test/test.gyp
index 865bac8673..49cc33739d 100644
--- a/test/test.gyp
+++ b/test/test.gyp
@@ -168,6 +168,8 @@
"./headless.cpp",
"../common/headless_view.hpp",
"../common/headless_view.cpp",
+ "../common/headless_display.hpp",
+ "../common/headless_display.cpp",
"../common/platform_default.cpp",
"./fixtures/fixture_request.cpp",
"./fixtures/fixture_log.hpp",
diff --git a/test/variant.cpp b/test/variant.cpp
index dd4578b49d..4557465cfa 100644
--- a/test/variant.cpp
+++ b/test/variant.cpp
@@ -4,13 +4,6 @@
#include <mbgl/style/value.hpp>
#include <mbgl/style/value_comparison.hpp>
-#pragma GCC diagnostic push
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
-#endif
-#include <boost/lexical_cast.hpp>
-#pragma GCC diagnostic pop
-
using namespace mbgl;
TEST(Variant, toString) {