diff options
author | Lauren Budorick <lauren@mapbox.com> | 2017-04-08 10:54:56 -0700 |
---|---|---|
committer | Lauren Budorick <lauren@mapbox.com> | 2017-04-24 17:09:09 -0700 |
commit | ac911d65f8c54db9762d4a6ede5284f59591f4ff (patch) | |
tree | d7eaabab2ea6b9a763695e3a02e747a5db9f28b7 | |
parent | 3d78137995dff386f3bc6506dea799945b72befc (diff) | |
download | qtlocation-mapboxgl-ac911d65f8c54db9762d4a6ede5284f59591f4ff.tar.gz |
Fix broken Position tests from constructor change
-rw-r--r-- | test/style/conversion/light.test.cpp | 3 | ||||
-rw-r--r-- | test/util/position.test.cpp | 19 |
2 files changed, 14 insertions, 8 deletions
diff --git a/test/style/conversion/light.test.cpp b/test/style/conversion/light.test.cpp index 968889a339..37c41cfc89 100644 --- a/test/style/conversion/light.test.cpp +++ b/test/style/conversion/light.test.cpp @@ -48,7 +48,8 @@ TEST(StyleConversion, Light) { ASSERT_FALSE(light->get<LightPosition>().isUndefined()); ASSERT_TRUE(light->get<LightPosition>().isConstant()); - ASSERT_EQ(light->get<LightPosition>().asConstant(), mbgl::style::Position({{{ 3, 90, 90 }}})); + std::array<float, 3> expected{{ 3, 90, 90 }}; + ASSERT_EQ(light->get<LightPosition>().asConstant(), mbgl::style::Position({ expected })); ASSERT_FALSE(light->get<LightPosition>().isCameraFunction()); } diff --git a/test/util/position.test.cpp b/test/util/position.test.cpp index d1edf2db54..7b2d5397d4 100644 --- a/test/util/position.test.cpp +++ b/test/util/position.test.cpp @@ -23,22 +23,27 @@ auto ARR_NE = [](std::array<float, 3> got, std::array<float, 3> expected) { EXPECT_NE(eq, 3); }; +Position createPosition(std::array<float, 3> pos) { + return Position(pos); +} + TEST(Position, Calculations) { std::array<float, 3> spherical{{ 2, 10, 270 }}; Position position(spherical); - ARR_NE(position.get(), spherical); + ARR_NE(position.getCartesian(), spherical); ARR_EQ(position.getSpherical(), spherical); - ARR_EQ(position.get(), {{ 0.34729638695716858, -1.9696154594421387, 2.384976127700611e-08 }}); + ARR_EQ(position.getCartesian(), {{ 0.34729638695716858, -1.9696154594421387, 2.384976127700611e-08 }}); - ARR_NE(Position{{{ 2, 30, 10 }}}.getSpherical(), Position{{{ 2, 30, 370 }}}.getSpherical()); - ARR_EQ(Position{{{ 2, 30, 10 }}}.get(), Position{{{ 2, 30, 370 }}}.get()); + ARR_NE(createPosition({{ 2, 30, 10 }}).getSpherical(), createPosition({{ 2, 30, 370 }}).getSpherical()); + ARR_EQ(createPosition({{ 2, 30, 10 }}).getCartesian(), createPosition({{ 2, 30, 370 }}).getCartesian()); - position.set({{ 1, 80, 270 }}); + std::array<float, 3> newSpherical = {{ 1, 80, 270 }}; + position.set(newSpherical); ARR_NE(position.getSpherical(), spherical); - ARR_NE(position.get(), {{ 0.34729638695716858, -1.9696154594421387, 2.384976127700611e-08 }}); - ARR_EQ(position.get(), {{ 0.98480772972106934, -0.17364829778671265, 1.1924880638503055e-08 }}); + ARR_NE(position.getCartesian(), {{ 0.34729638695716858, -1.9696154594421387, 2.384976127700611e-08 }}); + ARR_EQ(position.getCartesian(), {{ 0.98480772972106934, -0.17364829778671265, 1.1924880638503055e-08 }}); } |