Added many new literal and reference tests.

This commit is contained in:
Ryszard Wiśniewski 2011-05-03 02:26:40 +02:00
parent 018c40b72a
commit 888c9082ce
12 changed files with 114 additions and 29 deletions

View File

@ -58,12 +58,42 @@ public class BuildAndDecodeTest {
}
@Test
public void literalStringsTest() throws BrutException {
public void valuesArraysTest() throws BrutException {
compareValuesFiles("values-mcc001/arrays.xml");
}
@Test
public void valuesBoolsTest() throws BrutException {
compareValuesFiles("values-mcc001/bools.xml");
}
@Test
public void valuesColorsTest() throws BrutException {
compareValuesFiles("values-mcc001/colors.xml");
}
@Test
public void valuesDimensTest() throws BrutException {
compareValuesFiles("values-mcc001/dimens.xml");
}
@Test
public void valuesIdsTest() throws BrutException {
compareValuesFiles("values-mcc001/ids.xml");
}
@Test
public void valuesIntegersTest() throws BrutException {
compareValuesFiles("values-mcc001/integers.xml");
}
@Test
public void valuesStringsTest() throws BrutException {
compareValuesFiles("values-mcc001/strings.xml");
}
@Test
public void referenceStringsTest() throws BrutException {
public void valuesReferencesTest() throws BrutException {
compareValuesFiles("values-mcc002/strings.xml");
}
@ -75,8 +105,13 @@ public class BuildAndDecodeTest {
}
@Test
public void layout1Test() throws BrutException {
compareXmlFiles("res/layout/layout1.xml");
public void xmlLiteralsTest() throws BrutException {
compareXmlFiles("res/xml/literals.xml");
}
@Test
public void xmlReferencesTest() throws BrutException {
compareXmlFiles("res/xml/references.xml");
}
private void compareValuesFiles(String path) throws BrutException {

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/test1"
test1="@string/test1"
style="?android:textStyle"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@android:string/ok"
/>
</LinearLayout>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="test_array1">
<item>TEST1</item>
<item>TEST2</item>
<item>TEST3</item>
</string-array>
<integer-array name="test_array2">
<item>-1</item>
<item>0</item>
<item>1</item>
</integer-array>
<array name="test_array3">
<item></item>
<item>true</item>
<item>TEST</item>
<item>5</item>
<item>5.5</item>
<item>10.0sp</item>
<item>#ff123456</item>
</array>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="test_bool1">false</bool>
<bool name="test_bool2">true</bool>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="test_color1">#ff123456</color>
</resources>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="test_dimen1">10.0dip</dimen>
<dimen name="test_dimen2">10.0sp</dimen>
<dimen name="test_dimen3">10.0pt</dimen>
<dimen name="test_dimen4">10.0px</dimen>
<dimen name="test_dimen5">10.0mm</dimen>
<dimen name="test_dimen6">10.0in</dimen>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="test_id1" />
<item type="id" name="test_id2" />
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="test_integer1">-1</integer>
<integer name="test_integer2">0</integer>
<integer name="test_integer3">1</integer>
</resources>

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test_literal1"></string>
<string name="test_literal2">Lorem ipsum...</string>
<string name="test_literal3">\@</string>
<string name="test_literal4">\?</string>
<string name="test_literal5">&amp;</string>
<string name="test_string1"></string>
<string name="test_string2">Lorem ipsum...</string>
<string name="test_string3">\@</string>
<string name="test_string4">\?</string>
<string name="test_string5">\#ff123456</string>
<string name="test_string6">&amp;</string>
</resources>

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test_reference1">@android:string/ok</string>
<string name="test_reference1">@string/test1</string>
<string name="test_reference2">@android:string/ok</string>
<string name="test_reference3">?android:textStyle</string>
</resources>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
test1=""
test2="Lorem ipsum"
test3="\@"
test4="\?"
test5="&amp;"
test6="\#"
/>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
test1="@string/test1"
test2="@android:string/ok"
test3="?android:textStyle"
/>