From 888c9082ce032935e35541dcca94b7de839895c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryszard=20Wi=C5=9Bniewski?= Date: Tue, 3 May 2011 02:26:40 +0200 Subject: [PATCH] Added many new literal and reference tests. --- .../brut/androlib/BuildAndDecodeTest.java | 43 +++++++++++++++++-- .../apktool/testapp/res/layout/layout1.xml | 19 -------- .../testapp/res/values-mcc001/arrays.xml | 22 ++++++++++ .../testapp/res/values-mcc001/bools.xml | 5 +++ .../testapp/res/values-mcc001/colors.xml | 4 ++ .../testapp/res/values-mcc001/dimens.xml | 9 ++++ .../apktool/testapp/res/values-mcc001/ids.xml | 5 +++ .../testapp/res/values-mcc001/integers.xml | 6 +++ .../testapp/res/values-mcc001/strings.xml | 11 ++--- .../testapp/res/values-mcc002/strings.xml | 4 +- .../brut/apktool/testapp/res/xml/literals.xml | 9 ++++ .../apktool/testapp/res/xml/references.xml | 6 +++ 12 files changed, 114 insertions(+), 29 deletions(-) delete mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/layout/layout1.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/arrays.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/bools.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/colors.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/dimens.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/ids.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/integers.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/literals.xml create mode 100644 apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/references.xml diff --git a/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java b/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java index d8b81cdf..b079cb70 100644 --- a/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java +++ b/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java @@ -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 { diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/layout/layout1.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/layout/layout1.xml deleted file mode 100644 index 6685f20d..00000000 --- a/apktool-lib/src/test/resources/brut/apktool/testapp/res/layout/layout1.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/arrays.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/arrays.xml new file mode 100644 index 00000000..aed93e4c --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/arrays.xml @@ -0,0 +1,22 @@ + + + + TEST1 + TEST2 + TEST3 + + + -1 + 0 + 1 + + + + true + TEST + 5 + 5.5 + 10.0sp + #ff123456 + + diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/bools.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/bools.xml new file mode 100644 index 00000000..787bfcad --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/bools.xml @@ -0,0 +1,5 @@ + + + false + true + diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/colors.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/colors.xml new file mode 100644 index 00000000..00dfdb0f --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/colors.xml @@ -0,0 +1,4 @@ + + + #ff123456 + diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/dimens.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/dimens.xml new file mode 100644 index 00000000..2a3a6440 --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/dimens.xml @@ -0,0 +1,9 @@ + + + 10.0dip + 10.0sp + 10.0pt + 10.0px + 10.0mm + 10.0in + diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/ids.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/ids.xml new file mode 100644 index 00000000..1d2724aa --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/ids.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/integers.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/integers.xml new file mode 100644 index 00000000..d672d18a --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/integers.xml @@ -0,0 +1,6 @@ + + + -1 + 0 + 1 + diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/strings.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/strings.xml index f4e44dc0..c1bcc95d 100644 --- a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/strings.xml +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc001/strings.xml @@ -1,8 +1,9 @@ - - Lorem ipsum... - \@ - \? - & + + Lorem ipsum... + \@ + \? + \#ff123456 + & diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc002/strings.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc002/strings.xml index a3521932..843a88ca 100644 --- a/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc002/strings.xml +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/values-mcc002/strings.xml @@ -1,4 +1,6 @@ - @android:string/ok + @string/test1 + @android:string/ok + ?android:textStyle diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/literals.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/literals.xml new file mode 100644 index 00000000..42624872 --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/literals.xml @@ -0,0 +1,9 @@ + + diff --git a/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/references.xml b/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/references.xml new file mode 100644 index 00000000..ebf6ed43 --- /dev/null +++ b/apktool-lib/src/test/resources/brut/apktool/testapp/res/xml/references.xml @@ -0,0 +1,6 @@ + +