From 34723087fe79349607e3128707f0739e5e230a77 Mon Sep 17 00:00:00 2001 From: xunchang Date: Mon, 22 Apr 2019 15:32:17 -0700 Subject: matches_locale no longer accept empty locales in the png file The legacy png files have an empty line in the end. And the recovery used to match any missing locale, e.g. "he" with that line and gets an empty image. Since the empty image is barely useful, we should just error out and fall back to the default locale. This reversed the unit test check added in d17a6885253da909e376ba5ca5084f5281f3557c Bug: 128934634 Test: run locale test with "he" and legacy images, recovery reports error and doesn't crash even without default locale fall back Change-Id: Ibdb7dd0b42348de5e392c834cce67ff02be85c24 --- tests/unit/locale_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/unit/locale_test.cpp') diff --git a/tests/unit/locale_test.cpp b/tests/unit/locale_test.cpp index cdaba0e8b..c69434c12 100644 --- a/tests/unit/locale_test.cpp +++ b/tests/unit/locale_test.cpp @@ -27,7 +27,7 @@ TEST(LocaleTest, Misc) { EXPECT_FALSE(matches_locale("en-GB", "en")); EXPECT_FALSE(matches_locale("en-GB", "en-US")); EXPECT_FALSE(matches_locale("en-US", "")); - // Empty locale prefix in the PNG file will match the input locale. - EXPECT_TRUE(matches_locale("", "en-US")); + // Empty locale prefix in the PNG file should not match the input locale. + EXPECT_FALSE(matches_locale("", "en-US")); EXPECT_TRUE(matches_locale("sr-Latn", "sr-Latn-BA")); } -- cgit v1.2.3