summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-05-23 03:06:16 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-05-23 03:06:16 +0000
commitedcddab54d38b66ebfced965760e8c33655904c0 (patch)
tree848a8f4c5082540006a9c1a244758390ec7f09b9
parent3628a2fd7b6bbd86a86751261c38fff6818aa71a (diff)
parenta9e9aa1de9a236e69b1e5e68714726aaf01182d1 (diff)
downloadminikin-android10-c2f2-release.tar.gz
Change-Id: I0f047e21259dc188235700c872a5398f4d47596f
-rw-r--r--libs/minikin/Emoji.cpp20
-rw-r--r--tests/unittest/EmojiTest.cpp13
2 files changed, 24 insertions, 9 deletions
diff --git a/libs/minikin/Emoji.cpp b/libs/minikin/Emoji.cpp
index ad83189..cd52f52 100644
--- a/libs/minikin/Emoji.cpp
+++ b/libs/minikin/Emoji.cpp
@@ -19,18 +19,20 @@
namespace minikin {
bool isNewEmoji(uint32_t c) {
- // Emoji characters new in Unicode emoji 11
- // From https://www.unicode.org/Public/emoji/11.0/emoji-data.txt
- // TODO: Remove once emoji-data.text 11 is in ICU or update to 11.
- if (c < 0x1F6F9 || c > 0x1F9FF) {
+ // Emoji characters new in Unicode emoji 12
+ // From https://www.unicode.org/Public/emoji/12.0/emoji-data.txt
+ // TODO: Remove once emoji-data.text 12 is in ICU or update to 12.
+ if (c < 0x1F6D5 || c > 0x1FA95) {
// Optimization for characters outside the new emoji range.
return false;
}
- return c == 0x265F || c == 0x267E || c == 0x1F6F9 || (0x1F94D <= c && c <= 0x1F94F) ||
- (0x1F96C <= c && c <= 0x1F970) || (0x1F973 <= c && c <= 0x1F976) || c == 0x1F97A ||
- (0x1F97C <= c && c <= 0x1F97F) || (0x1F998 <= c && c <= 0x1F9A2) ||
- (0x1F9B0 <= c && c <= 0x1F9B9) || (0x1F9C1 <= c && c <= 0x1F9C2) ||
- (0x1F9E7 <= c && c <= 0x1F9FF);
+ return c == 0x1F6D5 || c == 0x1F6FA || c == 0x1F93F || c == 0x1F971 || c == 0x1F97B ||
+ (0x1F7E0 <= c && c <= 0x1F7EB) || (0x1F90D <= c && c <= 0x1F90F) ||
+ (0x1F9A5 <= c && c <= 0x1F9AA) || (0x1F9AE <= c && c <= 0x1F9AF) ||
+ (0x1F9BA <= c && c <= 0x1F9BF) || (0x1F9C3 <= c && c <= 0x1F9CA) ||
+ (0x1F9CD <= c && c <= 0x1F9CF) || (0x1FA70 <= c && c <= 0x1FA73) ||
+ (0x1FA78 <= c && c <= 0x1FA7A) || (0x1FA80 <= c && c <= 0x1FA82) ||
+ (0x1FA90 <= c && c <= 0x1FA95);
}
bool isEmoji(uint32_t c) {
diff --git a/tests/unittest/EmojiTest.cpp b/tests/unittest/EmojiTest.cpp
index 32ffde7..643a112 100644
--- a/tests/unittest/EmojiTest.cpp
+++ b/tests/unittest/EmojiTest.cpp
@@ -32,6 +32,19 @@ TEST(EmojiTest, isEmojiTest) {
EXPECT_TRUE(isEmoji(0x1F6F7)); // SLED
EXPECT_TRUE(isEmoji(0x1F9E6)); // SOCKS
+ EXPECT_TRUE(isEmoji(0x1F6D5)); // HINDU TEMPLE
+ EXPECT_TRUE(isEmoji(0x1F7E7)); // ORANGE SQUARE
+ EXPECT_TRUE(isEmoji(0x1F9CF)); // DEAF PERSON
+ EXPECT_TRUE(isEmoji(0x1F9CE)); // PERSON KNEELING
+ EXPECT_TRUE(isEmoji(0x1F9A6)); // OTTER
+ EXPECT_TRUE(isEmoji(0x1F9A9)); // FLAMINGO
+ EXPECT_TRUE(isEmoji(0x1F9C6)); // FALAFEL
+ EXPECT_TRUE(isEmoji(0x1F9AA)); // OYSTER
+ EXPECT_TRUE(isEmoji(0x1FA82)); // PARACHUTE
+ EXPECT_TRUE(isEmoji(0x1FA80)); // YO-YO
+ EXPECT_TRUE(isEmoji(0x1FA70)); // BALLET SHOES
+ EXPECT_TRUE(isEmoji(0x1FA79)); // ADHESIVE BANDAGE
+
EXPECT_FALSE(isEmoji(0x0000)); // <control>
EXPECT_FALSE(isEmoji(0x0061)); // LATIN SMALL LETTER A
EXPECT_FALSE(isEmoji(0x1F93B)); // MODERN PENTATHLON