[editor] Fixed tests

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2023-02-07 22:43:54 +01:00
parent 7047309682
commit a73e6f1306
2 changed files with 6 additions and 11 deletions

View file

@ -159,6 +159,7 @@
<field_ref name="housenumber" />
<field_ref name="level" />
<field_ref name="opening_hours" />
<field_ref name="internet" />
<field_ref name="phone" />
<field_ref name="email" />
<field_ref name="website" />
@ -166,7 +167,6 @@
<field_ref name="contact_instagram" />
<field_ref name="contact_twitter" />
<field_ref name="contact_vk" />
<field_ref name="internet" />
</field_group>
</fields>
<!-- Types should be sorted by their priority. -->

View file

@ -10,10 +10,11 @@ UNIT_TEST(EditorConfig_TypeDescription)
using EType = feature::Metadata::EType;
using Fields = editor::TypeAggregatedDescription::FeatureFields;
Fields const poi = {
Fields const poiInternet = {
EType::FMD_OPEN_HOURS,
EType::FMD_PHONE_NUMBER,
EType::FMD_WEBSITE,
EType::FMD_INTERNET,
EType::FMD_EMAIL,
EType::FMD_LEVEL,
EType::FMD_CONTACT_FACEBOOK,
@ -44,10 +45,7 @@ UNIT_TEST(EditorConfig_TypeDescription)
TEST(config.GetTypeDescription({"shop-toys"}, desc), ());
TEST(desc.IsNameEditable(), ());
TEST(desc.IsAddressEditable(), ());
auto fields = poi;
fields.push_back(EType::FMD_INTERNET);
base::SortUnique(fields);
TEST_EQUAL(desc.GetEditableFields(), fields, ());
TEST_EQUAL(desc.GetEditableFields(), poiInternet, ());
}
{
// Test that amenity-bank is selected as it goes first in config.
@ -55,17 +53,14 @@ UNIT_TEST(EditorConfig_TypeDescription)
TEST(config.GetTypeDescription({"amenity-bicycle_rental", "amenity-bank"}, desc), ());
TEST(desc.IsNameEditable(), ());
TEST(desc.IsAddressEditable(), ());
auto fields = poi;
fields.push_back(EType::FMD_INTERNET);
base::SortUnique(fields);
TEST_EQUAL(desc.GetEditableFields(), fields, ());
TEST_EQUAL(desc.GetEditableFields(), poiInternet, ());
}
{
// Testing type inheritance
editor::TypeAggregatedDescription desc;
TEST(config.GetTypeDescription({"amenity-place_of_worship-christian"}, desc), ());
TEST(desc.IsNameEditable(), ());
TEST_EQUAL(desc.GetEditableFields(), poi, ());
TEST_EQUAL(desc.GetEditableFields(), poiInternet, ());
}
{
// Testing long type inheritance on a fake object