| 8 | using namespace service::geometry; |
| 9 | |
| 10 | TEST(GeometryUtils, CornerAtPoint) |
| 11 | { |
| 12 | // outside |
| 13 | { |
| 14 | const auto testee = cornerAtPoint({0, 0}, {10, 10}, {10, 10, 50, 50}); |
| 15 | EXPECT_EQ(QPoint(10, 10), testee); |
| 16 | } |
| 17 | { |
| 18 | const auto testee = cornerAtPoint({200, 200}, {10, 10}, {10, 10, 50, 50}); |
| 19 | EXPECT_EQ(QPoint(50, 50), testee); |
| 20 | } |
| 21 | { |
| 22 | const auto testee = cornerAtPoint({200, 20}, {10, 10}, {10, 10, 50, 50}); |
| 23 | EXPECT_EQ(QPoint(50, 20), testee); |
| 24 | } |
| 25 | |
| 26 | // top left |
| 27 | { |
| 28 | const auto testee = cornerAtPoint({10, 10}, {10, 10}, {0, 0, 100, 100}); |
| 29 | EXPECT_EQ(QPoint(10, 10), testee); |
| 30 | } |
| 31 | // top right |
| 32 | { |
| 33 | const auto testee = cornerAtPoint({95, 10}, {10, 10}, {0, 0, 100, 100}); |
| 34 | EXPECT_EQ(QPoint(86, 10), testee); |
| 35 | } |
| 36 | // bottom left |
| 37 | { |
| 38 | const auto testee = cornerAtPoint({10, 95}, {10, 10}, {0, 0, 100, 100}); |
| 39 | EXPECT_EQ(QPoint(10, 86), testee); |
| 40 | } |
| 41 | // bottom right |
| 42 | { |
| 43 | const auto testee = cornerAtPoint({95, 95}, {10, 10}, {0, 0, 100, 100}); |
| 44 | EXPECT_EQ(QPoint(86, 86), testee); |
| 45 | } |
| 46 | } |
nothing calls this directly
no test coverage detected