Esempio n. 1
0
 public void IsCustom()
 {
     Emoji.Get(":grinning:").IsCustom.Should().Be(false);
     Emoji.Get(":octocat:").IsCustom.Should().Be(true);
     Emoji.Get(":fail:").IsCustom.Should().Be(true);
     GEmoji.Empty.IsCustom.Should().Be(true);
 }
Esempio n. 2
0
 public void Emoji_()
 {
     WriteLine(Emoji.Get(":tada:").Raw);                // 🎉
     WriteLine(Emoji.Raw(":tada:"));                    // 🎉
     WriteLine(Emoji.Emojify(":tada: initial commit")); // 🎉 initial commit
     WriteLine(Emoji.Find("party popper").First().Raw); // 🎉
 }
Esempio n. 3
0
        public void UpdateView()
        {
            var microsoft = string.Equals(SettingsService.Current.Appearance.EmojiSet.Id, "microsoft");
            var tone      = SettingsService.Current.Stickers.SkinTone;

            if (Toolbar.ItemsSource is List <EmojiGroup> groups)
            {
                if (groups.Count == Emoji.GroupsCount && microsoft)
                {
                    _needUpdate = true;
                }
                else if (groups.Count == Emoji.GroupsCount - 1 && !microsoft)
                {
                    _needUpdate = true;
                }
            }
            else
            {
                _needUpdate = true;
            }

            if (_needUpdate)
            {
                var items = Emoji.Get(tone, !microsoft);
                EmojiCollection.Source = items;
                Toolbar.ItemsSource    = items;
            }

            _needUpdate = false;
            UpdateSkinTone(tone, false, false);
        }
Esempio n. 4
0
        public void SetView(StickersPanelMode mode)
        {
            VisualStateManager.GoToState(this, mode == StickersPanelMode.Overlay
                ? "FilledState"
                : mode == StickersPanelMode.Sidebar
                ? "SidebarState"
                : "NarrowState", false);

            var microsoft = string.Equals(SettingsService.Current.Appearance.EmojiSet.Id, "microsoft");
            var tone      = SettingsService.Current.Stickers.SkinTone;

            if (Toolbar.ItemsSource is List <EmojiGroup> groups)
            {
                if (groups.Count == Emoji.GroupsCount && microsoft)
                {
                    var items = Emoji.Get(tone, false);
                    EmojiCollection.Source = items;
                    Toolbar.ItemsSource    = items;
                }
                else if (groups.Count == Emoji.GroupsCount - 1 && !microsoft)
                {
                    var items = Emoji.Get(tone, true);
                    EmojiCollection.Source = items;
                    Toolbar.ItemsSource    = items;
                }
            }
            else
            {
                var items = Emoji.Get(tone, !microsoft);
                EmojiCollection.Source = items;
                Toolbar.ItemsSource    = items;
            }

            UpdateSkinTone(tone, false, false);
        }
Esempio n. 5
0
        public void Get()
        {
            Emoji.Get(":grinning:").Should().NotBe(GEmoji.Empty);
            Emoji.Get(":fail:").Should().Be(GEmoji.Empty);
            Emoji.Get(":grinning:").Should().Be(Emoji.Get("grinning"));
            Emoji.Get(":laughing:").Should().Be(Emoji.Get(":satisfied:"));

            var octocat = Emoji.Get(":octocat:");

            octocat.Should().NotBe(GEmoji.Empty);
            octocat.Raw.Should().BeEmpty();
        }
Esempio n. 6
0
        public void LoadContextMenus_GEmoji()
        {
            var subject = new Main();

            subject.LoadContextMenus(new Result()).Should().BeEmpty();

            var result = new Result {
                ContextData = Emoji.Get("tada")
            };

            subject.LoadContextMenus(result).Should()
            .Contain(x => x.Title == "Copy raw emoji (Enter)")
            .And.Contain(x => x.Title == "Copy emoji aliases (Ctrl+C)");
        }
Esempio n. 7
0
        public async Task Api_vs_Emoji_All()
        {
            var client = new HttpClient();

            client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "hlaueriksson");
            var response = await client.GetAsync("https://api.github.com/emojis");

            var content = await response.Content.ReadAsStringAsync();

            var json = JObject.Parse(content);

            foreach (var token in json.PropertyValues())
            {
                var emoji = Emoji.Get(token.Path);

                emoji.Should().NotBe(GEmoji.Empty, $":{token.Path}:");
            }
        }
Esempio n. 8
0
        public void Get()
        {
            Emoji.Get(":grinning:").Should().NotBe(GEmoji.Empty);
            Emoji.Get(":fail:").Should().Be(GEmoji.Empty);
            Emoji.Get(":grinning:").Should().Be(Emoji.Get("grinning"));
            Emoji.Get(":laughing:").Should().Be(Emoji.Get(":satisfied:"));

            var octocat = Emoji.Get(":octocat:");

            octocat.Should().NotBe(GEmoji.Empty);
            octocat.Raw.Should().BeEmpty();

            Emoji.Get("😀").Should().NotBe(GEmoji.Empty);
            Emoji.Get("字").Should().Be(GEmoji.Empty);
            Emoji.Get("😀").Should().Be(Emoji.Get(":grinning:"));

            Action act = () => Emoji.Get(NullString);

            act.Should().Throw <ArgumentNullException>();
        }
Esempio n. 9
0
        private static string Raw(this string alias)
        {
            var emoji = Emoji.Get(alias);

            return(emoji != GEmoji.Empty ? emoji.Raw : alias);
        }
Esempio n. 10
0
        /// <summary>
        /// Gets the markup for the emoji associated with the alias.
        /// </summary>
        /// <param name="alias">The name uniquely referring to an emoji.</param>
        /// <returns>An HTML <c>string</c>.</returns>
        public static string Markup(this string alias)
        {
            var emoji = Emoji.Get(alias);

            return(emoji != GEmoji.Empty ? emoji.Markup() : alias);
        }