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); }
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 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) } }); }
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); }
async Task selectFont(object selectedObject) { try { if (selectedObject == null && !(selectedObject is FontsPageModel)) { return; } SelectedItem = null; var font = selectedObject as FontsPageModel; if (await changeFontConfirmation()) { FontsController.SetFont(font.Font); switchPage(); } } catch (Exception ex) { AppLogs.Log(ex); } }
void setFonts() { try { var fontList = FontsController.GetFonts(); string savedFont = _services.Preferences.Font; if (savedFont.Equals(FontsController.DefaultFont)) { savedFont = CrossLocalization.Translate(savedFont); } var fonts = fontList.Select(f => new FontsPageModel { Font = f, Title = FontsController.GetFontName(f), FontFamily = FontsController.GetFont(f, false), IsChecked = f.Equals(savedFont) }); FontList = new List <FontsPageModel>(fonts); } catch (Exception ex) { AppLogs.Log(ex); } }
public void GetNullFontNameTest() { var actual = FontsController.GetFontName(null); Assert.IsNull(actual); }
public void GetFontNameTest() { var actual = FontsController.GetFontName(_robotoFontRegular); Assert.AreEqual(_robotoFont, actual); }
public void GetFontsTest() { var actual = FontsController.GetFonts(); Assert.IsNotEmpty(actual); }
public void GetBoldFontAndroidTest() { var actual = FontsController.GetFont(_testRegularFont, true); Assert.AreEqual(_testBoldFont, actual); }
public void GetNullBoldFontIOSTest() { var actual = FontsController.GetFont(null, true); Assert.IsNull(actual); }
public void GetFontWithoutAliasNameTest() { var actual = FontsController.GetFontName(_robotoFont); Assert.AreEqual(_robotoFont, actual); }
/// <summary> /// Set current app font. /// </summary> static void setupFonts() { FontsController.Initialize(_services); FontsController.SetCurrentFont(); }
public void SetupFontsTest() { var actual = FontsController.GetCurrentFont(); Assert.IsNull(actual); }