summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-26 18:52:44 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-01-27 11:44:16 +0100
commit62ea1f21858c69f6921c775ba7a3de201f0514d8 (patch)
tree7a4da88706e8a5513e1e13e993b2acc212cae3b1 /test
parenta662508ddde4043ece36d8ea9b424368891d892c (diff)
downloadqtlocation-mapboxgl-62ea1f21858c69f6921c775ba7a3de201f0514d8.tar.gz
[core] remove trailing whitespace, add trailing newlines, add space after //
Diffstat (limited to 'test')
-rw-r--r--test/map/map.test.cpp2
-rw-r--r--test/map/transform.test.cpp6
-rw-r--r--test/math/wrap.test.cpp2
-rw-r--r--test/src/mbgl/test/conversion_stubs.hpp2
-rw-r--r--test/storage/local_file_source.test.cpp8
-rw-r--r--test/storage/offline_database.test.cpp4
-rw-r--r--test/storage/online_file_source.test.cpp14
-rwxr-xr-xtest/storage/server.js4
-rw-r--r--test/style/conversion/geojson_options.test.cpp22
-rw-r--r--test/style/source.test.cpp8
-rw-r--r--test/style/style.test.cpp2
-rw-r--r--test/style/style_layer.test.cpp8
-rw-r--r--test/util/http_timeout.test.cpp8
13 files changed, 45 insertions, 45 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 8eedeb3c01..fa331288c5 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -237,7 +237,7 @@ TEST(Map, StyleLoadedSignal) {
});
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
EXPECT_TRUE(emitted);
-
+
// But not when the style couldn't be parsed
emitted = false;
map.setStyleJSON("invalid");
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index d5b98ac109..9125b6ef1d 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -343,12 +343,12 @@ TEST(Transform, Padding) {
ASSERT_DOUBLE_EQ(10, trueCenter.latitude);
ASSERT_DOUBLE_EQ(-100, trueCenter.longitude);
ASSERT_DOUBLE_EQ(10, transform.getZoom());
-
+
const LatLng manualShiftedCenter = transform.getState().screenCoordinateToLatLng({
1000.0 / 2.0,
1000.0 / 4.0,
});
-
+
EdgeInsets padding;
padding.top = 0;
@@ -359,7 +359,7 @@ TEST(Transform, Padding) {
padding.top = 1000.0 / 2.0;
ASSERT_TRUE(bool(padding));
-
+
const LatLng shiftedCenter = transform.getLatLng(padding);
ASSERT_NE(trueCenter.latitude, shiftedCenter.latitude);
ASSERT_NEAR(trueCenter.longitude, shiftedCenter.longitude, 1e-9);
diff --git a/test/math/wrap.test.cpp b/test/math/wrap.test.cpp
index 9ec1c6ef0c..5610257a5c 100644
--- a/test/math/wrap.test.cpp
+++ b/test/math/wrap.test.cpp
@@ -23,4 +23,4 @@ TEST(Math, WrapMaxValue) {
TEST(Math, WrapMinValue) {
ASSERT_DOUBLE_EQ(0.0, util::wrap(0.0, 0.0, 12.0));
-} \ No newline at end of file
+}
diff --git a/test/src/mbgl/test/conversion_stubs.hpp b/test/src/mbgl/test/conversion_stubs.hpp
index ddffb1e3b2..e6581c5e53 100644
--- a/test/src/mbgl/test/conversion_stubs.hpp
+++ b/test/src/mbgl/test/conversion_stubs.hpp
@@ -24,7 +24,7 @@ class Value : public mbgl::variant<std::string,
};
inline bool isUndefined(const Value&) {
- //Variant is always intialized
+ // Variant is always intialized
return false;
}
diff --git a/test/storage/local_file_source.test.cpp b/test/storage/local_file_source.test.cpp
index c2f04d7543..1b90e5bb1e 100644
--- a/test/storage/local_file_source.test.cpp
+++ b/test/storage/local_file_source.test.cpp
@@ -104,14 +104,14 @@ TEST(LocalFileSource, URLEncoding) {
TEST(LocalFileSource, URLLimit) {
util::RunLoop loop;
-
+
size_t length = PATH_MAX - toAbsoluteURL("").size();
LocalFileSource fs;
char filename[length];
memset(filename, 'x', length);
-
+
std::string url(filename, length);
-
+
std::unique_ptr<AsyncRequest> req = fs.request({ Resource::Unknown, toAbsoluteURL(url) }, [&](Response res) {
req.reset();
ASSERT_NE(nullptr, res.error);
@@ -119,6 +119,6 @@ TEST(LocalFileSource, URLLimit) {
ASSERT_FALSE(res.data.get());
loop.stop();
});
-
+
loop.run();
}
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index 2e25835d80..872310e46f 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -276,12 +276,12 @@ TEST(OfflineDatabase, CreateRegion) {
TEST(OfflineDatabase, UpdateMetadata) {
using namespace mbgl;
-
+
OfflineDatabase db(":memory:");
OfflineRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0 };
OfflineRegionMetadata metadata {{ 1, 2, 3 }};
OfflineRegion region = db.createRegion(definition, metadata);
-
+
OfflineRegionMetadata newmetadata {{ 4, 5, 6 }};
db.updateMetadata(region.getID(), newmetadata);
EXPECT_EQ(db.listRegions().at(0).getMetadata(), newmetadata);
diff --git a/test/storage/online_file_source.test.cpp b/test/storage/online_file_source.test.cpp
index 966ef6239a..1a1d2d42f8 100644
--- a/test/storage/online_file_source.test.cpp
+++ b/test/storage/online_file_source.test.cpp
@@ -364,7 +364,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(NetworkStatusOnlineOffline)) {
TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitStandard)) {
util::RunLoop loop;
OnlineFileSource fs;
-
+
auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/rate-limit?std=true" }, [&](Response res) {
ASSERT_NE(nullptr, res.error);
EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason);
@@ -372,14 +372,14 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitStandard)) {
ASSERT_LT(util::now(), res.error->retryAfter);
loop.stop();
});
-
+
loop.run();
}
TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitMBX)) {
util::RunLoop loop;
OnlineFileSource fs;
-
+
auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/rate-limit?mbx=true" }, [&](Response res) {
ASSERT_NE(nullptr, res.error);
EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason);
@@ -387,28 +387,28 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitMBX)) {
ASSERT_LT(util::now(), res.error->retryAfter);
loop.stop();
});
-
+
loop.run();
}
TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitDefault)) {
util::RunLoop loop;
OnlineFileSource fs;
-
+
auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/rate-limit" }, [&](Response res) {
ASSERT_NE(nullptr, res.error);
EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason);
ASSERT_FALSE(res.error->retryAfter);
loop.stop();
});
-
+
loop.run();
}
TEST(OnlineFileSource, ChangeAPIBaseURL){
util::RunLoop loop;
OnlineFileSource fs;
-
+
EXPECT_EQ(mbgl::util::API_BASE_URL, fs.getAPIBaseURL());
const std::string customURL = "test.domain";
fs.setAPIBaseURL(customURL);
diff --git a/test/storage/server.js b/test/storage/server.js
index a7538b55f1..92e9e9e0e7 100755
--- a/test/storage/server.js
+++ b/test/storage/server.js
@@ -117,13 +117,13 @@ app.get('/temporary-error', function(req, res) {
});
app.get('/rate-limit', function(req, res) {
-
+
if (req.query.std) {
res.setHeader('Retry-After', 1);
} else if (req.query.mbx) {
res.setHeader('x-rate-limit-reset', Math.round(Date.now() / 1000) + 1);
}
-
+
res.status(429).end();
});
diff --git a/test/style/conversion/geojson_options.test.cpp b/test/style/conversion/geojson_options.test.cpp
index 14a7adbba7..ddf261ea52 100644
--- a/test/style/conversion/geojson_options.test.cpp
+++ b/test/style/conversion/geojson_options.test.cpp
@@ -28,13 +28,13 @@ TEST(GeoJSONOptions, RetainsDefaults) {
Value raw(map);
GeoJSONOptions converted = *convert<GeoJSONOptions>(raw);
GeoJSONOptions defaults;
-
- //GeoJSON-VT
+
+ // GeoJSON-VT
ASSERT_EQ(converted.maxzoom, defaults.maxzoom);
ASSERT_EQ(converted.buffer, defaults.buffer);
ASSERT_EQ(converted.tolerance, defaults.tolerance);
-
- //Supercluster
+
+ // Supercluster
ASSERT_EQ(converted.cluster, defaults.cluster);
ASSERT_EQ(converted.clusterRadius, defaults.clusterRadius);
ASSERT_EQ(converted.clusterMaxZoom, defaults.clusterMaxZoom);
@@ -43,25 +43,25 @@ TEST(GeoJSONOptions, RetainsDefaults) {
TEST(GeoJSONOptions, FullConversion) {
ValueMap map {
- //GeoJSON-VT
+ // GeoJSON-VT
{"maxzoom", 1.0f},
{"buffer", 2.0f},
{"tolerance", 3.0f},
-
- //Supercluster
+
+ // Supercluster
{"cluster", true},
{"clusterRadius", 4.0f},
{"clusterMaxZoom", 5.0f}
};
Value raw(map);
GeoJSONOptions converted = *convert<GeoJSONOptions>(raw);
-
- //GeoJSON-VT
+
+ // GeoJSON-VT
ASSERT_EQ(converted.maxzoom, 1);
ASSERT_EQ(converted.buffer, 2);
ASSERT_EQ(converted.tolerance, 3);
-
- //Supercluster
+
+ // Supercluster
ASSERT_EQ(converted.cluster, true);
ASSERT_EQ(converted.clusterRadius, 4);
ASSERT_EQ(converted.clusterMaxZoom, 5);
diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp
index 01f54d6b18..fb7737e417 100644
--- a/test/style/source.test.cpp
+++ b/test/style/source.test.cpp
@@ -393,7 +393,7 @@ TEST(Source, GeoJSonSourceUrlUpdate) {
};
test.observer.sourceDescriptionChanged = [&] (Source&) {
- //Should be called (test will hang if it doesn't)
+ // Should be called (test will hang if it doesn't)
test.end();
};
@@ -404,12 +404,12 @@ TEST(Source, GeoJSonSourceUrlUpdate) {
GeoJSONSource source("source");
source.baseImpl->setObserver(&test.observer);
- //Load initial, so the source state will be loaded=true
+ // Load initial, so the source state will be loaded=true
source.baseImpl->loadDescription(test.fileSource);
- //Schedule an update
+ // Schedule an update
test.loop.invoke([&] () {
- //Update the url
+ // Update the url
source.setURL(std::string("http://source-url.ext"));
});
diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp
index 89c5c4ce6f..b49058420e 100644
--- a/test/style/style.test.cpp
+++ b/test/style/style.test.cpp
@@ -131,6 +131,6 @@ TEST(Style, DuplicateSource) {
style.addSource(std::make_unique<VectorSource>("sourceId", "mapbox://mapbox.mapbox-terrain-v2"));
FAIL() << "Should not have been allowed to add a duplicate source id";
} catch (std::runtime_error) {
- //Expected
+ // Expected
}
}
diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp
index 8356f3accd..773d172876 100644
--- a/test/style/style_layer.test.cpp
+++ b/test/style/style_layer.test.cpp
@@ -278,20 +278,20 @@ TEST(Layer, Observer) {
TEST(Layer, DuplicateLayer) {
util::RunLoop loop;
- //Setup style
+ // Setup style
StubFileSource fileSource;
Style style { fileSource, 1.0 };
style.setJSON(util::read_file("test/fixtures/resources/style-unused-sources.json"));
- //Add initial layer
+ // Add initial layer
style.addLayer(std::make_unique<LineLayer>("line", "unusedsource"));
- //Try to add duplicate
+ // Try to add duplicate
try {
style.addLayer(std::make_unique<LineLayer>("line", "unusedsource"));
FAIL() << "Should not have been allowed to add a duplicate layer id";
} catch (const std::runtime_error e) {
- //Expected
+ // Expected
ASSERT_STREQ("Layer line already exists", e.what());
}
}
diff --git a/test/util/http_timeout.test.cpp b/test/util/http_timeout.test.cpp
index e99c703159..26a306c6e5 100644
--- a/test/util/http_timeout.test.cpp
+++ b/test/util/http_timeout.test.cpp
@@ -9,7 +9,7 @@ using namespace mbgl;
using namespace mbgl::http;
TEST(HttpRetry, OtherError) {
- //Non-retryable
+ // Non-retryable
ASSERT_EQ(Duration::max(), errorRetryTimeout(Response::Error::Reason::Other, 1));
}
@@ -17,7 +17,7 @@ TEST(HttpRetry, ServerError) {
// 1-3 failures -> 1 sec
ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1));
ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 3));
-
+
// After 3, exponential backoff
ASSERT_EQ(Seconds(2), errorRetryTimeout(Response::Error::Reason::Server, 4));
ASSERT_EQ(Seconds(1u << 31), errorRetryTimeout(Response::Error::Reason::Server, 50));
@@ -32,8 +32,8 @@ TEST(HttpRetry, ConnectionError) {
TEST(HttpRetry, RateLimit) {
// Pre-set value from header
ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1, { util::now() + Seconds(1) }));
-
- //Default
+
+ // Default
ASSERT_EQ(Seconds(5), errorRetryTimeout(Response::Error::Reason::RateLimit, 1, {}));
}