diff --git a/generator/generator_tests/transit_test.cpp b/generator/generator_tests/transit_test.cpp index 33aa9a6117..eb9927b09b 100644 --- a/generator/generator_tests/transit_test.cpp +++ b/generator/generator_tests/transit_test.cpp @@ -31,6 +31,22 @@ void TestDeserializerFromJson(string const & jsonBuffer, string const & name, ve TEST(objects[i].IsEqualForTesting(expected[i]), (objects[i], expected[i])); } +UNIT_TEST(DeserializerFromJson_TitleAnchors) +{ + string const jsonBuffer = R"( + { + "title_anchors": [ + { "min_zoom": 11, "anchors": "r" }, + { "min_zoom": 14, "anchors": "bl" } + ]})"; + + vector expected = { + TitleAnchor(11 /* min zoom */, "r" /* anchors */), + TitleAnchor(14 /* min zoom */, "bl" /* anchors */) + }; + TestDeserializerFromJson(jsonBuffer, "title_anchors", expected); +} + UNIT_TEST(DeserializerFromJson_Stops) { string const jsonBuffer = R"( @@ -60,15 +76,19 @@ UNIT_TEST(DeserializerFromJson_Stops) "x": 27.5227942, "y": 64.25206634443111 }, - "title_anchors": [] + "title_anchors": [ + { "min_zoom": 12, "anchors": "t" }, + { "min_zoom": 15, "anchors": "tl" }] } ]})"; vector const expected = { Stop(343259523 /* id */, 1234 /* featureId */, kInvalidTransferId /* transfer id */, - {19207936, 19207937} /* lineIds */, {27.4970954, 64.20146835878187} /* point */), + {19207936, 19207937} /* lineIds */, {27.4970954, 64.20146835878187} /* point */, + {} /* anchors */), Stop(266680843 /* id */, 2345 /* featureId */, 5 /* transfer id */, - {19213568, 19213569} /* lineIds */, {27.5227942, 64.25206634443111} /* point */)}; + {19213568, 19213569} /* lineIds */, {27.5227942, 64.25206634443111} /* point */, + { TitleAnchor(12 /* min zoom */, "t" /* anchors */), TitleAnchor(15, "tl")} /* anchors */)}; TestDeserializerFromJson(jsonBuffer, "stops", expected); } @@ -162,7 +182,7 @@ UNIT_TEST(DeserializerFromJson_Transfers) vector const expected = {Transfer(922337203 /* stop id */, {27.5619844, 64.24325959173672} /* point */, - {209186416, 277039518} /* stopIds */)}; + {209186416, 277039518} /* stopIds */, {} /* anchors */)}; TestDeserializerFromJson(jsonBuffer, "transfers", expected); } diff --git a/routing_common/routing_common_tests/transit_test.cpp b/routing_common/routing_common_tests/transit_test.cpp index 6b85c6182f..96aa6a765f 100644 --- a/routing_common/routing_common_tests/transit_test.cpp +++ b/routing_common/routing_common_tests/transit_test.cpp @@ -53,6 +53,22 @@ UNIT_TEST(Transit_HeaderSerialization) } } +UNIT_TEST(Transit_TitleAnchorSerialization) +{ + { + TitleAnchor anchor(17 /* min zoom */, "t" /* anchors */); + TestSerialization(anchor); + } + { + TitleAnchor anchor(10 /* min zoom */, "b" /* anchors */); + TestSerialization(anchor); + } + { + TitleAnchor anchor(18 /* min zoom */, "bl" /* anchors */); + TestSerialization(anchor); + } +} + UNIT_TEST(Transit_StopSerialization) { { @@ -60,11 +76,24 @@ UNIT_TEST(Transit_StopSerialization) TestSerialization(stop); } { - Stop stop(1234 /* id */, 5678 /* feature id */, 7 /* transfer id */, {7, 8, 9, 10} /* line id */, {55.0, 37.0}); + Stop stop(1234 /* id */, 5678 /* feature id */, 7 /* transfer id */, {7, 8, 9, 10} /* line id */, + {55.0, 37.0} /* point */, {} /* anchors */); TestSerialization(stop); } } +UNIT_TEST(Transit_SingleMwmSegmentSerialization) +{ + { + SingleMwmSegment s(12344 /* feature id */, 0 /* segmentIdx */, true /* forward */); + TestSerialization(s); + } + { + SingleMwmSegment s(12544 /* feature id */, 5 /* segmentIdx */, false /* forward */); + TestSerialization(s); + } +} + UNIT_TEST(Transit_GateSerialization) { Gate gate(12345 /* feature id */, true /* entrance */, false /* exit */, 117.8 /* weight */, @@ -81,7 +110,8 @@ UNIT_TEST(Transit_EdgeSerialization) UNIT_TEST(Transit_TransferSerialization) { - Transfer transfer(1 /* id */, {40.0, 35.0} /* point */, {1, 2, 3} /* stop ids */); + Transfer transfer(1 /* id */, {40.0, 35.0} /* point */, {1, 2, 3} /* stop ids */, + { TitleAnchor(16, "br")}); TestSerialization(transfer); }