diff options
author | 2017-05-15 19:39:36 +0200 | |
---|---|---|
committer | 2017-05-15 23:20:33 +0200 | |
commit | 4ae59984ec23c06e04e4de3888dd5d5b255ef22e (patch) | |
tree | d735688621859dc882aa3313500ecd009b808754 /src/test/java | |
parent | 866ecc8c3d5e0b899e3f0c9c6b2265f16daae842 (diff) |
Convert locale qualifiers from old Aapt format to correct format before parsing
Aapt used to require resource locale qualifiers with regions of the form
'en_US', rather than the correct Android 'en-rUS'. The resource qualifier
processing code used by ResourceFilter cannot handle the (incorrect) Aapt
format.
However, for backwards compatability, we want to continue supporting the Aapt
format. Handle it by using a regex to replace the old format with the correct
format when parsing.
RELNOTES: none
PiperOrigin-RevId: 156072395
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java index 4948c8bfa5..a06521393e 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidBinaryTest.java @@ -1164,6 +1164,22 @@ public class AndroidBinaryTest extends AndroidBuildViewTestCase { } @Test + public void testFilteredResourcesOldAaptLocale() throws Exception { + testDirectResourceFiltering( + "en_US,fr_CA", + /* unexepectedQualifiers= */ ImmutableList.of("en-rCA"), + /* expectedQualifiers = */ ImmutableList.of("en-rUS", "fr-rCA")); + } + + @Test + public void testFilteredResourcesOldAaptLocaleOtherQualifiers() throws Exception { + testDirectResourceFiltering( + "mcc310-en_US-ldrtl,mcc311-mnc312-fr_CA", + /* unexepectedQualifiers= */ ImmutableList.of("en-rCA", "mcc312", "mcc311-mnc311"), + /* expectedQualifiers = */ ImmutableList.of("en-rUS", "fr-rCA", "mcc310", "mcc311-mnc312")); + } + + @Test public void testFilteredResourcesSmallestScreenWidth() throws Exception { testDirectResourceFiltering( "sw600dp", |