summaryrefslogtreecommitdiff
path: root/tools/aapt2/SdkConstants_test.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-05-17 19:28:38 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-05-24 15:14:29 -0700
commitc744ae8aca97edfb2422598ea620e8219449fa9b (patch)
tree4e7c29d6b47c464dd5aa0af204d86a7340b0084f /tools/aapt2/SdkConstants_test.cpp
parent0418b72fd2c91f32c42e3a406df2a866888fc766 (diff)
AAPT2: Implement attribute compat versioning
This change defines some hardcoded rules to degrade attributes in newer SDKs to specific older attributes. An attribute with a degrade rule will generate a new XML for the API in which the attribute resulting from the degradation was introduced. Since API 22 (Lollipop MR1), attributes are correctly ignored and do not need to be versioned. In XML files defined for APIs 22+, the original and degraded attributes coexist in the same XML file. One such example is paddingHorizontal, introduced in API 26. paddingHorizontal degrades to paddingLeft and paddingRight, which were both introduced in API 1. Bug: 35763493 Test: make aapt2_tests Change-Id: I4aa8755a9ee2c0cc5afdc55c3d30093fd3a47f3d
Diffstat (limited to 'tools/aapt2/SdkConstants_test.cpp')
-rw-r--r--tools/aapt2/SdkConstants_test.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/tools/aapt2/SdkConstants_test.cpp b/tools/aapt2/SdkConstants_test.cpp
index 716d922fb5a0..61f4d71b7fb2 100644
--- a/tools/aapt2/SdkConstants_test.cpp
+++ b/tools/aapt2/SdkConstants_test.cpp
@@ -21,18 +21,11 @@
namespace aapt {
TEST(SdkConstantsTest, FirstAttributeIsSdk1) {
- EXPECT_EQ(1u, FindAttributeSdkLevel(ResourceId(0x01010000)));
+ EXPECT_EQ(1, FindAttributeSdkLevel(ResourceId(0x01010000)));
}
-TEST(SdkConstantsTest, AllAttributesAfterLollipopAreLollipopMR1) {
- EXPECT_EQ(SDK_LOLLIPOP, FindAttributeSdkLevel(ResourceId(0x010103f7)));
- EXPECT_EQ(SDK_LOLLIPOP, FindAttributeSdkLevel(ResourceId(0x010104ce)));
-
- EXPECT_EQ(SDK_LOLLIPOP_MR1, FindAttributeSdkLevel(ResourceId(0x010104cf)));
- EXPECT_EQ(SDK_LOLLIPOP_MR1, FindAttributeSdkLevel(ResourceId(0x010104d8)));
-
- EXPECT_EQ(SDK_LOLLIPOP_MR1, FindAttributeSdkLevel(ResourceId(0x010104d9)));
- EXPECT_EQ(SDK_LOLLIPOP_MR1, FindAttributeSdkLevel(ResourceId(0x0101ffff)));
+TEST(SdkConstantsTest, NonFrameworkAttributeIsSdk0) {
+ EXPECT_EQ(0, FindAttributeSdkLevel(ResourceId(0x7f010345)));
}
} // namespace aapt