summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceValues_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/ResourceValues_test.cpp')
-rw-r--r--tools/aapt2/ResourceValues_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceValues_test.cpp b/tools/aapt2/ResourceValues_test.cpp
index e154d93b6f85..69f8e67530f6 100644
--- a/tools/aapt2/ResourceValues_test.cpp
+++ b/tools/aapt2/ResourceValues_test.cpp
@@ -180,4 +180,14 @@ TEST(ResourceValuesTest, StyleMerges) {
EXPECT_TRUE(a->Equals(expected.get()));
}
+// TYPE_NULL is encoded as TYPE_REFERENCE with a value of 0. This is represented in AAPT2
+// by a default constructed Reference value.
+TEST(ResourcesValuesTest, EmptyReferenceFlattens) {
+ android::Res_value value = {};
+ ASSERT_TRUE(Reference().Flatten(&value));
+
+ EXPECT_EQ(android::Res_value::TYPE_REFERENCE, value.dataType);
+ EXPECT_EQ(0x0u, value.data);
+}
+
} // namespace aapt