[msvc] Avoid warnings in tests (#276)
This commit is contained in:
@@ -21,7 +21,7 @@ PremultipliedImage namedImage(const std::string& name) {
|
||||
}
|
||||
|
||||
std::unique_ptr<style::Image> namedMarker(const std::string& name) {
|
||||
return std::make_unique<style::Image>(name, namedImage(name), 1.0);
|
||||
return std::make_unique<style::Image>(name, namedImage(name), 1.0f);
|
||||
}
|
||||
|
||||
class AnnotationTest {
|
||||
@@ -340,7 +340,7 @@ TEST(Annotations, ReaddImage) {
|
||||
|
||||
test.frontend.render(test.map);
|
||||
|
||||
test.map.addAnnotationImage(std::make_unique<style::Image>("default_marker", namedImage("flipped_marker"), 1.0));
|
||||
test.map.addAnnotationImage(std::make_unique<style::Image>("default_marker", namedImage("flipped_marker"), 1.0f));
|
||||
test.checkRendering("readd_image");
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
QueryTest() {
|
||||
map.getStyle().loadJSON(util::read_file("test/fixtures/api/query_style.json"));
|
||||
map.getStyle().addImage(std::make_unique<style::Image>("test-icon",
|
||||
decodeImage(util::read_file("test/fixtures/sprites/default_marker.png")), 1.0));
|
||||
decodeImage(util::read_file("test/fixtures/sprites/default_marker.png")), 1.0f));
|
||||
|
||||
frontend.render(map);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST(API, RecycleMapUpdateImages) {
|
||||
map->getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
|
||||
map->getStyle().addSource(std::move(source));
|
||||
map->getStyle().addLayer(std::move(layer));
|
||||
map->getStyle().addImage(std::make_unique<style::Image>(markerName, decodeImage(util::read_file(markerPath)), 1.0));
|
||||
map->getStyle().addImage(std::make_unique<style::Image>(markerName, decodeImage(util::read_file(markerPath)), 1.0f));
|
||||
};
|
||||
|
||||
// default marker
|
||||
|
||||
@@ -121,7 +121,7 @@ TEST(Map, RendererState) {
|
||||
}
|
||||
|
||||
// RendererState::hasImage
|
||||
test.map.getStyle().addImage(std::make_unique<style::Image>("default_marker", decodeImage(util::read_file("test/fixtures/sprites/default_marker.png")), 1.0));
|
||||
test.map.getStyle().addImage(std::make_unique<style::Image>("default_marker", decodeImage(util::read_file("test/fixtures/sprites/default_marker.png")), 1.0f));
|
||||
|
||||
// The frontend has not yet been notified about the newly-added image.
|
||||
EXPECT_FALSE(test.frontend.hasImage("default_marker"));
|
||||
|
||||
@@ -38,9 +38,9 @@ TEST(ImageManager, AddRemove) {
|
||||
FixtureLog log;
|
||||
ImageManager imageManager;
|
||||
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("two", PremultipliedImage({ 16, 16 }), 2));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("three", PremultipliedImage({ 16, 16 }), 2));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2.0f));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("two", PremultipliedImage({ 16, 16 }), 2.0f));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("three", PremultipliedImage({ 16, 16 }), 2.0f));
|
||||
|
||||
imageManager.removeImage("one");
|
||||
imageManager.removeImage("two");
|
||||
@@ -54,9 +54,9 @@ TEST(ImageManager, Update) {
|
||||
FixtureLog log;
|
||||
ImageManager imageManager;
|
||||
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2.0f));
|
||||
EXPECT_EQ(0, imageManager.updatedImageVersions.size());
|
||||
imageManager.updateImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2));
|
||||
imageManager.updateImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2.0f));
|
||||
EXPECT_EQ(1, imageManager.updatedImageVersions.size());
|
||||
imageManager.removeImage("one");
|
||||
EXPECT_EQ(0, imageManager.updatedImageVersions.size());
|
||||
@@ -66,12 +66,12 @@ TEST(ImageManager, RemoveReleasesBinPackRect) {
|
||||
FixtureLog log;
|
||||
ImageManager imageManager;
|
||||
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("big", PremultipliedImage({ 32, 32 }), 1));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("big", PremultipliedImage({ 32, 32 }), 1.0f));
|
||||
EXPECT_TRUE(imageManager.getImage("big"));
|
||||
|
||||
imageManager.removeImage("big");
|
||||
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("big", PremultipliedImage({ 32, 32 }), 1));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("big", PremultipliedImage({ 32, 32 }), 1.0f));
|
||||
EXPECT_TRUE(imageManager.getImage("big"));
|
||||
EXPECT_TRUE(log.empty());
|
||||
}
|
||||
@@ -129,7 +129,7 @@ TEST(ImageManager, NotifiesRequestorImmediatelyIfDependenciesAreSatisfied) {
|
||||
uint64_t imageCorrelationID = 0;
|
||||
ImageDependencies dependencies;
|
||||
dependencies.emplace("one", ImageType::Icon);
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2.0f));
|
||||
imageManager.getImages(requestor, std::make_pair(dependencies, imageCorrelationID));
|
||||
|
||||
ASSERT_TRUE(notified);
|
||||
@@ -252,9 +252,9 @@ TEST(ImageManager, RemoveUnusedStyleImages) {
|
||||
|
||||
observer.imageMissing = [&imageManager] (const std::string& id) {
|
||||
if (id == "1024px") {
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>(id, PremultipliedImage({ 1024, 1024 }), 1));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>(id, PremultipliedImage({ 1024, 1024 }), 1.0f));
|
||||
} else {
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>(id, PremultipliedImage({ 16, 16 }), 1));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>(id, PremultipliedImage({ 16, 16 }), 1.0f));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -266,7 +266,7 @@ TEST(ImageManager, RemoveUnusedStyleImages) {
|
||||
};
|
||||
|
||||
// Style sprite.
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("sprite", PremultipliedImage({ 16, 16 }), 1));
|
||||
imageManager.addImage(makeMutable<style::Image::Impl>("sprite", PremultipliedImage({ 16, 16 }), 1.0f));
|
||||
|
||||
// Single requestor
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ TEST(PatternAtlas, Updates) {
|
||||
PremultipliedImage imageA({ 16, 12 });
|
||||
imageA.fill(255);
|
||||
|
||||
auto added = patternAtlas.addPattern(*makeMutable<style::Image::Impl>("one", std::move(imageA), 1));
|
||||
auto added = patternAtlas.addPattern(*makeMutable<style::Image::Impl>("one", std::move(imageA), 1.0f));
|
||||
ASSERT_TRUE(added);
|
||||
auto found = patternAtlas.getPattern("one");
|
||||
ASSERT_TRUE(found);
|
||||
@@ -63,7 +63,7 @@ TEST(PatternAtlas, Updates) {
|
||||
EXPECT_EQ(1.0f, a.pixelRatio);
|
||||
test::checkImage("test/fixtures/image_manager/updates_before", patternAtlas.getAtlasImageForTests());
|
||||
|
||||
auto imageB = makeMutable<style::Image::Impl>("one", PremultipliedImage({ 5, 5 }), 1);
|
||||
auto imageB = makeMutable<style::Image::Impl>("one", PremultipliedImage({ 5, 5 }), 1.0f);
|
||||
EXPECT_FALSE(patternAtlas.addPattern(*imageB)); // Already added.
|
||||
|
||||
patternAtlas.removePattern("one");
|
||||
|
||||
@@ -162,7 +162,7 @@ TEST(Sprite, SpriteImageCreationInvalid) {
|
||||
}));
|
||||
EXPECT_EQ(0u, log.uncheckedCount());
|
||||
|
||||
ASSERT_EQ(nullptr, createStyleImage("test", image_1x, 0, 0, 16, 16, 1, false, {{-1, 3}}));
|
||||
ASSERT_EQ(nullptr, createStyleImage("test", image_1x, 0, 0, 16, 16, 1, false, {{-1.0f, 3.0f}}));
|
||||
EXPECT_EQ(1u,
|
||||
log.count({
|
||||
EventSeverity::Error,
|
||||
@@ -463,8 +463,8 @@ TEST(Sprite, SpriteParsingStretchAndContent) {
|
||||
})JSON");
|
||||
EXPECT_EQ(1u, images.size());
|
||||
EXPECT_EQ("image", images[0]->id);
|
||||
EXPECT_EQ((style::ImageStretches{{2, 14}}), images[0]->stretchX);
|
||||
EXPECT_EQ((style::ImageStretches{{0, 4}, {12, 16}}), images[0]->stretchY);
|
||||
EXPECT_EQ((style::ImageStretches{{2.0f, 14.0f}}), images[0]->stretchX);
|
||||
EXPECT_EQ((style::ImageStretches{{0.0f, 4.0f}, {12.0f, 16.0f}}), images[0]->stretchY);
|
||||
EXPECT_EQ((style::ImageContent{2, 2, 14, 14}), images[0]->content);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,18 @@
|
||||
#include <mbgl/util/image.hpp>
|
||||
#include <mbgl/util/io.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4244)
|
||||
#endif
|
||||
|
||||
#include <mapbox/pixelmatch.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
namespace mbgl {
|
||||
namespace test {
|
||||
|
||||
@@ -39,14 +49,14 @@ void checkImage(const std::string& base,
|
||||
|
||||
ASSERT_EQ(expected.size, actual.size);
|
||||
|
||||
double pixels = mapbox::pixelmatch(actual.data.get(),
|
||||
uint64_t pixels = mapbox::pixelmatch(actual.data.get(),
|
||||
expected.data.get(),
|
||||
expected.size.width,
|
||||
expected.size.height,
|
||||
diff.data.get(),
|
||||
pixelThreshold);
|
||||
|
||||
EXPECT_LE(pixels / (expected.size.width * expected.size.height), imageThreshold);
|
||||
EXPECT_LE(static_cast<double>(pixels) / (expected.size.width * expected.size.height), imageThreshold);
|
||||
|
||||
#if !TEST_READ_ONLY
|
||||
util::write_file(base + "/diff.png", encodePNG(diff));
|
||||
|
||||
@@ -20,7 +20,11 @@ namespace {
|
||||
|
||||
std::string toAbsoluteURL(const std::string& fileName) {
|
||||
char buff[PATH_MAX + 1];
|
||||
#ifdef _MSC_VER
|
||||
char* cwd = _getcwd( buff, PATH_MAX + 1 );
|
||||
#else
|
||||
char* cwd = getcwd( buff, PATH_MAX + 1 );
|
||||
#endif
|
||||
std::string url = { "file://" + std::string(cwd) + "/test/fixtures/storage/assets/" + fileName };
|
||||
assert(url.size() <= PATH_MAX);
|
||||
return url;
|
||||
|
||||
@@ -669,7 +669,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(DISABLED_MaximumAmbientCacheSize)) {
|
||||
namespace {
|
||||
std::list<std::tuple<Resource, Response>> generateResources(const std::string& tilePrefix,
|
||||
const std::string& stylePrefix) {
|
||||
static const auto responseData = randomString(.5 * 1024 * 1024);
|
||||
static const auto responseData = randomString(512 * 1024);
|
||||
Response response;
|
||||
response.data = responseData;
|
||||
std::list<std::tuple<Resource, Response>> resources;
|
||||
@@ -694,7 +694,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(DeleteRegion)) {
|
||||
|
||||
{
|
||||
Response response;
|
||||
response.data = randomString(.5 * 1024 * 1024);
|
||||
response.data = randomString(512 * 1024);
|
||||
|
||||
OfflineDatabase db(filename, fixture::tileServerOptions);
|
||||
|
||||
@@ -753,7 +753,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Pack)) {
|
||||
db.runPackDatabaseAutomatically(false);
|
||||
|
||||
Response response;
|
||||
response.data = randomString(.5 * 1024 * 1024);
|
||||
response.data = randomString(512 * 1024);
|
||||
|
||||
for (unsigned i = 0; i < 50; ++i) {
|
||||
const Resource tile = Resource::tile("maptiler://tiles/tiles/tile_" + std::to_string(i), 1, 0, 0, 0, Tileset::Scheme::XYZ);
|
||||
@@ -975,7 +975,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(ClearAmbientCache)) {
|
||||
|
||||
{
|
||||
Response response;
|
||||
response.data = randomString(.5 * 1024 * 1024);
|
||||
response.data = randomString(512 * 1024);
|
||||
|
||||
OfflineDatabase db(filename, fixture::tileServerOptions);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ TEST(Stringify, Vector) {
|
||||
}
|
||||
|
||||
TEST(Stringify, Map) {
|
||||
ASSERT_EQ(stringify(std::unordered_map<std::string, float> {{ "a", 1 }}), "{\"a\":1.0}");
|
||||
ASSERT_EQ(stringify(std::unordered_map<std::string, float> {{ "a", 1.0f }}), "{\"a\":1.0}");
|
||||
}
|
||||
|
||||
TEST(Stringify, Value) {
|
||||
|
||||
@@ -51,7 +51,7 @@ void writeJSON(rapidjson::Writer<rapidjson::StringBuffer>& writer, const Value&
|
||||
[&] (int64_t t) { writer.Int64(t); },
|
||||
[&] (double f) {
|
||||
// make sure integer values are stringified without trailing ".0".
|
||||
f == std::floor(f) ? writer.Int(f) : writer.Double(f);
|
||||
f == std::floor(f) ? writer.Int(static_cast<int>(f)) : writer.Double(f);
|
||||
},
|
||||
[&] (const std::string& s) { writer.String(s); },
|
||||
[&] (const std::vector<Value>& arr) {
|
||||
|
||||
@@ -138,9 +138,9 @@ TEST(Style, AddRemoveImage) {
|
||||
util::RunLoop loop;
|
||||
auto fileSource = std::make_shared<StubFileSource>();
|
||||
Style::Impl style{fileSource, 1.0};
|
||||
style.addImage(std::make_unique<style::Image>("one", PremultipliedImage({16, 16}), 2));
|
||||
style.addImage(std::make_unique<style::Image>("two", PremultipliedImage({16, 16}), 2));
|
||||
style.addImage(std::make_unique<style::Image>("three", PremultipliedImage({16, 16}), 2));
|
||||
style.addImage(std::make_unique<style::Image>("one", PremultipliedImage({16, 16}), 2.0f));
|
||||
style.addImage(std::make_unique<style::Image>("two", PremultipliedImage({16, 16}), 2.0f));
|
||||
style.addImage(std::make_unique<style::Image>("three", PremultipliedImage({16, 16}), 2.0f));
|
||||
|
||||
style.removeImage("one");
|
||||
style.removeImage("two");
|
||||
@@ -155,9 +155,9 @@ TEST(Style, AddRemoveRemoveImage) {
|
||||
util::RunLoop loop;
|
||||
auto fileSource = std::make_shared<StubFileSource>();
|
||||
Style::Impl style{fileSource, 1.0};
|
||||
style.addImage(std::make_unique<style::Image>("one", PremultipliedImage({16, 16}), 2));
|
||||
style.addImage(std::make_unique<style::Image>("two", PremultipliedImage({16, 16}), 2));
|
||||
style.addImage(std::make_unique<style::Image>("three", PremultipliedImage({16, 16}), 2));
|
||||
style.addImage(std::make_unique<style::Image>("one", PremultipliedImage({16, 16}), 2.0f));
|
||||
style.addImage(std::make_unique<style::Image>("two", PremultipliedImage({16, 16}), 2.0f));
|
||||
style.addImage(std::make_unique<style::Image>("three", PremultipliedImage({16, 16}), 2.0f));
|
||||
|
||||
style.removeImage("one");
|
||||
style.removeImage("two");
|
||||
|
||||
@@ -8,7 +8,7 @@ using namespace mbgl;
|
||||
|
||||
TEST(StyleImage, ZeroWidth) {
|
||||
try {
|
||||
style::Image("test", PremultipliedImage({ 0, 16 }), 2.0);
|
||||
style::Image("test", PremultipliedImage({ 0, 16 }), 2.0f);
|
||||
FAIL() << "Expected exception";
|
||||
} catch (util::StyleImageException& ex) {
|
||||
EXPECT_STREQ("dimensions may not be zero", ex.what());
|
||||
@@ -17,7 +17,7 @@ TEST(StyleImage, ZeroWidth) {
|
||||
|
||||
TEST(StyleImage, ZeroHeight) {
|
||||
try {
|
||||
style::Image("test", PremultipliedImage({ 16, 0 }), 2.0);
|
||||
style::Image("test", PremultipliedImage({ 16, 0 }), 2.0f);
|
||||
FAIL() << "Expected exception";
|
||||
} catch (util::StyleImageException& ex) {
|
||||
EXPECT_STREQ("dimensions may not be zero", ex.what());
|
||||
@@ -26,7 +26,7 @@ TEST(StyleImage, ZeroHeight) {
|
||||
|
||||
TEST(StyleImage, ZeroRatio) {
|
||||
try {
|
||||
style::Image("test", PremultipliedImage({ 16, 16 }), 0.0);
|
||||
style::Image("test", PremultipliedImage({ 16, 16 }), 0.0f);
|
||||
FAIL() << "Expected exception";
|
||||
} catch (util::StyleImageException& ex) {
|
||||
EXPECT_STREQ("pixelRatio may not be <= 0", ex.what());
|
||||
@@ -34,14 +34,14 @@ TEST(StyleImage, ZeroRatio) {
|
||||
}
|
||||
|
||||
TEST(StyleImage, Retina) {
|
||||
style::Image image("test", PremultipliedImage({ 32, 24 }), 2.0);
|
||||
style::Image image("test", PremultipliedImage({ 32, 24 }), 2.0f);
|
||||
EXPECT_EQ(32u, image.getImage().size.width);
|
||||
EXPECT_EQ(24u, image.getImage().size.height);
|
||||
EXPECT_EQ(2, image.getPixelRatio());
|
||||
}
|
||||
|
||||
TEST(StyleImage, FractionalRatio) {
|
||||
style::Image image("test", PremultipliedImage({ 20, 12 }), 1.5);
|
||||
style::Image image("test", PremultipliedImage({ 20, 12 }), 1.5f);
|
||||
EXPECT_EQ(20u, image.getImage().size.width);
|
||||
EXPECT_EQ(12u, image.getImage().size.height);
|
||||
EXPECT_EQ(1.5, image.getPixelRatio());
|
||||
@@ -50,7 +50,7 @@ TEST(StyleImage, FractionalRatio) {
|
||||
TEST(StyleImage, InvalidStretchX) {
|
||||
// out of left bound
|
||||
try {
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {{-1, 3}});
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {{-1.0f, 3.0f}});
|
||||
FAIL() << "Expected exception";
|
||||
} catch (util::StyleImageException& ex) {
|
||||
EXPECT_STREQ("stretchX is out of bounds or overlapping", ex.what());
|
||||
@@ -58,7 +58,7 @@ TEST(StyleImage, InvalidStretchX) {
|
||||
|
||||
// overlapping
|
||||
try {
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {{0, 3}, {2., 4.}});
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {{0.0f, 3.0f}, {2.0f, 4.0f}});
|
||||
FAIL() << "Expected exception";
|
||||
} catch (util::StyleImageException& ex) {
|
||||
EXPECT_STREQ("stretchX is out of bounds or overlapping", ex.what());
|
||||
@@ -68,7 +68,7 @@ TEST(StyleImage, InvalidStretchX) {
|
||||
TEST(StyleImage, InvalidStretchY) {
|
||||
// out of bottom bound
|
||||
try {
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {}, {{14, 20}});
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {}, {{14.0f, 20.0f}});
|
||||
FAIL() << "Expected exception";
|
||||
} catch (util::StyleImageException& ex) {
|
||||
EXPECT_STREQ("stretchX is out of bounds or overlapping", ex.what());
|
||||
@@ -76,7 +76,7 @@ TEST(StyleImage, InvalidStretchY) {
|
||||
|
||||
// must be sorted
|
||||
try {
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {}, {{4, 8}, {2, 3}});
|
||||
style::Image("test", PremultipliedImage({16, 16}), 1, {}, {{4.0f, 8.0f}, {2.0f, 3.0f}});
|
||||
FAIL() << "Expected exception";
|
||||
} catch (util::StyleImageException& ex) {
|
||||
EXPECT_STREQ("stretchX is out of bounds or overlapping", ex.what());
|
||||
@@ -111,11 +111,11 @@ TEST(StyleImage, InvalidContent) {
|
||||
|
||||
TEST(StyleImage, StretchContent) {
|
||||
style::Image image(
|
||||
"test", PremultipliedImage({16, 16}), 1, {{2, 14}}, {{0, 4}, {12, 16}}, style::ImageContent{2, 2, 14, 14});
|
||||
"test", PremultipliedImage({16, 16}), 1, {{2.0f, 14.0f}}, {{0.0f, 4.0f}, {12.0f, 16.0f}}, style::ImageContent{2, 2, 14, 14});
|
||||
EXPECT_EQ(16u, image.getImage().size.width);
|
||||
EXPECT_EQ(16u, image.getImage().size.height);
|
||||
EXPECT_EQ(1.0, image.getPixelRatio());
|
||||
EXPECT_EQ((style::ImageStretches{{2, 14}}), image.getStretchX());
|
||||
EXPECT_EQ((style::ImageStretches{{0, 4}, {12, 16}}), image.getStretchY());
|
||||
EXPECT_EQ((style::ImageStretches{{2.0f, 14.0f}}), image.getStretchX());
|
||||
EXPECT_EQ((style::ImageStretches{{0.0f, 4.0f}, {12.0f, 16.0f}}), image.getStretchY());
|
||||
EXPECT_EQ((style::ImageContent{2, 2, 14, 14}), image.getContent());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ SymbolInstance makeSymbolInstance(float x, float y, std::u16string key) {
|
||||
placementType,
|
||||
textOffset,
|
||||
imageMap,
|
||||
0,
|
||||
0.0f,
|
||||
SymbolContent::IconSDF,
|
||||
false,
|
||||
false);
|
||||
|
||||
@@ -15,7 +15,7 @@ TEST(getIconQuads, normal) {
|
||||
Anchor anchor(2.0, 3.0, 0.0, 0);
|
||||
ImagePosition image = {
|
||||
mapbox::Bin(-1, 15, 11, 0, 0, 0, 0),
|
||||
style::Image::Impl("test", PremultipliedImage({1,1}), 1.0)
|
||||
style::Image::Impl("test", PremultipliedImage({1,1}), 1.0f)
|
||||
};
|
||||
|
||||
auto shapedIcon = PositionedIcon::shapeIcon(image, {{-6.5f, -4.5f}}, SymbolAnchorType::Center);
|
||||
@@ -39,7 +39,7 @@ TEST(getIconQuads, normal) {
|
||||
TEST(getIconQuads, style) {
|
||||
Anchor anchor(0.0, 0.0, 0.0, 0);
|
||||
const ImagePosition image = {mapbox::Bin(-1, 20, 20, 0, 0, 0, 0),
|
||||
style::Image::Impl("test", PremultipliedImage({1, 1}), 1.0)};
|
||||
style::Image::Impl("test", PremultipliedImage({1, 1}), 1.0f)};
|
||||
|
||||
GeometryCoordinates line;
|
||||
Shaping shapedText;
|
||||
|
||||
@@ -73,7 +73,7 @@ TEST(TileCoordinate, FromLatLng) {
|
||||
ASSERT_DOUBLE_EQ(fromLatLng.p.x, tilePoint.x * maxTilesPerAxis);
|
||||
ASSERT_NEAR(fromLatLng.p.y, tilePoint.y * maxTilesPerAxis, 1.0e-7);
|
||||
|
||||
const auto fromScreenCoordinate = TileCoordinate::fromScreenCoordinate(transform.getState(), zoom, screenCoordinate);
|
||||
const auto fromScreenCoordinate = TileCoordinate::fromScreenCoordinate(transform.getState(), static_cast<uint8_t>(zoom), screenCoordinate);
|
||||
ASSERT_DOUBLE_EQ(fromScreenCoordinate.z, fromLatLng.z);
|
||||
ASSERT_NEAR(fromScreenCoordinate.p.x, fromLatLng.p.x, 0.99);
|
||||
ASSERT_NEAR(fromScreenCoordinate.p.y, fromLatLng.p.y, 0.99);
|
||||
@@ -92,10 +92,10 @@ TEST(TileCoordinate, ToGeometryCoordinate) {
|
||||
};
|
||||
|
||||
for (uint8_t zoom = 0; zoom <= 16; ++zoom) {
|
||||
uint32_t maxTilesPerAxis = std::pow(2, zoom);
|
||||
auto maxTilesPerAxis = static_cast<uint32_t>(std::pow(2, zoom));
|
||||
for (const auto& edge : edges) {
|
||||
uint32_t tileX = edge.x == 0 ? 0 : edge.x == 1 ? maxTilesPerAxis - 1 : (maxTilesPerAxis / 2.0) - 1;
|
||||
uint32_t tileY = edge.y == 0 ? 0 : edge.y == 1 ? maxTilesPerAxis - 1 : (maxTilesPerAxis / 2.0) - 1;
|
||||
uint32_t tileX = edge.x == 0 ? 0 : edge.x == 1 ? maxTilesPerAxis - 1 : (maxTilesPerAxis / 2) - 1;
|
||||
uint32_t tileY = edge.y == 0 ? 0 : edge.y == 1 ? maxTilesPerAxis - 1 : (maxTilesPerAxis / 2) - 1;
|
||||
UnwrappedTileID unwrapped(0, CanonicalTileID { zoom, tileX, tileY });
|
||||
|
||||
auto tilePointX = ((edge.x * maxTilesPerAxis) - tileX) * util::EXTENT;
|
||||
|
||||
@@ -42,7 +42,9 @@ TEST(TileID, Canonical) {
|
||||
EXPECT_FALSE(child.isChildOf({ 2, 1, 0 }));
|
||||
EXPECT_FALSE(child.isChildOf({ 1, 0, 1 }));
|
||||
|
||||
#ifndef WIN32 // windows does not like this test, just disable it
|
||||
EXPECT_EQ(0, 4294967295 >> 32);
|
||||
#endif
|
||||
|
||||
const CanonicalTileID maxChild(32, 4294967295, 4294967295);
|
||||
EXPECT_FALSE(maxChild.isChildOf({ 32, 4294967295, 4294967295 }));
|
||||
|
||||
@@ -175,8 +175,8 @@ TEST(Memory, Footprint) {
|
||||
|
||||
double rasterFootprint = (mbgl::test::getCurrentRSS() - rasterInitialRSS) / double(runs);
|
||||
|
||||
RecordProperty("vectorFootprint", vectorFootprint);
|
||||
RecordProperty("rasterFootprint", rasterFootprint);
|
||||
RecordProperty("vectorFootprint", static_cast<int>(vectorFootprint));
|
||||
RecordProperty("rasterFootprint", static_cast<int>(rasterFootprint));
|
||||
|
||||
ASSERT_LT(vectorFootprint, 40 * 1024 * 1024) << "\
|
||||
mbgl::Map footprint over 65.2MB for vector styles.";
|
||||
|
||||
Reference in New Issue
Block a user