Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82c439b8 authored by Qingqing Deng's avatar Qingqing Deng Committed by android-build-merger
Browse files

Merge "Merge "Update isNewEmoji to check Unicode 12." into qt-dev am:...

Merge "Merge "Update isNewEmoji to check Unicode 12." into qt-dev am: 848b9847 am: 88e3fcd7" into qt-r1-dev-plus-aosp
am: e1c02076

Change-Id: I9099e4987ecb1e89fd340a43a465e532801f4d71
parents dae874bf e1c02076
Loading
Loading
Loading
Loading
+11 −13
Original line number Original line Diff line number Diff line
@@ -73,22 +73,20 @@ public class Emoji {
     * Returns true if the character is a new emoji still not supported in our version of ICU.
     * Returns true if the character is a new emoji still not supported in our version of ICU.
     */
     */
    public static boolean isNewEmoji(int c) {
    public static boolean isNewEmoji(int c) {
        // Emoji characters new in Unicode emoji 11
        // Emoji characters new in Unicode emoji 12
        // From https://www.unicode.org/Public/emoji/11.0/emoji-data.txt
        // From https://www.unicode.org/Public/emoji/12.0/emoji-data.txt
        // TODO: Remove once emoji-data.text 11 is in ICU or update to 11.
        // TODO: Remove once emoji-data.text 12 is in ICU or update to 12.
        if (c < 0x1F6F9 || c > 0x1F9FF) {
        if (c < 0x1F6D5 || c > 0x1FA95) {
            // Optimization for characters outside the new emoji range.
            // Optimization for characters outside the new emoji range.
            return false;
            return false;
        }
        }
        return c == 0x265F || c == 0x267E || c == 0x1F6F9 || c == 0x1F97A
        return c == 0x1F6D5 || c == 0x1F6FA || c == 0x1F93F || c == 0x1F971 || c == 0x1F97B
                || (0x1F94D <= c && c <= 0x1F94F)
                || (0x1F7E0 <= c && c <= 0x1F7EB) || (0x1F90D <= c && c <= 0x1F90F)
                || (0x1F96C <= c && c <= 0x1F970)
                || (0x1F9A5 <= c && c <= 0x1F9AA) || (0x1F9AE <= c && c <= 0x1F9AF)
                || (0x1F973 <= c && c <= 0x1F976)
                || (0x1F9BA <= c && c <= 0x1F9BF) || (0x1F9C3 <= c && c <= 0x1F9CA)
                || (0x1F97C <= c && c <= 0x1F97F)
                || (0x1F9CD <= c && c <= 0x1F9CF) || (0x1FA70 <= c && c <= 0x1FA73)
                || (0x1F998 <= c && c <= 0x1F9A2)
                || (0x1FA78 <= c && c <= 0x1FA7A) || (0x1FA80 <= c && c <= 0x1FA82)
                || (0x1F9B0 <= c && c <= 0x1F9B9)
                || (0x1FA90 <= c && c <= 0x1FA95);
                || (0x1F9C1 <= c && c <= 0x1F9C2)
                || (0x1F9E7 <= c && c <= 0x1F9FF);
    }
    }


    /**
    /**
+19 −1
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@ import org.junit.runner.RunWith;
public class EmojiTest {
public class EmojiTest {


    @Test
    @Test
    public void testIsNewEmoji_Emoji5() {
    public void testIsNewEmoji_Emoji() {
        // each row in the data is the range of emoji
        // each row in the data is the range of emoji
        final int[][][] data = new int[][][]{
        final int[][][] data = new int[][][]{
                {       // EMOJI 5
                {       // EMOJI 5
@@ -66,6 +66,24 @@ public class EmojiTest {
                        {0x1F9B0, 0x1F9B9},
                        {0x1F9B0, 0x1F9B9},
                        {0x1F9C1, 0x1F9C2},
                        {0x1F9C1, 0x1F9C2},
                        {0x1F9E7, 0x1F9FF},
                        {0x1F9E7, 0x1F9FF},
                },
                {       // EMOJI 12
                        {0x1F6D5, 0x1F6D5},
                        {0x1F6FA, 0x1F6FA},
                        {0x1F93F, 0x1F93F},
                        {0x1F971, 0x1F971},
                        {0x1F97B, 0x1F97B},
                        {0x1F7E0, 0x1F7EB},
                        {0x1F90D, 0x1F90F},
                        {0x1F9A5, 0x1F9AA},
                        {0x1F9AE, 0x1F9AF},
                        {0x1F9BA, 0x1F9BF},
                        {0x1F9C3, 0x1F9CA},
                        {0x1F9CD, 0x1F9CF},
                        {0x1FA70, 0x1FA73},
                        {0x1FA78, 0x1FA7A},
                        {0x1FA80, 0x1FA82},
                        {0x1FA90, 0x1FA95}
                }
                }
        };
        };