Beispiel #1
0
        public void SetProperties(EmojiProperties property, UnicodeCodePointRange codePointRange)
        {
            int firstIndex = FindUcdCodePoint(codePointRange.FirstCodePoint);
            int lastIndex  = FindUcdCodePoint(codePointRange.LastCodePoint);

            if (firstIndex < 0 && lastIndex < 0)
            {
                Insert(new UnicodeCharacterDataBuilder(codePointRange)
                {
                    EmojiProperties = property
                });
                return;
            }

            if (firstIndex < 0 ||
                lastIndex < 0 ||
                ucdEntries[firstIndex].CodePointRange.FirstCodePoint <codePointRange.FirstCodePoint ||
                                                                      ucdEntries[lastIndex].CodePointRange.LastCodePoint> codePointRange.LastCodePoint)
            {
                throw new InvalidOperationException("Unable to find code point for setting emoji property.");
            }

            int i = firstIndex;

            while (true)
            {
                ucdEntries[i].EmojiProperties |= property;

                if (i == lastIndex)
                {
                    break;
                }

                ++i;
            }
        }
 [InlineData(0xE007F, EmojiProperties.ExtendedPictographic)] // CANCEL TAG
 public void CodePointShouldNotHaveEmojiProperties(int codePoint, EmojiProperties emojiProperties)
 => Assert.Equal((EmojiProperties)0, UnicodeInfo.GetCharInfo(codePoint).EmojiProperties & emojiProperties);