[msvc] Fix compilation errors and warnings (#141)

This commit is contained in:
Tadej Novak
2021-08-29 22:53:42 +02:00
committed by GitHub
parent c0d76c69cc
commit fe041b80ca
51 changed files with 206 additions and 195 deletions

View File

@@ -35,7 +35,7 @@ const float overscaling = 1.0f;
TEST(getAnchors, NonContinuedLineShortLabels) {
const Anchors anchors = getAnchors(
nonContinuedLine, bigSpacing, M_PI, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
nonContinuedLine, bigSpacing, static_cast<float>(M_PI), textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
const Anchors expected_anchors = {Anchor(1.0f, 2.0f, 1.570796371f, 1u),
Anchor(1.0f, 5.0f, 1.570796371f, 4u),
Anchor(1.0f, 8.0f, 1.570796371f, 7u)};
@@ -46,7 +46,7 @@ TEST(getAnchors, NonContinuedLineShortLabels) {
TEST(getAnchors, NonContinuedLineLongLabels) {
const Anchors anchors = getAnchors(nonContinuedLine,
smallSpacing,
M_PI,
static_cast<float>(M_PI),
textLeft,
textRight,
iconLeft,
@@ -63,7 +63,7 @@ TEST(getAnchors, NonContinuedLineLongLabels) {
TEST(getAnchors, ContinuedLineShortLabels) {
const Anchors anchors = getAnchors(
continuedLine, bigSpacing, M_PI, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
continuedLine, bigSpacing, static_cast<float>(M_PI), textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
const Anchors expected_anchors = {Anchor(1.0f, 2.0f, 1.570796371f, 1u),
Anchor(1.0f, 5.0f, 1.570796371f, 4u),
Anchor(1.0f, 8.0f, 1.570796371f, 7u)};
@@ -73,7 +73,7 @@ TEST(getAnchors, ContinuedLineShortLabels) {
TEST(getAnchors, ContinuedLineLongLabels) {
const Anchors anchors = getAnchors(
continuedLine, smallSpacing, M_PI, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
continuedLine, smallSpacing, static_cast<float>(M_PI), textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
const Anchors expected_anchors = {Anchor(1.0f, 1.0f, 1.570796371f, 1u),
Anchor(1.0f, 4.0f, 1.570796371f, 3u),
Anchor(1.0f, 6.0f, 1.570796371f, 6u)};
@@ -83,10 +83,10 @@ TEST(getAnchors, ContinuedLineLongLabels) {
TEST(getAnchors, OverscaledAnchorsInParent) {
const Anchors anchors = getAnchors(
nonContinuedLine, bigSpacing, M_PI, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
nonContinuedLine, bigSpacing, static_cast<float>(M_PI), textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
const Anchors childAnchors = getAnchors(nonContinuedLine,
bigSpacing / 2,
M_PI,
static_cast<float>(M_PI),
textLeft,
textRight,
iconLeft,
@@ -102,7 +102,7 @@ TEST(getAnchors, OverscaledAnchorsInParent) {
TEST(getAnchors, UseMidpointForShortLine) {
const GeometryCoordinates shortLine = {Point<int16_t>{1, 1}, Point<int16_t>{1, 3}};
const Anchors anchors = getAnchors(
shortLine, smallSpacing, M_PI, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
shortLine, smallSpacing, static_cast<float>(M_PI), textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale, overscaling);
const Anchors expected_anchors = {Anchor(1.0f, 2.0f, 1.570796371f, 0u)};
EXPECT_EQ(anchors, expected_anchors);
@@ -111,20 +111,20 @@ TEST(getAnchors, UseMidpointForShortLine) {
TEST(getAnchors, GetCenterAnchor) {
const GeometryCoordinates line = {
Point<int16_t>{1, 1}, Point<int16_t>{1, 3}, Point<int16_t>{3, 6}, Point<int16_t>{4, 7}};
const auto anchor = getCenterAnchor(line, M_PI, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale);
const auto anchor = getCenterAnchor(line, static_cast<float>(M_PI), textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale);
EXPECT_TRUE(anchor);
EXPECT_EQ(*anchor, Anchor(2.0f, 4.0f, .982793748f, 1u));
}
TEST(getAnchors, GetCenterAnchorOutsideTileBounds) {
const GeometryCoordinates line = {Point<int16_t>{-10, -10}, Point<int16_t>{5, 5}};
const auto anchor = getCenterAnchor(line, M_PI, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale);
const auto anchor = getCenterAnchor(line, static_cast<float>(M_PI), textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale);
EXPECT_TRUE(anchor);
EXPECT_EQ(*anchor, Anchor(-3.0f, -3.0f, .785398185f, 0u));
}
TEST(getAnchors, GetCenterAnchorFailMaxAngle) {
const GeometryCoordinates line = {Point<int16_t>{1, 1}, Point<int16_t>{1, 3}, Point<int16_t>{3, 3}};
const auto anchor = getCenterAnchor(line, M_PI / 4, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale);
const auto anchor = getCenterAnchor(line, static_cast<float>(M_PI) / 4, textLeft, textRight, iconLeft, iconRight, glyphSize, boxScale);
EXPECT_FALSE(anchor);
}

View File

@@ -255,7 +255,7 @@ TEST(GlyphManager, LoadLocalCJKGlyph) {
TEST(GlyphManager, LoadLocalCJKGlyphAfterLoadingRangeFromURL) {
GlyphManagerTest test;
int firstGlyphResponse = false;
bool firstGlyphResponse = false;
test.fileSource.glyphsResponse = [&] (const Resource&) {
firstGlyphResponse = true;

View File

@@ -86,13 +86,13 @@ TEST(getIconQuads, style) {
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -64.4444427);
EXPECT_FLOAT_EQ(quad.tl.x, -64.4444427f);
EXPECT_FLOAT_EQ(quad.tl.y, 0);
EXPECT_FLOAT_EQ(quad.tr.x, 24.4444427);
EXPECT_FLOAT_EQ(quad.tr.x, 24.4444427f);
EXPECT_FLOAT_EQ(quad.tr.y, 0);
EXPECT_FLOAT_EQ(quad.bl.x, -64.4444427);
EXPECT_FLOAT_EQ(quad.bl.x, -64.4444427f);
EXPECT_FLOAT_EQ(quad.bl.y, 20);
EXPECT_FLOAT_EQ(quad.br.x, 24.4444427);
EXPECT_FLOAT_EQ(quad.br.x, 24.4444427f);
EXPECT_FLOAT_EQ(quad.br.y, 20);
}
@@ -105,13 +105,13 @@ TEST(getIconQuads, style) {
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -32.2222214);
EXPECT_FLOAT_EQ(quad.tl.x, -32.2222214f);
EXPECT_FLOAT_EQ(quad.tl.y, -5);
EXPECT_FLOAT_EQ(quad.tr.x, 12.2222214);
EXPECT_FLOAT_EQ(quad.tr.x, 12.2222214f);
EXPECT_FLOAT_EQ(quad.tr.y, -5);
EXPECT_FLOAT_EQ(quad.bl.x, -32.2222214);
EXPECT_FLOAT_EQ(quad.bl.x, -32.2222214f);
EXPECT_FLOAT_EQ(quad.bl.y, 15);
EXPECT_FLOAT_EQ(quad.br.x, 12.2222214);
EXPECT_FLOAT_EQ(quad.br.x, 12.2222214f);
EXPECT_FLOAT_EQ(quad.br.y, 15);
}
@@ -124,13 +124,13 @@ TEST(getIconQuads, style) {
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -43.3333321);
EXPECT_FLOAT_EQ(quad.tl.x, -43.3333321f);
EXPECT_FLOAT_EQ(quad.tl.y, -5);
EXPECT_FLOAT_EQ(quad.tr.x, 23.3333321);
EXPECT_FLOAT_EQ(quad.tr.x, 23.3333321f);
EXPECT_FLOAT_EQ(quad.tr.y, -5);
EXPECT_FLOAT_EQ(quad.bl.x, -43.3333321);
EXPECT_FLOAT_EQ(quad.bl.x, -43.3333321f);
EXPECT_FLOAT_EQ(quad.bl.y, 15);
EXPECT_FLOAT_EQ(quad.br.x, 23.3333321);
EXPECT_FLOAT_EQ(quad.br.x, 23.3333321f);
EXPECT_FLOAT_EQ(quad.br.y, 15);
}
@@ -144,13 +144,13 @@ TEST(getIconQuads, style) {
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -30);
EXPECT_FLOAT_EQ(quad.tl.y, -12.2222214);
EXPECT_FLOAT_EQ(quad.tl.y, -12.2222214f);
EXPECT_FLOAT_EQ(quad.tr.x, -10);
EXPECT_FLOAT_EQ(quad.tr.y, -12.2222214);
EXPECT_FLOAT_EQ(quad.tr.y, -12.2222214f);
EXPECT_FLOAT_EQ(quad.bl.x, -30);
EXPECT_FLOAT_EQ(quad.bl.y, 32.2222214);
EXPECT_FLOAT_EQ(quad.bl.y, 32.2222214f);
EXPECT_FLOAT_EQ(quad.br.x, -10);
EXPECT_FLOAT_EQ(quad.br.y, 32.2222214);
EXPECT_FLOAT_EQ(quad.br.y, 32.2222214f);
}
// height x textSize
@@ -164,13 +164,13 @@ TEST(getIconQuads, style) {
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -20);
EXPECT_FLOAT_EQ(quad.tl.y, -6.11111069);
EXPECT_FLOAT_EQ(quad.tl.y, -6.11111069f);
EXPECT_FLOAT_EQ(quad.tr.x, 0);
EXPECT_FLOAT_EQ(quad.tr.y, -6.11111069);
EXPECT_FLOAT_EQ(quad.tr.y, -6.11111069f);
EXPECT_FLOAT_EQ(quad.bl.x, -20);
EXPECT_FLOAT_EQ(quad.bl.y, 16.1111107);
EXPECT_FLOAT_EQ(quad.bl.y, 16.1111107f);
EXPECT_FLOAT_EQ(quad.br.x, 0);
EXPECT_FLOAT_EQ(quad.br.y, 16.1111107);
EXPECT_FLOAT_EQ(quad.br.y, 16.1111107f);
}
// height x textSize + padding
@@ -183,13 +183,13 @@ TEST(getIconQuads, style) {
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -20);
EXPECT_FLOAT_EQ(quad.tl.y, -11.666666);
EXPECT_FLOAT_EQ(quad.tl.y, -11.666666f);
EXPECT_FLOAT_EQ(quad.tr.x, 0);
EXPECT_FLOAT_EQ(quad.tr.y, -11.666666);
EXPECT_FLOAT_EQ(quad.tr.y, -11.666666f);
EXPECT_FLOAT_EQ(quad.bl.x, -20);
EXPECT_FLOAT_EQ(quad.bl.y, 21.666666);
EXPECT_FLOAT_EQ(quad.bl.y, 21.666666f);
EXPECT_FLOAT_EQ(quad.br.x, 0);
EXPECT_FLOAT_EQ(quad.br.y, 21.666666);
EXPECT_FLOAT_EQ(quad.br.y, 21.666666f);
}
// both
@@ -201,14 +201,14 @@ TEST(getIconQuads, style) {
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -64.4444427);
EXPECT_FLOAT_EQ(quad.tl.y, -12.2222214);
EXPECT_FLOAT_EQ(quad.tr.x, 24.4444427);
EXPECT_FLOAT_EQ(quad.tr.y, -12.2222214);
EXPECT_FLOAT_EQ(quad.bl.x, -64.4444427);
EXPECT_FLOAT_EQ(quad.bl.y, 32.2222214);
EXPECT_FLOAT_EQ(quad.br.x, 24.4444427);
EXPECT_FLOAT_EQ(quad.br.y, 32.2222214);
EXPECT_FLOAT_EQ(quad.tl.x, -64.4444427f);
EXPECT_FLOAT_EQ(quad.tl.y, -12.2222214f);
EXPECT_FLOAT_EQ(quad.tr.x, 24.4444427f);
EXPECT_FLOAT_EQ(quad.tr.y, -12.2222214f);
EXPECT_FLOAT_EQ(quad.bl.x, -64.4444427f);
EXPECT_FLOAT_EQ(quad.bl.y, 32.2222214f);
EXPECT_FLOAT_EQ(quad.br.x, 24.4444427f);
EXPECT_FLOAT_EQ(quad.br.y, 32.2222214f);
}
// both x textSize
@@ -220,14 +220,14 @@ TEST(getIconQuads, style) {
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -32.2222214);
EXPECT_FLOAT_EQ(quad.tl.y, -6.11111069);
EXPECT_FLOAT_EQ(quad.tr.x, 12.2222214);
EXPECT_FLOAT_EQ(quad.tr.y, -6.11111069);
EXPECT_FLOAT_EQ(quad.bl.x, -32.2222214);
EXPECT_FLOAT_EQ(quad.bl.y, 16.1111107);
EXPECT_FLOAT_EQ(quad.br.x, 12.2222214);
EXPECT_FLOAT_EQ(quad.br.y, 16.1111107);
EXPECT_FLOAT_EQ(quad.tl.x, -32.2222214f);
EXPECT_FLOAT_EQ(quad.tl.y, -6.11111069f);
EXPECT_FLOAT_EQ(quad.tr.x, 12.2222214f);
EXPECT_FLOAT_EQ(quad.tr.y, -6.11111069f);
EXPECT_FLOAT_EQ(quad.bl.x, -32.2222214f);
EXPECT_FLOAT_EQ(quad.bl.y, 16.1111107f);
EXPECT_FLOAT_EQ(quad.br.x, 12.2222214f);
EXPECT_FLOAT_EQ(quad.br.y, 16.1111107f);
}
// both x textSize + padding
@@ -239,14 +239,14 @@ TEST(getIconQuads, style) {
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -43.3333321);
EXPECT_FLOAT_EQ(quad.tl.y, -11.666666);
EXPECT_FLOAT_EQ(quad.tr.x, 23.3333321);
EXPECT_FLOAT_EQ(quad.tr.y, -11.666666);
EXPECT_FLOAT_EQ(quad.bl.x, -43.3333321);
EXPECT_FLOAT_EQ(quad.bl.y, 21.666666);
EXPECT_FLOAT_EQ(quad.br.x, 23.3333321);
EXPECT_FLOAT_EQ(quad.br.y, 21.666666);
EXPECT_FLOAT_EQ(quad.tl.x, -43.3333321f);
EXPECT_FLOAT_EQ(quad.tl.y, -11.666666f);
EXPECT_FLOAT_EQ(quad.tr.x, 23.3333321f);
EXPECT_FLOAT_EQ(quad.tr.y, -11.666666f);
EXPECT_FLOAT_EQ(quad.bl.x, -43.3333321f);
EXPECT_FLOAT_EQ(quad.bl.y, 21.666666f);
EXPECT_FLOAT_EQ(quad.br.x, 23.3333321f);
EXPECT_FLOAT_EQ(quad.br.y, 21.666666f);
}
// both x textSize + padding t/r/b/l
@@ -260,13 +260,13 @@ TEST(getIconQuads, style) {
ASSERT_EQ(quads.size(), 1);
const auto& quad = quads[0];
EXPECT_FLOAT_EQ(quad.tl.x, -48.3333321);
EXPECT_FLOAT_EQ(quad.tl.y, -6.66666603);
EXPECT_FLOAT_EQ(quad.tr.x, 18.3333321);
EXPECT_FLOAT_EQ(quad.tr.y, -6.66666603);
EXPECT_FLOAT_EQ(quad.bl.x, -48.3333321);
EXPECT_FLOAT_EQ(quad.bl.y, 26.666666);
EXPECT_FLOAT_EQ(quad.br.x, 18.3333321);
EXPECT_FLOAT_EQ(quad.br.y, 26.666666);
EXPECT_FLOAT_EQ(quad.tl.x, -48.3333321f);
EXPECT_FLOAT_EQ(quad.tl.y, -6.66666603f);
EXPECT_FLOAT_EQ(quad.tr.x, 18.3333321f);
EXPECT_FLOAT_EQ(quad.tr.y, -6.66666603f);
EXPECT_FLOAT_EQ(quad.bl.x, -48.3333321f);
EXPECT_FLOAT_EQ(quad.bl.y, 26.666666f);
EXPECT_FLOAT_EQ(quad.br.x, 18.3333321f);
EXPECT_FLOAT_EQ(quad.br.y, 26.666666f);
}
}