public void SetFontTest()
        {
            var mock = new Mock <IPlatformServices>();

            mock.Setup(ps => ps.Preferences.Font).Returns(_robotoFontRegular);
            FontsController.Initialize(mock.Object);
            FontsController.SetFont(_robotoFontRegular);
            var actual = FontsController.GetCurrentFont();

            Assert.AreEqual(_robotoFontRegular, actual);
        }
        public void SetDefaultFontTest()
        {
            var mock = new Mock <IPlatformServices>();

            mock.Setup(ps => ps.Preferences.Font).Returns(_defaultFont);
            FontsController.Initialize(mock.Object);
            FontsController.SetFont(_defaultFont);
            var actual = FontsController.GetCurrentFont();

            Assert.IsNull(actual);
        }
Пример #3
0
 public static Style GetEntryStyle(NamedSize size = NamedSize.Medium, bool bold = false)
 {
     return(new Style(typeof(Entry))
     {
         Setters =
         {
             getSetter(Entry.FontSizeProperty,       FontSizeController.GetSize(size,       typeof(Entry))),
             getSetter(Entry.FontFamilyProperty,     FontsController.GetCurrentFont(bold)),
             getSetter(Entry.FontAttributesProperty, bold ? FontAttributes.Bold : FontAttributes.None)
         }
     });
 }
Пример #4
0
        SearchBar createSearchBar()
        {
            var searchBar = new SearchBar {
                Margin            = _searchBarMargin,
                BackgroundColor   = Color.FromHex(Theme.Current.BaseBlockColor),
                CancelButtonColor = Color.FromHex(Theme.Current.BaseAppColor),
                TextColor         = Color.FromHex(Theme.Current.StatisticsBaseTitleColor),
                Placeholder       = CrossLocalization.Translate("stats_students_search_text"),
                FontFamily        = FontsController.GetCurrentFont(),
                FontSize          = FontSizeController.GetSize(NamedSize.Medium, typeof(SearchBar))
            };

            searchBar.SetBinding(SearchBar.TextProperty, "SearchText");
            return(searchBar);
        }
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            _answerModel = (TestPassingAnswerModel)BindingContext;

            if (_answerModel == null || !_answerModel.IsSelected)
            {
                return;
            }

            _boxView.Color         = Color.FromHex(Theme.Current.TestPassingSelectionColor);
            _answer.TextColor      = Color.FromHex(Theme.Current.TestPassingSelectionColor);
            _answer.FontAttributes = FontAttributes.Bold;
            _answer.FontFamily     = FontsController.GetCurrentFont(true);
        }
        public void SetupFontsTest()
        {
            var actual = FontsController.GetCurrentFont();

            Assert.IsNull(actual);
        }