Prefix integers only exceeding 9 digits to treat as string

- This prevents small numbers like "1" to become "\ 1"
 - added unit tests
 - fixes #1130
This commit is contained in:
Connor Tumbleson 2016-02-10 08:05:54 -05:00
parent e82ef1034a
commit f3e21023ac
3 changed files with 13 additions and 1 deletions

View File

@ -71,5 +71,5 @@ public class ResStringValue extends ResScalarValue {
return allDigits.matcher(val).matches() ? "\\ " + val : val;
}
private static Pattern allDigits = Pattern.compile("\\d+");
private static Pattern allDigits = Pattern.compile("\\d{9,}");
}

View File

@ -181,6 +181,11 @@ public class BuildAndDecodeTest {
compareXmlFiles("res/layout/issue1063.xml");
}
@Test
public void xmlSmallNumbersDontEscapeTest() throws BrutException {
compareXmlFiles("res/layout/issue1130.xml");
}
@Test
public void qualifiersTest() throws BrutException {
compareValuesFiles("values-mcc004-mnc4-en-rUS-ldrtl-sw100dp-w200dp-h300dp"

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<TableLayout android:shrinkColumns="1" />
<TableLayout android:shrinkColumns="\ 2147483647" />
<TableLayout android:shrinkColumns="\ 2147483648" />
<TableLayout android:shrinkColumns="\ 555555555555555555" />
</LinearLayout>