summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-12-10 21:12:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-10 21:12:04 +0000
commitc78018774503308e8c8266f6769c9e4c895f3a97 (patch)
treec8d2e64fbea4fc28907ef345ede9588950c959c2 /libs
parent4ef9edeb67a1aa25b4ec57b9951b8dc4a06c3691 (diff)
parent5dce5e67dbdcd14882edf3f64fba671c77577ee4 (diff)
downloadframeworks_base-c78018774503308e8c8266f6769c9e4c895f3a97.zip
frameworks_base-c78018774503308e8c8266f6769c9e4c895f3a97.tar.gz
frameworks_base-c78018774503308e8c8266f6769c9e4c895f3a97.tar.bz2
Merge "Fix issue where non-resource attributes would cause obtainStyleAttributes to fail" into lmp-mr1-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/tests/AttributeFinder_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/androidfw/tests/AttributeFinder_test.cpp b/libs/androidfw/tests/AttributeFinder_test.cpp
index 664709c..5054624 100644
--- a/libs/androidfw/tests/AttributeFinder_test.cpp
+++ b/libs/androidfw/tests/AttributeFinder_test.cpp
@@ -50,6 +50,10 @@ static const uint32_t packageUnsortedAttributes[] = {
0x01010002, 0x01010004, 0x7f010001
};
+static const uint32_t singlePackageAttributes[] = {
+ 0x7f010007, 0x7f01000a, 0x7f01000d, 0x00000000
+};
+
TEST(AttributeFinderTest, IteratesSequentially) {
const int end = sizeof(sortedAttributes) / sizeof(*sortedAttributes);
MockAttributeFinder finder(sortedAttributes, end);
@@ -109,3 +113,16 @@ TEST(AttributeFinderTest, FindAttributesInPackageUnsortedAttributeList) {
EXPECT_EQ(1, finder.find(0x02010010));
EXPECT_EQ(6, finder.find(0x7f010001));
}
+
+TEST(AttributeFinderTest, FindAttributesInSinglePackageAttributeList) {
+ const int end = sizeof(singlePackageAttributes) / sizeof(*singlePackageAttributes);
+ MockAttributeFinder finder(singlePackageAttributes, end);
+
+ EXPECT_EQ(end, finder.find(0x010100f4));
+ EXPECT_EQ(end, finder.find(0x010100f5));
+ EXPECT_EQ(end, finder.find(0x010100f6));
+ EXPECT_EQ(end, finder.find(0x010100f7));
+ EXPECT_EQ(end, finder.find(0x010100f8));
+ EXPECT_EQ(end, finder.find(0x010100fa));
+ EXPECT_EQ(0, finder.find(0x7f010007));
+}