Commit c27ce8eb authored by estade@chromium.org's avatar estade@chromium.org

Update libaddressinput's US address format

BUG=333372

Review URL: https://codereview.chromium.org/135853023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245644 0039d316-1c4b-4281-b951-d872f2087c98
parent 4ac28e96
...@@ -1085,9 +1085,11 @@ std::map<std::string, std::string> InitRegionData() { ...@@ -1085,9 +1085,11 @@ std::map<std::string, std::string> InitRegionData() {
region_data.insert(std::make_pair("UG", "{" region_data.insert(std::make_pair("UG", "{"
"\"name\":\"UGANDA\"" "\"name\":\"UGANDA\""
"}")); "}"));
// NOTE: The fmt value for UM and US differs from the i18napis fmt by the
// insertion of a comma separating city and state.
region_data.insert(std::make_pair("UM", "{" region_data.insert(std::make_pair("UM", "{"
"\"name\":\"UNITED STATES MINOR OUTLYING ISLANDS\"," "\"name\":\"UNITED STATES MINOR OUTLYING ISLANDS\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\"," "\"fmt\":\"%N%n%O%n%A%n%C, %S %Z\","
"\"zip_name_type\":\"zip\"," "\"zip_name_type\":\"zip\","
"\"state_name_type\":\"state\"" "\"state_name_type\":\"state\""
"}")); "}"));
...@@ -1095,7 +1097,7 @@ std::map<std::string, std::string> InitRegionData() { ...@@ -1095,7 +1097,7 @@ std::map<std::string, std::string> InitRegionData() {
"\"name\":\"UNITED STATES\"," "\"name\":\"UNITED STATES\","
"\"lang\":\"en\"," "\"lang\":\"en\","
"\"languages\":\"en\"," "\"languages\":\"en\","
"\"fmt\":\"%N%n%O%n%A%n%C %S %Z\"," "\"fmt\":\"%N%n%O%n%A%n%C, %S %Z\","
"\"zip_name_type\":\"zip\"," "\"zip_name_type\":\"zip\","
"\"state_name_type\":\"state\"" "\"state_name_type\":\"state\""
"}")); "}"));
......
...@@ -30,6 +30,32 @@ TEST(AddressDataTest, FormatForDisplayEmpty) { ...@@ -30,6 +30,32 @@ TEST(AddressDataTest, FormatForDisplayEmpty) {
EXPECT_EQ(std::vector<std::string>(), actual); EXPECT_EQ(std::vector<std::string>(), actual);
} }
TEST(AddressDataTest, FormatForDisplayUs) {
AddressData address;
address.country_code = "US";
address.administrative_area = "Texas";
address.locality = "Houston";
address.postal_code = "77005";
address.address_lines.push_back("123 Main St");
address.address_lines.push_back("Apt 2");
address.organization = "ACME Corp.";
address.recipient = "John Doe";
std::vector<std::string> actual;
address.FormatForDisplay(&actual);
std::vector<std::string> expected;
expected.push_back(address.recipient);
expected.push_back(address.organization);
expected.insert(expected.end(),
address.address_lines.begin(),
address.address_lines.end());
expected.push_back(address.locality + ", " + address.administrative_area +
" " + address.postal_code);
EXPECT_EQ(expected, actual);
}
TEST(AddressDataTest, FormatForDisplayAr) { TEST(AddressDataTest, FormatForDisplayAr) {
AddressData address; AddressData address;
address.country_code = "AR"; address.country_code = "AR";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment